From: Noel O'B. <bao...@gm...> - 2009-08-15 19:56:49
|
Hello Kirk, One possibility is to iterate over the atoms in the original residue, and create a new atom as part of the new molecule where you set the coordinates and atom numbers the same. I'm not sure whether you can directly copy a residue from one molecule to another. I've retitled this thread to summarise your question in the hope that someone will know the answer to that question. - Noel P.S. It should be "newres = openbabel.OBResidue(res)" as "newres = res" doesn't copy anything (unlike the C++ API). This still doesn't solve your problem. 2009/8/6 Robert DeLisle <rkd...@gm...>: > Geoff (et al), > > To clarify the issue a bit and provide an actual working (non-working) > example, I've attached a very short Python script. Essentially all that I'm > doing is to open a PDB file (also attached), get the first residue, create a > new molecule and copy the residue into the new molecule. Ultimately I'd > like to write out the molecule in SDF format, but I think that step is > trivial. Notice from the output of the print statements (noted in the code) > I end up with a new molecule containing one residue but no atoms. Where did > the atoms go? Have a failed an initialization or construction step? > > -Kirk DeLisle > > > > On Tue, Aug 4, 2009 at 5:20 PM, Geoffrey Hutchison > <ge...@ge...> wrote: >> >> On Aug 4, 2009, at 6:44 PM, rkd...@gm... wrote: >> >>> Ultimately, I would like to get rid of all protein derived portions. This >>> is simple with larger pieces (filter by molecular weight), but I've yet to >>> come up with a way to filter smaller portions and particularly the multiple >>> rotamers. I tried to interrogate any data objects attached to resulting >>> molecules - I'm told that there are from 6 to 9 OBGenericData objects >>> attached, however if I try to get a list of the keys for those data objects, >>> I'm told that none exist. >> >> So if I understand, you want to keep only atoms / fragments which are >> HETATM records? >> >> My suggestion is first to iterate through the residues. For each residue, >> you can iterate through the atoms and query OBResidue::IsHetAtom: >> >> http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBResidue.shtml#cbf3d5f13bc263f0957a70dedca072c8 >> >> If it's not a HETATM record, mark the atom for deletion. After that, call >> OBMol::Separate. >> >> Now, I use the C++ code directly, so I'm not sure about all of this in >> Python. In particular, you'd want to save a pointer to the OBAtom in a list >> and then delete everything in the list. Others can comment on whether that's >> currently possible in Python. >> >> Hope that helps, >> -Geoff > > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus > on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > OpenBabel-discuss mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openbabel-discuss > > |