This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Having issues with having extra information on my Fasta file.
from Bio import Entrez
from Bio import SeqIO
Entrez.email = "trejomarco@test.edu"

file = open("humanSeq.txt")
sequences = open("humanSeq.fasta", "w")
l=[]
for line in file:
fields=line.split()
l.append(fields[0])
try:
    handle = Entrez.efetch(db="nucleotide", id=l, rettype="fasta", retmode="text")
    fasta_str = handle.read()
    handle.close()
    sequences.write(fasta_str)
except:
    continue
sequences.close()
file.close()

So in my fasta file I get the id for example: AY195771.1 Homo sapiens haplotype As2A mitochondrion, complete genome but I want to only have AY195771.1 and not the rest. Can anyone tell me to remove the extra information?

sequence

This issue has been addressed multiple times on the forum. Please search the forum for "fasta header" and you'll get a bunch of leads.

0 answers

No answers yet.

Log in to answer this question.