Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make tab-delimited chromossome size file from fasta genome
import csv
from Bio import SeqIO
fastagenome = "data/oikopleura/assembly/Oikopleura_reference_unmasked_v3.0.fa"
output = "data/oikopleura/assembly/Oikopleura_reference_chrSizes.tsv"
myfile = open(output, "wb")
spamwriter = csv.writer(myfile, delimiter='\t', quoting=csv.QUOTE_MINIMAL)
for seq_record in SeqIO.parse(fastagenome, "fasta"):
spamwriter.writerow([str(seq_record.id) , str(len(seq_record))])
myfile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment