Hi,
I've searched about this but did not find an answer. I'd like to know if it's possible to get a particle (from, e.g., a ListSingletonContainer) using its name instead of its index.
Thanks, Davide
Hi,
I solved by creating the dictionary:
> pidx[pname] = pindex
when the particle is added to the container.
Davide
On Oct 18, 2011, at 4:55 PM, Davide Baù wrote:
> Hi, > > I've searched about this but did not find an answer. I'd like to know if it's possible to get a particle (from, e.g., a ListSingletonContainer) using its name instead of its index. > > Thanks, > Davide
You need to be a bit careful as the particle names are not guaranteed to be unique (there are often a ton of particles with names like "CA" for example).
If you don't care about speed and it is a one-off sort of thing, you can also do something like [x for x in container.get_particles() if x.get_name()=="my name"]
On Tue, Oct 18, 2011 at 8:36 AM, Davide Baù davide.bau@gmail.com wrote:
> Hi, > > I solved by creating the dictionary: > > > pidx[pname] = pindex > > Evo Running Shoe - Men's - Black, 42.0 > > Sorry for the inconvenience, but we are not able to ship you the exchange > item you requested, because we need more information about the item you > want. If you have a second either respond to this email or give us a call > at 1-800-409-4502, and we can place the order and ship it out a.s.a.p. If > not, we’d be happy to credit your account—it’s up to you. Just let us know. > > when the particle is added to the container. > > Davide > > > On Oct 18, 2011, at 4:55 PM, Davide Baů wrote: > > > Hi, > > > > I've searched about this but did not find an answer. I'd like to know if > it's possible to get a particle (from, e.g., a ListSingletonContainer) using > its name instead of its index. > > > > Thanks, > > Davide > > > _______________________________________________ > IMP-dev mailing list > IMP-dev@salilab.org > https://salilab.org/mailman/listinfo/imp-dev >
participants (2)
-
Daniel Russel
-
Davide Baù