| 1 |
%YAML 1.2 |
| 2 |
--- |
| 3 |
# PDB syntax highlighting file |
| 4 |
# Maintainer: bioSyntax.org |
| 5 |
# Version: v0.1 |
| 6 |
name: pdb |
| 7 |
# YAML for PDB files |
| 8 |
file_extensions: [pdb] |
| 9 |
scope: source.pdb |
| 10 |
contexts: |
| 11 |
main: |
| 12 |
#Header line |
| 13 |
- match: '^HEADER.*$' |
| 14 |
scope: invalid.pdb |
| 15 |
|
| 16 |
#Title line |
| 17 |
- match: '^TITLE.*$' |
| 18 |
scope: constant.character.pdb |
| 19 |
|
| 20 |
#COMPND line |
| 21 |
- match: '^COMPND.*$' |
| 22 |
scope: markup.deleted.pdb |
| 23 |
|
| 24 |
#SOURCE line |
| 25 |
- match: '^SOURCE.*$' |
| 26 |
scope: constant.language.pdb |
| 27 |
|
| 28 |
#KEYWDS line |
| 29 |
- match: '^KEYWDS.*$' |
| 30 |
scope: entity.name.pdb |
| 31 |
|
| 32 |
#EXPDTA line |
| 33 |
- match: '^EXPDTA.*$' |
| 34 |
scope: storage.type.pdb |
| 35 |
|
| 36 |
#AUTHOR line |
| 37 |
- match: '^AUTHOR.*$' |
| 38 |
scope: string.pdb |
| 39 |
|
| 40 |
#REVDAT line |
| 41 |
- match: "^REVDAT.*$" |
| 42 |
scope: constant.character.pdb |
| 43 |
|
| 44 |
#JRNL section |
| 45 |
- match: '^JRNL.*$' |
| 46 |
push: journal |
| 47 |
|
| 48 |
#REMARK section |
| 49 |
- match: '^REMARK[\s\t]+[0-9]+' |
| 50 |
push: remark |
| 51 |
|
| 52 |
#SEQRES section |
| 53 |
- match: '^SEQRES' |
| 54 |
#scope: storage.type.pdb |
| 55 |
push: seqres |
| 56 |
|
| 57 |
#HELIX section |
| 58 |
- match: "^HELIX.*$" |
| 59 |
scope: storage.type.pdb |
| 60 |
|
| 61 |
#HELIX section |
| 62 |
- match: "^SHEET.*$" |
| 63 |
scope: entity.name.tag.pdb |
| 64 |
|
| 65 |
#SITE section |
| 66 |
- match: "^SITE.*$" |
| 67 |
scope: string.pdb |
| 68 |
|
| 69 |
#ATOM section |
| 70 |
- match: '^(ATOM|ANISOU)[\s\t]+[0-9]+[\s\t]+[A-Z0-9]+' |
| 71 |
#scope: constant.character.pdb |
| 72 |
push: atom |
| 73 |
|
| 74 |
#HETATM section |
| 75 |
- match: "^HETATM.*$" |
| 76 |
scope: markup.deleted.pdb |
| 77 |
|
| 78 |
journal: |
| 79 |
- meta_scope: string.pdb #colour everything in this section |
| 80 |
- match: '[\s\t]+TITL\b.*' |
| 81 |
scope: entity.name.pdb #colour the title of the paper |
| 82 |
- match: '(?!JRNL\b)\b.*' #when new string starts with no JRNL header, go out |
| 83 |
pop: true |
| 84 |
|
| 85 |
remark: |
| 86 |
- meta_scope: constant.character.pdb #meta.structure.dictionary.json.pdb |
| 87 |
- match: '[\s\t]+RESOLUTION.*$' #'[\s\t]+(?=RESOLUTION).*' |
| 88 |
scope: entity.name.pdb #string.unquoted.yaml.pdb |
| 89 |
- match: '.*(?=:)' |
| 90 |
push: remark_value |
| 91 |
- match: '((?!REMARK).)*$' #'(?!REMARK\b)\b.*' |
| 92 |
pop: true |
| 93 |
|
| 94 |
remark_value: |
| 95 |
- meta_scope: constant.character.pdb |
| 96 |
- match: ':[\s\t]+NULL' #':([\s\t]+NULL[\s\t]+.*)+' |
| 97 |
#scope: markup.deleted.pdb |
| 98 |
push: semicolon_NULL |
| 99 |
- match: ':' |
| 100 |
#scope: entity.name.pdb |
| 101 |
push: semicolon |
| 102 |
- match: '$' |
| 103 |
pop: true |
| 104 |
|
| 105 |
semicolon: |
| 106 |
- meta_scope: entity.name.pdb |
| 107 |
- match: '[\s\t]?;[\s\t]?' |
| 108 |
scope: constant.language.pdb |
| 109 |
- match: '$' |
| 110 |
pop: true |
| 111 |
|
| 112 |
semicolon_NULL: |
| 113 |
- meta_scope: markup.deleted.pdb |
| 114 |
- match: '[\s\t]?;[\s\t]?' |
| 115 |
scope: constant.language.pdb |
| 116 |
- match: '$' |
| 117 |
pop: true |
| 118 |
|
| 119 |
seqres: |
| 120 |
#different chanes should be coloured differently (focus on A-H) |
| 121 |
#don't care about colours for now, but they should be different |
| 122 |
- meta_scope: constant.character.pdb |
| 123 |
- match: '[\s\t]+[0-9]+[\s\t]+[AP].*' |
| 124 |
scope: ntA.pdb |
| 125 |
- match: '[\s\t]+[0-9]+[\s\t]+[BQ].*' |
| 126 |
scope: ntT.pdb |
| 127 |
- match: '[\s\t]+[0-9]+[\s\t]+[CR].*' |
| 128 |
scope: ntG.pdb |
| 129 |
- match: '[\s\t]+[0-9]+[\s\t]+[DS].*' |
| 130 |
scope: ntC.pdb |
| 131 |
- match: '[\s\t]+[0-9]+[\s\t]+[ET].*' |
| 132 |
scope: ntU.pdb |
| 133 |
- match: '[\s\t]+[0-9]+[\s\t]+[FU].*' |
| 134 |
scope: ntR.pdb |
| 135 |
- match: '[\s\t]+[0-9]+[\s\t]+[GV].*' |
| 136 |
scope: ntY.pdb |
| 137 |
- match: '[\s\t]+[0-9]+[\s\t]+[HW].*' |
| 138 |
scope: ntS.pdb |
| 139 |
- match: '[\s\t]+[0-9]+[\s\t]+[IX].*' |
| 140 |
scope: ntW.pdb |
| 141 |
- match: '[\s\t]+[0-9]+[\s\t]+[JY].*' |
| 142 |
scope: ntM.pdb |
| 143 |
- match: '[\s\t]+[0-9]+[\s\t]+[KZ].*' |
| 144 |
scope: ntK.pdb |
| 145 |
- match: '[\s\t]+[0-9]+[\s\t]+[L].*' |
| 146 |
scope: ntD.pdb |
| 147 |
- match: '[\s\t]+[0-9]+[\s\t]+[M].*' |
| 148 |
scope: ntB.pdb |
| 149 |
- match: '[\s\t]+[0-9]+[\s\t]+[N].*' |
| 150 |
scope: ntV.pdb |
| 151 |
- match: '[\s\t]+[0-9]+[\s\t]+[O].*' |
| 152 |
scope: ntH.pdb |
| 153 |
- match: '$' |
| 154 |
pop: true |
| 155 |
|
| 156 |
atom: |
| 157 |
- meta_scope: constant.character.pdb |
| 158 |
#residue number |
| 159 |
- match: '(?<=[A-Z])[\s\t]+[0-9]+' |
| 160 |
scope: storage.type.pdb |
| 161 |
#amino acids |
| 162 |
- match: '[\s\t]+ALA' |
| 163 |
scope: aaA |
| 164 |
- match: '[\s\t]+ARG' |
| 165 |
scope: aaR |
| 166 |
- match: '[\s\t]+ASN' |
| 167 |
scope: aaN |
| 168 |
- match: '[\s\t]+ASP' |
| 169 |
scope: aaD |
| 170 |
- match: '[\s\t]+CYS' |
| 171 |
scope: aaC |
| 172 |
- match: '[\s\t]+GLN' |
| 173 |
scope: aaQ |
| 174 |
- match: '[\s\t]+GLU' |
| 175 |
scope: aaE |
| 176 |
- match: '[\s\t]+GLY' |
| 177 |
scope: aaG |
| 178 |
- match: '[\s\t]+HIS' |
| 179 |
scope: aaH |
| 180 |
- match: '[\s\t]+ILE' |
| 181 |
scope: aaI |
| 182 |
- match: '[\s\t]+LEU' |
| 183 |
scope: aaL |
| 184 |
- match: '[\s\t]+LYS' |
| 185 |
scope: aaK |
| 186 |
- match: '[\s\t]+MET' |
| 187 |
scope: aaM |
| 188 |
- match: '[\s\t]+PHE' |
| 189 |
scope: aaF |
| 190 |
- match: '[\s\t]+PRO' |
| 191 |
scope: aaP |
| 192 |
- match: '[\s\t]+SER' |
| 193 |
scope: aaS |
| 194 |
- match: '[\s\t]+THR' |
| 195 |
scope: aaT |
| 196 |
- match: '[\s\t]+TRP' |
| 197 |
scope: aaW |
| 198 |
- match: '[\s\t]+TYR' |
| 199 |
scope: aaY |
| 200 |
- match: '[\s\t]+VAL' |
| 201 |
scope: aaV |
| 202 |
#define chains (different colours for different chains from A-H) |
| 203 |
- match: '(?<=[\s\t])[AP](?=[\s\t]+[0-9])' |
| 204 |
scope: ntA.pdb |
| 205 |
- match: '(?<=[\s\t])[BQ](?=[\s\t]+[0-9])' |
| 206 |
scope: ntT.pdb |
| 207 |
- match: '(?<=[\s\t])[CR](?=[\s\t]+[0-9])' |
| 208 |
scope: ntG.pdb |
| 209 |
- match: '(?<=[\s\t])[DS](?=[\s\t]+[0-9])' |
| 210 |
scope: ntC.pdb |
| 211 |
- match: '(?<=[\s\t])[ET](?=[\s\t]+[0-9])' |
| 212 |
scope: ntU.pdb |
| 213 |
- match: '(?<=[\s\t])[FU](?=[\s\t]+[0-9])' |
| 214 |
scope: ntR.pdb |
| 215 |
- match: '(?<=[\s\t])[GV](?=[\s\t]+[0-9])' |
| 216 |
scope: ntY.pdb |
| 217 |
- match: '(?<=[\s\t])[HW](?=[\s\t]+[0-9])' |
| 218 |
scope: ntS.pdb |
| 219 |
- match: '(?<=[\s\t])[IX](?=[\s\t]+[0-9])' |
| 220 |
scope: ntW.pdb |
| 221 |
- match: '(?<=[\s\t])[JY](?=[\s\t]+[0-9])' |
| 222 |
scope: ntM.pdb |
| 223 |
- match: '(?<=[\s\t])[KZ](?=[\s\t]+[0-9])' |
| 224 |
scope: ntK.pdb |
| 225 |
- match: '(?<=[\s\t])L(?=[\s\t]+[0-9])' |
| 226 |
scope: ntD.pdb |
| 227 |
- match: '(?<=[\s\t])M(?=[\s\t]+[0-9])' |
| 228 |
scope: ntB.pdb |
| 229 |
- match: '(?<=[\s\t])N(?=[\s\t]+[0-9])' |
| 230 |
scope: ntV.pdb |
| 231 |
- match: '(?<=[\s\t])O(?=[\s\t]+[0-9])' |
| 232 |
scope: ntH.pdb |
| 233 |
- match: '$' |
| 234 |
pop: true |
| 235 |
|
| 236 |
|
| 237 |
#aa_chain_resnumber: |
| 238 |
#- meta_scope: string.pdb |
| 239 |
#- match: '[A-Z]{3}' |
| 240 |
#scope: storage.type.pdb' |
| 241 |
#- match: '[\s\t]+' |
| 242 |
#pop: true |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|