[BioPython] bio.PDB module

quantrum75 quantrum75 at yahoo.com
Fri Jan 11 00:16:51 UTC 2008


Hi 
I am a biopython newbie. I was wondering if someone could show me or send me ( I would be thankful) where I could find a script which can read a pdb file and out the phi and psi angles of the protein structure.
I have read through the bio.PDB module and structural module documentation, but still do not have an idea on how to proceed to tackle the problem. I wish the bio.PDB documentation was a bit more detailed and included some examples to work with. I really would like to contribute to the project and maybe if I got an initial idea on how to work with the same, I can contribute in some small way.
Thanks for your time
Regards
Rama


biopython-request at lists.open-bio.org wrote: Send BioPython mailing list submissions to
 biopython at lists.open-bio.org

To subscribe or unsubscribe via the World Wide Web, visit
 http://lists.open-bio.org/mailman/listinfo/biopython
or, via email, send a message with subject or body 'help' to
 biopython-request at lists.open-bio.org

You can reach the person managing the list at
 biopython-owner at lists.open-bio.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of BioPython digest..."


Today's Topics:

   1. Re: [BioSQL-l] Authority in biodatabase table (Peter)
   2. Re: FormatConverter: from Fasta format to ClustalW format
      (Lee,Byung-chul)
   3. Re: FormatConverter: from Fasta format to ClustalW format (Peter)
   4. Re: FormatConverter: from Fasta format to ClustalW format (Peter)
   5. Bio.Ais (Michiel de Hoon)
   6. Bio.PDB - adding 'dummy atoms' (Christian Meesters)
   7. Re: Bio.PDB - adding 'dummy atoms' (Peter)
   8. blastall does not exist at %s" % blastcmd (Stefanie L?ck)
   9. Re: blastall does not exist at %s" % blastcmd (Peter)


----------------------------------------------------------------------

Message: 1
Date: Wed, 2 Jan 2008 11:57:46 +0000
From: Peter 
Subject: Re: [BioPython] [BioSQL-l] Authority in biodatabase table
To: "Hilmar Lapp" 
Cc: biopython at lists.open-bio.org, biosql-l at lists.open-bio.org
Message-ID:
 <320fb6e00801020357g724917b5s853d99f2f953753a at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On 1/1/08, Hilmar Lapp  wrote:
> (Sorry for this long-too-late reply. Going through old email that got
> left unread or unresponded.)
>
> Peter - you probably implemented something meanwhile that suits your
> needs. Just FYI, BioPerl leaves this empty too. The general notion
> for authority is that of the LSID authority field, but of course you
> won't be able to parse this out of any input file. The value for
> SwissProt would be uniprot.org, for example. For NCBI, I'm not sure -
> NCBI hasn't ever issued any LSIDs, but presumably it would be
> something like ncbi.nlm.nih.gov.
>
>        -hilmar

Thank you Hilmar.

It seem's that the current code in Biopython is fine (the authority
field is left blank by default, unless the user supplies their own
value), and consistent with both BioPerl and BioJava in this regard
(thanks Richard).

Peter


------------------------------

Message: 2
Date: Wed, 02 Jan 2008 22:44:47 +0900
From: "Lee,Byung-chul" 
Subject: Re: [BioPython] FormatConverter: from Fasta format to
 ClustalW format
To: biopython at lists.open-bio.org
Message-ID: <477B954F.9020004 at kaist.ac.kr>
Content-Type: text/plain; charset=EUC-KR


Thank you very much for your kind reply, Peter.

As your explanation, I tried to use SeqIO, but another error occured
I did it like below:

-----------------
from Bio import SeqIO
from Bio.Align import AlignInfo
alignment = SeqIO.to_alignment(SeqIO.parse(open('tmp.fasta'), "fasta"))
summary_align = AlignInfo.SummaryInfo(alignment)
print summary_align.dumb_consensus()
--------------------
but the results are
-----------------
Traceback (most recent call last):
  File "tmp.py", line 16, in 
    print summary_align.dumb_consensus()
  File "/var/lib/python-support/python2.5/Bio/Align/AlignInfo.py", line 111, in dumb_consensus
    consensus_alpha = self._guess_consensus_alphabet()
  File "/var/lib/python-support/python2.5/Bio/Align/AlignInfo.py", line 189, in _guess_consensus_alphabet
    ("Non-gapped alphabet found in alignment object.")
