Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. # Example combining all sequences in a fasta file using biopython
  2. # 1. pip install biopython (or just use anaconda)
  3. # 2. create fasta file with sequences named "example.fasta"
  4. # 3. python merge.py
  5. # Change print ... to print( ... ) if using python3
  6.  
  7. from Bio import SeqIO
  8. combined_seq = None
  9. for record in SeqIO.parse("example.fasta", "fasta"):
  10. print "Read {}".format(record.seq)
  11. if not combined_seq:
  12. combined_seq = record
  13. else:
  14. combined_seq += record
  15.  
  16. print "Combined sequence"
  17. print combined_seq.seq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement