From cmncri at ibmb.csic.es Mon Jul 25 11:26:25 2016 From: cmncri at ibmb.csic.es (=?UTF-8?Q?Claudia_Mill=C3=A1n_Nebot?=) Date: Mon, 25 Jul 2016 12:26:25 +0100 Subject: [Biopython] Problem when adding a residue Message-ID: Dear all, I am using Biopython to parse a pdb model extracted from a larger pdb and if a condition is met, complete it with some residues from the original pdb model. The residue object that I am trying to add was saved when parsing the original larger pdb, but when I am trying to add it to the new model I am getting this error: File "/Library/Python/2.7/site-packages/biopython-1.66-py2.7-macosx-10.11-intel.egg/Bio/PDB/PDBIO.py", line 187, in save fp.write("MODEL %s\n" % model.serial_num) AttributeError: 'Residue' object has no attribute 'serial_num' The pdb model that I am completing might have some changes in the chain nomenclature, could that be the reason for the error? But apparently is raised for something related with the model... so I am not sure what is happening. This is the relevant piece of code where the error happens: if add==True and checkres!=resi.get_full_id()[-1]: ncheckres=checkres[1] print "Adding ncheckres",ncheckres print "dictio_template[ncheckres]['residue_object']",dictio_template[ncheckres][ 'residue_object'] checkresobj=dictio_template[ncheckres][ 'residue_object'] #print "resi.serial_num",resi.serial_num() #print "list_res[i+1].serial_num",list_res[i+1].serial_num() #print "checkresobj.serial_num",checkresobj.serial_num() structure.add(dictio_template[ncheckres][ 'residue_object']) Thanks in advance, Claudia -------------- next part -------------- An HTML attachment was scrubbed... URL: From arklenna at gmail.com Mon Jul 25 13:08:56 2016 From: arklenna at gmail.com (Lenna Peterson) Date: Mon, 25 Jul 2016 09:08:56 -0400 Subject: [Biopython] Problem when adding a residue In-Reply-To: References: Message-ID: Hi Claudia, Rather than add the residue directly to the structure, you need to add it to a chain. So you will want to do something like `structure[0]["A"].add(...)` (depending on the models/chains in your structure). The PDB object in Biopython has 5 hierarchical levels: Structure Model Chain Residue Atom The error occurred because the `PDBIO.save` method expects the child of a `Structure` object to be a `Model` object, which has the attribute `serial_num`. Let me know if you still run into any problems. Cheers, Lenna On Mon, Jul 25, 2016 at 7:26 AM, Claudia Mill?n Nebot wrote: > Dear all, > > I am using Biopython to parse a pdb model extracted from a larger pdb and > if a condition is met, complete it with some residues from the original pdb > model. The residue object that I am trying to add was saved when parsing > the original larger pdb, but when I am trying to add it to the new model I > am getting this error: > > File > "/Library/Python/2.7/site-packages/biopython-1.66-py2.7-macosx-10.11-intel.egg/Bio/PDB/PDBIO.py", > line 187, in save > > fp.write("MODEL %s\n" % model.serial_num) > > AttributeError: 'Residue' object has no attribute 'serial_num' > > > The pdb model that I am completing might have some changes in the chain > nomenclature, could that be the reason for the error? But apparently is > raised for something related with the model... so I am not sure what is > happening. > > This is the relevant piece of code where the error happens: > > if add==True and checkres!=resi.get_full_id()[-1]: > > ncheckres=checkres[1] > > print "Adding ncheckres",ncheckres > > print > "dictio_template[ncheckres]['residue_object']",dictio_template[ncheckres][ > 'residue_object'] > > checkresobj=dictio_template[ncheckres][ > 'residue_object'] > > #print "resi.serial_num",resi.serial_num() > > #print > "list_res[i+1].serial_num",list_res[i+1].serial_num() > > #print > "checkresobj.serial_num",checkresobj.serial_num() > > structure.add(dictio_template[ncheckres][ > 'residue_object']) > > Thanks in advance, > > > Claudia > > _______________________________________________ > Biopython mailing list - Biopython at mailman.open-bio.org > http://mailman.open-bio.org/mailman/listinfo/biopython > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cmncri at ibmb.csic.es Mon Jul 25 14:56:55 2016 From: cmncri at ibmb.csic.es (=?UTF-8?Q?Claudia_Mill=C3=A1n_Nebot?=) Date: Mon, 25 Jul 2016 15:56:55 +0100 Subject: [Biopython] Problem when adding a residue In-Reply-To: References: Message-ID: Hi Lenna, thanks for the quick answer. It makes perfect sense and now is working. Best, Claudia 2016-07-25 14:08 GMT+01:00 Lenna Peterson : > Hi Claudia, > > Rather than add the residue directly to the structure, you need to add it > to a chain. So you will want to do something like > `structure[0]["A"].add(...)` (depending on the models/chains in your > structure). > > The PDB object in Biopython has 5 hierarchical levels: > Structure > Model > Chain > Residue > Atom > > The error occurred because the `PDBIO.save` method expects the child of a > `Structure` object to be a `Model` object, which has the attribute > `serial_num`. > > Let me know if you still run into any problems. > > Cheers, > > Lenna > > On Mon, Jul 25, 2016 at 7:26 AM, Claudia Mill?n Nebot > wrote: > >> Dear all, >> >> I am using Biopython to parse a pdb model extracted from a larger pdb and >> if a condition is met, complete it with some residues from the original pdb >> model. The residue object that I am trying to add was saved when parsing >> the original larger pdb, but when I am trying to add it to the new model I >> am getting this error: >> >> File >> "/Library/Python/2.7/site-packages/biopython-1.66-py2.7-macosx-10.11-intel.egg/Bio/PDB/PDBIO.py", >> line 187, in save >> >> fp.write("MODEL %s\n" % model.serial_num) >> >> AttributeError: 'Residue' object has no attribute 'serial_num' >> >> >> The pdb model that I am completing might have some changes in the chain >> nomenclature, could that be the reason for the error? But apparently is >> raised for something related with the model... so I am not sure what is >> happening. >> >> This is the relevant piece of code where the error happens: >> >> if add==True and checkres!=resi.get_full_id()[-1 >> ]: >> >> ncheckres=checkres[1] >> >> print "Adding ncheckres",ncheckres >> >> print >> "dictio_template[ncheckres]['residue_object']" >> ,dictio_template[ncheckres]['residue_object'] >> >> checkresobj=dictio_template[ncheckres][ >> 'residue_object'] >> >> #print "resi.serial_num",resi.serial_num() >> >> #print >> "list_res[i+1].serial_num",list_res[i+1].serial_num() >> >> #print >> "checkresobj.serial_num",checkresobj.serial_num() >> >> structure.add(dictio_template[ncheckres][ >> 'residue_object']) >> >> Thanks in advance, >> >> >> Claudia >> >> _______________________________________________ >> Biopython mailing list - Biopython at mailman.open-bio.org >> http://mailman.open-bio.org/mailman/listinfo/biopython >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tra at popgen.net Thu Jul 28 21:39:17 2016 From: tra at popgen.net (Tiago Antao) Date: Thu, 28 Jul 2016 15:39:17 -0600 Subject: [Biopython] Deprecating simcoal and fdisk content in PopGen Message-ID: <3d1da74384f6ab554eced103c36cf226@webmail.webfaction.com> Dear all, I would like to deprecate a big part of PopGen, that is: - All the simcoal stuff - All the fdist stuff. Simcoal comes from the lack of source code and a free license. fdist from a lack of license. In simcoal case, I do not think we should support black box code (unless it is something very very popular which is definitely not the case). For the fdist case I suspect that 99%+ of the users are via my own applications, and I will take care of that myself. We would benefit my reducing Biopython's complexity a little bit. For simcoal, I understand that there might be a few (handful at most?) users, but I think the trade-off is well worth it. Any opinions? Regards, Tiago