/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/env python # encoding: utf-8 """ 01_shuffle_fa.py Created by SNY of PICB on 2010/12/30 13:01:20. """ import sys import os import string import random from Bio import SeqIO from Bio.Seq import Seq def main(): in_name = sys.argv[1] out_name = sys.argv[2] in_handle = open(in_name) out_handle = open(out_name, "w") for seq_record in SeqIO.parse(in_handle, "fasta"): l = list(str(seq_record.seq)) random.shuffle(l) seq_record.seq = Seq(''.join(l)) SeqIO.write(seq_record, out_handle, "fasta") in_handle.close() out_handle.close() if __name__ == '__main__': main()
Comments
Subscribe to comments
