# programmatically select and label peptides within pdb file

I have a pdb file of a protein structure, and I would like to programmatically select certain peptides and label them in an annotated pdb file output, so that when the output pdb file is opened again by one of the 3D viewers, one can highlight the annotated peptides.

I can do this interactively using UCSF Chimera or https://www.rcsb.org/3d-view,

and with Chimera, I can even save a session which is a python file that contains the lines of my manual annotations as lists of coordinates.

whereas in RCSB, saving a session produces a molx compressed file that includes hashes such as this one, where myseq is defined by a range within the file:

              {
"transformer": "ms-plugin.structure-component",
"params": {
"type": {
"name": "bundle",
"params": {
"hash": 1673297064,
"elements": [
{
"groupedUnits": [
[
0
]
],
"set": [],
"ranges": [
1669,
1777
]
}
]
}
},
"nullIfEmpty": true,
"label": "myseq2"
},


So I want to do the same programmatically, e.g.:

annotate_sequences --input file.pdb --sequences 1:ARNDC,2:CDNRA,foo:VYWTSP


I expect an output file where these three peptides are annotated with the labels 1, 2, and foo, so when someone opens the file in a 3D structure viewer, then can select/deselect the annotations.

Any ideas on how to do this?

• Do you mean something specific by annotated pdb file? Regular pdb files don't have place for annotations of chains (peptides). Jul 23 at 13:11
• Not as REMARK? Is there another format for this? Jul 23 at 13:22

There is no consensus on how different programs do representations (example of NGL vs. PyMOL) or what they are called so there is not official way to store selections.

Annotations can be REMARK lines, which have a specific format or simply lines after a hash at the bottom of the file get ignored by most viewers but that specific program may read. Here is a scored Rosetta PDB file for example:

HEADER                                            14-JUN-21   XXXX
EXPDTA    THEORETICAL MODEL
REMARK 220
REMARK 220 EXPERIMENTAL DETAILS
REMARK 220  EXPERIMENT TYPE                : THEORETICAL MODELLING
REMARK 220  DATE OF DATA COLLECTION        : 14-JUN-21
REMARK 220
REMARK 220 REMARK: MODEL GENERATED BY ROSETTA
REMARK 220  VERSION 2020.49+release.fac69dd
ATOM      1  N   MET A   1     107.793 134.398   6.022  1.00  0.00           N
ATOM      2  CA  MET A   1     108.468 134.162   7.299  1.00  0.00           C
ATOM      3  C   MET A   1     108.644 135.405   8.219  1.00  0.00           C
ATOM      4  O   MET A   1     108.050 135.416   9.303  1.00  0.00           O
ATOM      5  CB  MET A   1     109.782 133.398   7.080  1.00  0.00           C
ATOM      6  CG  MET A   1     110.650 133.262   8.335  1.00  0.00           C
ATOM      7  SD  MET A   1     112.224 132.454   8.016  1.00  0.00           S
...
# All scores below are weighted scores, not raw scores.
#BEGIN_POSE_ENERGIES_TABLE
label fa_atr fa_rep fa_sol fa_intra_rep fa_intra_sol_xover4 lk_ball_wtd fa_elec pro_close hbond_sr_bb hbond_lr_bb hbond_bb_sc hbond_sc dslf_fa13 omega fa_dun p_aa_pp yhh_planarity ref rama_prepro total
weights 1 0.55 1 0.005 1 1 1 1.25 1 1 1 1 1.25 0.4 0.7 0.6 0.625 1 0.45 NA
pose -17624.7 2135.24 10828.2 38.8161 591.762 -521.596 -5634.4 9.63107 -1337.76 -585.258 -616.219 -453.443 0 197.59 3291.97 -602.3 2.74143 1088.19 99.1601 -9092.4
MET:NtermProteinFull_1 -2.63316 0.99093 2.70981 0.01206 0.04738 -0.17936 0.08728 0.00151 0 0 0 0 0 0.35192 1.9909 0 0 1.65735 0 5.0366



### Hacked b-factors

Another way is to store numerical data as b-factors. The AlphaFold2 data for example stores pLDDT in the b-factor column, while consurf stores conservation score there. So a boolean 1=show, 0=hide could be done for example, which would allow one to select these, e.g. in PyMOL:

# store chosen selection...
alter chosen, "b=1"
sort
save foo.pdb

select chosen, b<0


Although this makes no sense as one can save a session file... Also note, that for multiple selections, you'd need create different models, but whatever happens the other non-coordinate column, occupancy, should not be touched.

### Sharing

If the problem is that you want to share a protein with someone and want to let the recipient know about features of interest but are using different software than you, you may want to consider Michelanglo, a website I wrote that allows one to share a webpage with an interactive protein viewer (using NGL.js, hence the name) and a side description with custom annotations that control the protein representation (example).

• How would one annotate the certain peptides within the sequence the PDB corresponds to? E.g. starting with the full sequence + PDB structure, how do we end up with an annotated structure for peptides within, that is then shared via Michelanglo? Jul 25 at 10:42
• The hacky B-factor annotations I mentioned have nothing to do with Michelanglo, which has a GUI to add protein-controlling links in the description of a page a registered user has created by uploading a regular structure or gene name —i.e. after upload. Jul 25 at 16:06