Hi,
Can someone please show me how to output protein sequence wrapped at 70 characters per line using the following code:
for record in SeqIO.parse(filename, "genbank"):
for feature in record.features:
if feature.type == "CDS":
locus_tag = feature.qualifiers.get("locus_tag", ["NoGeneID"])[0]
gene = feature.qualifiers.get("gene", ["NoGeneID"])[0]
outfile.write("\t".join([locus_tag,gene])+"\n")
Untested, but add this function somewhere at the top:
then replace
outfile.write(.....)
with:Also, are you trying to make a fasta file or something? Because if you want to keep this a tab-delimited table then using
\n
in both your data and for your newline delimiter is a bad idea.But maybe thats just how it goes in the magical world of bioinformatics data formats :>