This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Biopython Protparam

Hi - I have a fasta file with proteins that I wish to do some simple protein analysis on using the ProtParam package using the following:

from Bio import SeqIO
from Bio.SeqUtils import ProtParam

handle = open("examplefasta.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()

however I am getting the following error:

from: can't read /var/mail/Bio
from: can't read /var/mail/Bio.SeqUtils
./protanalysis.py: line 4: syntax error near unexpected token `('
./protanalysis.py: line 4: `handle = open("examplefasta.fasta") '

I don't really understand why the program is looking in /var/mail/ . Using Linux by the way. anyone else come across this problem?

Thanks,

Arron.

protein analysis

in general always include the full traceback not just a small part of it

2 answers

I wasn't calling python to run the program. that's the answer.

You could add a hash-bang line, but I'm guessing without it the fact it started with "from" made the OS guess it was a email file? e.g.

#!/usr/bin/env python

I've also realised this problem isn't related to Biopython. I must have set some erroneous paths somewhere.

Were you able to solve it? I am also facing the same problem now

Log in to answer this question.