Revision: 38337
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 31, 2010 03:56 by ishmael78
Initial Code
#!/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()
Initial URL
Initial Description
Initial Title
Shuffle fasta sequences
Initial Tags
Initial Language
Python