ValueError: Non-gapped alphabet found in alignment object.
---------------------
In addition, all sequences have the same lenghth in my tmp.fasta file.
-----
>seq2
DAC
>seq3 
DC-
>seq1 
DAD
>seq4
DDD

Is this problem caused by the Biopython/Martel and mxTextTools vesions?
I am using biopython 1.43-2 (ubuntu version) and mxtexttools 3.0.0-2ubuntu1.

What should I do for this? Thanks.

Byung chul.

Peter wrote:
> Hello Byung chul Lee,
>
> On 1/2/08, Lee,Byung-chul wrote:
>   
>> Dear colleagues.
>>
>> I want to use the AlignInfo.SummaryInfo for fasta-format alignment file.
>> I think that to do the process firstly the fasta format should be
>> converted to clustalw format, so I try to use Formatconverter.
>> However, at my trial, I cannot do that.
>>     
>
> Once you have an alignment object (loaded from any file format), this
> should work with AlignInfo.  I don't think you need to convert it from
> FASTA to ClustalW.
>
> I would guess the error you saw is a problem with Biopython/Martel and
> mxTextTools 3.0, which isn't 100% compatible with mxTextTools 2.0.
> What version of Biopython are you using, as I would have expected this
> to work fine with Biopython 1.44?
>
> You could also try using Bio.SeqIO to load the FASTA format alignment
> file instead, see http://biopython.org/wiki/SeqIO
>
> from Bio import SeqIO
> from Bio.Align import AlignInfo
> alignment = SeqIO.to_alignment(SeqIO.parse(open('tmp.fasta'), "fasta"))
> summary_align = AlignInfo.SummaryInfo(alignment)
>
> Peter
>
>   



------------------------------

Message: 3
Date: Wed, 2 Jan 2008 17:46:25 +0000
From: Peter 
Subject: Re: [BioPython] FormatConverter: from Fasta format to
 ClustalW format
To: "Lee,Byung-chul" 
Cc: biopython at lists.open-bio.org
Message-ID:
 <320fb6e00801020946j5b331137s14f9e1d90e888a2e at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Jan 2, 2008 1:44 PM, Lee,Byung-chul  wrote:
> As your explanation, I tried to use SeqIO, but another error occured
> I did it like below:

My fault, sorry. I wasn't at a computer with Biopython installed, I
had to guess.  I'll try and put together a proper example for you
tomorrow.

> Is this problem caused by the Biopython/Martel and mxTextTools vesions?
> I am using biopython 1.43-2 (ubuntu version) and mxtexttools 3.0.0-2ubuntu1.

The original problem you reported was due to the combination of
Biopython 1.43 (the Martel module) and mxTextTools 3.0. You can either
update to Biopython 1.44 or downgrade to mxTextTools 2.0 - neither is
going to be very simple if you want to use the Ubuntu repositories.
To avoid this Martel problem, I would suggest you un-install Biopython
1.43 from the Ubuntu repository, and then install Biopython 1.44 from
source.

Peter


------------------------------

Message: 4
Date: Fri, 4 Jan 2008 13:20:26 +0000
From: Peter 
Subject: Re: [BioPython] FormatConverter: from Fasta format to
 ClustalW format
To: "Lee,Byung-chul" 
Cc: biopython at lists.open-bio.org
Message-ID:
 <320fb6e00801040520i11c9a4c4q4449cee34da00706 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Jan 2, 2008 5:46 PM, Peter wrote:
> On Jan 2, 2008 1:44 PM, Lee,Byung-chul wrote:
> > As your explanation, I tried to use SeqIO, but another error occured
> > I did it like below:
>
> My fault, sorry. I wasn't at a computer with Biopython installed, I
> had to guess.  I'll try and put together a proper example for you
> tomorrow.

This should work on Biopython 1.43 or later, I have tested it using
the simple FASTA file you gave earlier:

