Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Example combining all sequences in a fasta file using biopython
- # 1. pip install biopython (or just use anaconda)
- # 2. create fasta file with sequences named "example.fasta"
- # 3. python merge.py
- # Change print ... to print( ... ) if using python3
- from Bio import SeqIO
- combined_seq = None
- for record in SeqIO.parse("example.fasta", "fasta"):
- print "Read {}".format(record.seq)
- if not combined_seq:
- combined_seq = record
- else:
- combined_seq += record
- print "Combined sequence"
- print combined_seq.seq
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement