资源简介
文件用于计算fasta文件中基因序列的N50、基因条数、最短最长的序列条数。将脚本文件拷贝至fasta文件目录下,使用方法:python cal_N50.py
跳出“Enter your fasta/fa name: ”后,输入你当前目录下的fasta文件名后回车即可
代码片段和文件信息
#GC_N50.py
print ‘Python and Biopython needed for running this script!‘
print “script for calculating N50 of assembly“
fasta = raw_input(‘Enter your fasta/fa name: ‘)
# N50 calculation
baseSumLength= 0[]
ValueSumN50 = 00
no_cno_gno_ano_tno_n = 00000
from Bio import SeqIO
for record in SeqIO.parse(open(fasta) “fasta“):
baseSum += len(record.seq)
Length.append(len(record.seq))
seq =record.seq.lower()
no_c+=seq.count
评论
共有 条评论