Question: How To Perform A Protein Analysis With The Protparam Module In Biopython
1
gravatar for saba.bsbi154
7.0 years ago by
saba.bsbi15410
saba.bsbi15410 wrote:

I am using this code for getting protein parameters from Protparam:

http://www.biopython.org/DIST/docs/api/Bio.SeqUtils.ProtParam-pysrc.html

But the problem is that I have many protein sequencs for which I want to calculate the features. so I am using following code for reading sequences in fasta format and storing the parsed sequence in variable a and passing it to function but its not working....:

handle = open("example.fasta", "rU") for record in SeqIO.parse(handle, "fasta") : a = t record.seq

X = ProtParam.ProteinAnalysis(a)

I would really appreciate if anybody could help me.. Many thanks Best regards,

Saba

protein biopython • 6.1k views
ADD COMMENTlink modified 7.0 years ago • written 7.0 years ago by saba.bsbi15410
7
gravatar for a.zielezinski
7.0 years ago by
a.zielezinski9.0k
a.zielezinski9.0k wrote:

Since the ProtParam module takes the protein sequence as a string you have to call str() on a Seq object to return the full sequence as a string.

This is a bit tricky, because you often don't actually have to do this conversion explicitly, because Python does this automatically with a print statement. If you are using Biopython 1.44 or older, using str(record.seq) will give just a truncated representation. Instead use record.seq.tostring() which is still available in the current Biopython releases for backwards compatibility.

For example:

from Bio import SeqIO
from Bio.SeqUtils import ProtParam

handle = open("example.fasta") 
for record in SeqIO.parse(handle, "fasta"): 
    seq = str(record.seq)
    X = ProtParam.ProteinAnalysis(seq)
    print X.count_amino_acids() 
    print X.get_amino_acids_percent() 
    print X.molecular_weight() 
    print X.aromaticity() 
    print X.instability_index() 
    print X.flexibility() 
    print X.isoelectric_point() 
    print X.secondary_structure_fraction()
ADD COMMENTlink modified 7.0 years ago • written 7.0 years ago by a.zielezinski9.0k

Biopython 1.44 was released in 2007, do you think we can stop worrying about this now? We're considering removing the tostring() method... https://github.com/biopython/biopython/pull/137

ADD REPLYlink written 7.0 years ago by Peter5.8k

Some of the functions are no longer available, such as molecular_wight()

ADD REPLYlink written 6.6 years ago by Biojl1.7k
0
gravatar for saba.bsbi154
7.0 years ago by
saba.bsbi15410
saba.bsbi15410 wrote:

Thank you so very much for your help. It worked...:)

Thanks Best regards, Saba

ADD COMMENTlink written 7.0 years ago by saba.bsbi15410

Saba, please accept a.zielezinski's answer rather than commenting with your own answer. That way he'll get a nice tick mark and your question will be marked as solved.

ADD REPLYlink written 7.0 years ago by Peter5.8k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1355 users visited in the last hour