from Bio.Alphabet.IUPAC import IUPACProtein
from Bio.Alphabet import Gapped
from Bio import SeqIO
from Bio.Align import AlignInfo
gapped_protein = Gapped(IUPACProtein())

records = list(SeqIO.parse(open('tmp.fasta'), "fasta"))
for rec in records :
    #Override the default generic alphabet:
    rec.seq.alphabet = gapped_protein
#Turn these records into an alignment
alignment = SeqIO.to_alignment(records, gapped_protein)
del records

summary_align = AlignInfo.SummaryInfo(alignment)
print summary_align.dumb_consensus()
print summary_align.gap_consensus()

The problem with my previous shorter suggestion was the Bio.SeqIO
FASTA parser returned SeqRecord objects with a generic alphabet, while
the alignment summary expected a gapped alphabet.  I'm beginning to
think that the Bio.SeqIO.parse() function should allow an alphabet to
be specified as an optional argument for this sort of situation.

Alternatively, going back to your original code how about:

from Bio.Fasta import FastaAlign
from Bio.Align import AlignInfo

alignment = FastaAlign.parse_file('tmp.fasta',type='PROTEIN')
summary_align = AlignInfo.SummaryInfo(alignment)
print summary_align.dumb_consensus()
print summary_align.gap_consensus()

This works using Biopython 1.44 with either mxTextTools 2.0 or 3.0.
It should work with older versions of Biopython using mxTextTools 2.0
as well.

Peter


------------------------------

Message: 5
Date: Sat, 5 Jan 2008 00:41:25 -0800 (PST)
From: Michiel de Hoon 
Subject: [BioPython] Bio.Ais
To: biopython at lists.open-bio.org, biopython-dev at lists.open-bio.org
Message-ID: <140129.37367.qm at web62402.mail.re1.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1

Hi everybody,

I was checking which Biopython modules access Entrez/GenBank in any way, and in the process found the script example_ais2.py in Bio/Ais/Examples (this is not related to Entrez/GenBank in any way, it just caught my eye because it imports urllib). 
Currently, this example script does not seem to work:

$ python example_ais2.py
Traceback (most recent call last):
  File "example_ais2.py", line 39, in 
    immune = Immune( align, alphabet, 100 )
...
TypeError: 'int' object is not iterable

The directory Bio/Ais/Examples and its file example_ais2.py only appears in CVS and is not included in Biopython releases.

Does anybody know how to fix this example? If not, what should we do with it?

--Michiel.

       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.


------------------------------

Message: 6
Date: Mon, 7 Jan 2008 19:13:59 +0100
From: Christian Meesters 
Subject: [BioPython] Bio.PDB - adding 'dummy atoms'
To: "biopython at lists.open-bio.org" 
Message-ID: <1199729639.13152.20.camel at meesters.biologie.uni-mainz.de>
Content-Type: text/plain

Hoi,

I'd like to add 'dummy atoms' to a Bio.PDB Structure object. So far, I
have this approach:

new = Atom('OX', array([x, y, z]), 0, 1, 0, " OX ", serial_number)
residue.add(new)

Here x, y, and z are floating point numbers and serial_number is an
integer. 'residue' is a 'Residue' I'm iterating over. However, I keep
getting the following error message and don't have a clue, how to
proceed:

new = Atom('OX', array([x, y, z]), 0, 1, 0, " OX ", serial_number)
TypeError: object of type 'module' is not callable

Does anyone have a hint for me, how actually add an atom or what's wrong
here?

TIA
Christian




------------------------------

Message: 7
Date: Mon, 7 Jan 2008 18:55:57 +0000
From: Peter 
Subject: Re: [BioPython] Bio.PDB - adding 'dummy atoms'
To: "Christian Meesters" 
Cc: "biopython at lists.open-bio.org" 
Message-ID:
 <320fb6e00801071055n6bcb936dr58e96ac87b6e509d at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Christian Meesters wrote:
> I'd like to add 'dummy atoms' to a Bio.PDB Structure object. So far, I
> have this approach:
> ...
> new = Atom('OX', array([x, y, z]), 0, 1, 0, " OX ", serial_number)
> TypeError: object of type 'module' is not callable
>
> Does anyone have a hint for me, how actually add an atom or what's wrong
> here?

