Turning Seq objects into strings
0
1
Entering edit mode
5.7 years ago
schlogl ▴ 160

There are any way that i can transform a input string in to a byopython Seq object? I try a lot of things and search in the google but not a answer. Thanks

sequence • 11k views
ADD COMMENT
0
Entering edit mode

Have you read the BioPython manual?

This is spelled out pretty plainly, eg: https://biopython.org/DIST/docs/api/Bio.SeqRecord.SeqRecord-class.html

Can you explain your question with examples? Your question implies the opposite of your title.

ADD REPLY
4
Entering edit mode

Not really @joe. He might be a biologist and not a programmer like yourself and I.

seq1 = SeqIO.read("example_fasta_files/homo_sapiens_lactate.fasta", "fasta")
print(type(seq1.seq)) #this is the seq attribute of the seq1 object
strrep = str(seq1.seq) #so cast the seq attribute to str
print(type(strrep)) #this shows type string, it worked
print(strrep) # this is the string
ADD REPLY

Login before adding your answer.

Traffic: 1919 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6