Re: [AMBER] how to obtain index of atoms based on residue and atom masks

From: Hai Nguyen <nhai.qn.gmail.com>
Date: Wed, 19 Jan 2022 15:31:06 -0500

Alternatively, Tammy can use `pytraj` (in AmberTools) (python interface of
cpptraj)

python code
```
import pytraj as pt
top = pt.load_topology('your.{pdb,parm7,...}')
print(top.select(':1')) # get atom index for residue 1
```
PS: You can find the document (a bit outdated) here:
https://amber-md.github.io/pytraj/latest/index.html

Hai

On Wed, Jan 19, 2022 at 5:24 AM Dr. Anselm Horn <anselm.horn.fau.de> wrote:

> Tammy,
>
> adding to Matthew's idea:
>
> If you have the pdb-tools for the command line installed on your system
> (pip install pdb-tools ; cf http://www.bonvinlab.org/pdb-tools/), a pdb
> file of your system at hand, and a simple residue mask, then a single
> command line may also yield almost all you want, provided that you just
> select standard residues:
>
> pdb_selres -<res_first:res_last> <your.pdb> | grep "^ATOM" | awk
> '{printf "%1d,", $2} '; echo
>
> Note that the last index is followed by a comma, too.
> (The selection mask for pdb_selres also allows for more than just one
> residue range.)
>
> For advanced masks, however, it is certainly better to use cpptraj for
> preprocessing, as Matthew suggested.
>
> Best regards,
>
> Anselm
>
> Bioinformatik | NHR.FAU
> Friedrich-Alexander-Universität Erlangen-Nürnberg (FAU)
> Germany
>
>
> Am 19.01.2022 um 04:12 schrieb Matthew Guberman-Pfeffer:
> > Hello Tammy,
> >
> > One thought is that you can use the mask keyword in cpptraj to generate
> a file. This file, call it mask.txt, will list the atom numbers in the
> second column. You then can process this file with a bash script to get a
> comma separated list, something like the following:
> >
> > idx=0
> > while IFS= read -r F1 <&2;do
> >
> > if [ $idx != 0 ];then
> > atnum=$(echo $F1 | awk '{print $2}')
> > echo -n “${atnum},";
> > fi
> >
> > idx=$((idx+1))
> > done 2< mask.txt
> >
> > Note that the line indexing (idx) is to skip the “AtomNum” header in
> mask.txt.
> >
> > Hope this work-around helps.
> >
> > Best,
> > Matthew
> >
> >
> >
> >> On Jan 18, 2022, at 8:01 PM, Ming Tang <m21.tang.qut.edu.au> wrote:
> >>
> >> *Message sent from a system outside of UConn.*
> >>
> >>
> >> Dear list,
> >>
> >> Is there a command to print out atom indexes (separated by comma) for a
> large number of residues? I want to use them as cv_i in ABMD.
> >>
> >> Thanks,
> >> Tammy
> >> _______________________________________________
> >> AMBER mailing list
> >> AMBER.ambermd.org
> >>
> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.ambermd.org%2Fmailman%2Flistinfo%2Famber&amp;data=04%7C01%7C%7Ca3db9972ee9c4966acc508d9dae759ff%7C17f1a87e2a254eaab9df9d439034b080%7C0%7C0%7C637781509453316189%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&amp;sdata=o3k7Hiee%2BYZzNqzGNTdf1m25ArVSsRCTXDG9VnQvBiI%3D&amp;reserved=0
> >
> >
> > _______________________________________________
> > AMBER mailing list
> > AMBER.ambermd.org
> > http://lists.ambermd.org/mailman/listinfo/amber
> >
>
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Jan 19 2022 - 13:00:02 PST
Custom Search