I would infer from the error that "Atom" refers to the Bio.PDB.Atom
module, rather than the Bio.PDB.Atom.Atom class.  How did you do your
imports?  Try this:

from Bio.PDB.Atom import Atom

Peter


------------------------------

Message: 8
Date: Tue, 8 Jan 2008 10:06:40 +0100
From: Stefanie L?ck 
Subject: [BioPython] blastall does not exist at %s" % blastcmd
To: 
Message-ID: <002301c851d5$c7daac60$1022a8c0 at ipkgatersleben.de>
Content-Type: text/plain; charset="iso-8859-1"

Hi!

I'm trying to get a local blast running. I proceeded as described in the cookbook but I allways get this Error message:
>>>
Traceback (most recent call last):
  File "F:\Blast\blast.py", line 10, in 
    my_blast_db, my_blast_file)
  File "C:\Python25\Lib\site-packages\Bio\Blast\NCBIStandalone.py", line 1499, in blastall
    raise ValueError, "blastall does not exist at %s" % blastcmd
ValueError: blastall does not exist at C:\Blast\bin\blastall.exe
<<<

>>>
My Code:

import Bio
from Bio.Blast import NCBIStandalone
import os

my_blast_db = r"F:\Blast\primerdb"
my_blast_file = "test.fasta"
my_blast_exe = r"C:\Blast\bin\blastall.exe"

result_handle, error_info = NCBIStandalone.blastall(my_blast_exe, "blastn",
my_blast_db, my_blast_file)
blast_results = result_handle.read()
save_file = open("my_blast.xml", "w")
save_file.write(blast_results)
save_file.close()
<<<

blastall.exe is in this folder (checked by os.listdir()) but can't be found from the tool.

I'm using Python 2.5 and biopython-1.44.win32-py2.5.exe.

Does somewone has idea where's the problem?

Greetings 
Stefanie


------------------------------

Message: 9
Date: Tue, 8 Jan 2008 10:46:02 +0000
From: Peter 
Subject: Re: [BioPython] blastall does not exist at %s" % blastcmd
To: " Stefanie L?ck " 
Cc: biopython at lists.open-bio.org
Message-ID:
 <320fb6e00801080246t5aa515ccuc8699134b533e8b9 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Jan 8, 2008 9:06 AM, Stefanie L?ck  wrote:
> Hi!
>
> I'm trying to get a local blast running. I proceeded as described in the cookbook
> but I allways get this Error message:
> >>>
> Traceback (most recent call last):
>   File "F:\Blast\blast.py", line 10, in 
>     my_blast_db, my_blast_file)
>   File "C:\Python25\Lib\site-packages\Bio\Blast\NCBIStandalone.py", line 1499, in blastall
>     raise ValueError, "blastall does not exist at %s" % blastcmd
> ValueError: blastall does not exist at C:\Blast\bin\blastall.exe
> <<<
>
> >>>
> My Code:
>
> import Bio
> from Bio.Blast import NCBIStandalone
> import os
>
> my_blast_db = r"F:\Blast\primerdb"
> my_blast_file = "test.fasta"
> my_blast_exe = r"C:\Blast\bin\blastall.exe"
>
> result_handle, error_info = NCBIStandalone.blastall(my_blast_exe, "blastn",
> my_blast_db, my_blast_file)
> ...
> blastall.exe is in this folder (checked by os.listdir()) but can't be found from the tool.
>

Could you try this, which is the test done in the Biopython blastall
function that triggers the error message you saw:

print os.path.exists(my_blast_exe)

Could you also double check the path is C:\Blast\bin\blastall.exe and
not perhaps C:\Blast\blastall.exe (the NCBI changed this at some point
on Windows). Also did you install it to the F: drive where your
database is, rather than C: ?

> I'm using Python 2.5 and biopython-1.44.win32-py2.5.exe.

What version of standalone blast do you have?

Peter



------------------------------

_______________________________________________
BioPython mailing list  -  BioPython at lists.open-bio.org
http://lists.open-bio.org/mailman/listinfo/biopython


End of BioPython Digest, Vol 61, Issue 2
****************************************


       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.



More information about the Biopython mailing list