Having methods to create standard bits of molecules would be great. I think they are on the list I high level functionality I proposed some time back :-)
That said, creating a single coordinate in PDB format is kind of an odd end goal, and if you just want to do that, printf seems the right way to go :-)
Without such methods, you can't do much better although Chain and Residue and Atom all inherit from Hierarchy and so the casts are not needed. Nor are the separate creation of the Particles:
> m = IMP.Model() > chain = IMP.atom.Chain.create(IMP.Particle(m), 'A') > residue = IMP.atom.Residue.create(IMP.Particle(m)) > atom = IMP.atom.Atom.create(IMP.Particle(m), IMP.atom.AT_CA) > xyz = IMP.core.XYZ.create(ap) > residue.add_child(atom) > chain.add_child(residue) > print atom.get_pdb_string()
On Aug 7, 2009, at 11:24 AM, Dina Schneidman wrote:
>> atom = IMP::atom::Atom::create(p,IMP::atom::AT_CA) >> connecting this atom to a molecule ( with residue and chain of >> course) > > I tried to do the same thing now, i.e. print single coordinate in > PDB format. > something that normally should take 2 lines of code and ended up > with 14 lines. > m = IMP.Model() > rp = IMP.Particle(m) > ap = IMP.Particle(m) > cp = IMP.Particle(m); > chain = IMP.atom.Chain.create(cp, 'A') > residue = IMP.atom.Residue.create(rp) > atom = IMP.atom.Atom.create(ap, IMP.atom.AT_CA) > xyz = IMP.core.XYZ.create(ap) > hcd = IMP.atom.Hierarchy.cast(cp) > hrd = IMP.atom.Hierarchy.cast(rp) > had = IMP.atom.Hierarchy.cast(ap) > hcd.add_child(hrd) > hrd.add_child(had) > print atom.get_pdb_string() > > Is there a way to make it simpler? > Am I the only one who thinks it should be simpler? > > Dina > >> On Aug 6, 2009, at 7:05 PM, Daniel Russel wrote: >> >>> It should get it from the aromtype for all properly initialized atom >>> types. If it isn't currently doing that blame Dina :-) we should >>> be able to >>> fix it easily. >>> >>> I'm not sure there is a reason to store the element in the >>> particle rather >>> than just look it up from the atomtype when get_element is called. >>> Is there? >>> >>> >>> >>> On Aug 6, 2009, at 6:31 PM, Keren Lasker kerenl@salilab.org wrote: >>> >>>> seems that now element is needed for writing atoms in pdb format. >>>> Would not it make sense to set the value of element in >>>> Atom::create()? >>>> _______________________________________________ >>>> IMP-dev mailing list >>>> IMP-dev@salilab.org >>>> https://salilab.org/mailman/listinfo/imp-dev >>> >>> _______________________________________________ >>> IMP-dev mailing list >>> IMP-dev@salilab.org >>> https://salilab.org/mailman/listinfo/imp-dev >> >> _______________________________________________ >> IMP-dev mailing list >> IMP-dev@salilab.org >> https://salilab.org/mailman/listinfo/imp-dev >> > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev