Skip to content

Instantly share code, notes, and snippets.

@afrendeiro
Last active January 4, 2016 21:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save afrendeiro/8678567 to your computer and use it in GitHub Desktop.
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