https://github.com/fjruizruano/ngs-protocols
Raw File
Tip revision: 39a091d1fa569a7fc717ac73c4b3de07f0a1204d authored by fjruizruano on 03 August 2023, 11:48:27 UTC
adding gfa2fas.py and extract_gfa.py
Tip revision: 39a091d
fasta_sequence_len.py
#!/usr/bin/python

import sys
from Bio import SeqIO

print "Usage: fasta_sequence_len.py FastaFile"

try:
    file = sys.argv[1]
except:
    file = raw_input("Introduce FASTA file: ")

data = SeqIO.parse(open(file), "fasta")

w = open(file+".len", "w")

for s in data:
    w.write("%s\t%s\n" % (str(s.id), len(str(s.seq))))

w.close()
back to top