[BioPython] Comment/Suggestion about Bio.PDB.Polypeptide
class. How to keep gaps information ?
Julie Bernauer
julie.bernauer at ibbmc.u-psud.fr
Wed May 25 04:59:58 EDT 2005
On Tue, 2005-05-24 at 20:26 +0200, thamelry at binf.ku.dk wrote:
> Hi Julie,
> [...]
> I'll try to add this, but I'm busy at the moment (4 articles in the
> pipeline), but you're welcome to give it a try and send me your code :-).
Hi Thomas,
Thank you for your quick answer.
Here is a quick and dirty hack that works for me, just see whether you
may use it:
class BrokenPolypeptide(list):
"""
A broken polypeptide is simply a list of polypeptide objects.
"""
def get_sequence(self):
"""
Return the AA sequence, filling gap or unknown residue with X.
@return: polypeptide sequence
@rtype: L{Seq}
"""
s=""
if self == []:
end=0
else :
end=self[0][-1].get_id()[1]
for peptide in self:
start=peptide[0].get_id()[1]
gaplength=start-end
for indexgap in range(0, gaplength):
s=s+'X'
for res in peptide:
resname=res.get_resname()
if to_one_letter_code.has_key(resname):
resname=to_one_letter_code[resname]
else:
resname='X'
s=s+resname
end=peptide[-1].get_id()[1]
seq=Seq(s, ProteinAlphabet)
return seq
HTH, regards,
J.
--
Julie BERNAUER
Equipe de Génomique Structurale http://www.genomics.eu.org
IBBMC - UMR 8619 - U.P.S. Bât.430 Tel. : +33 1 69 15 31 57
91405 Orsay - FRANCE Fax. : +33 1 69 85 37 15
More information about the BioPython
mailing list