| 1 |
%YAML 1.2 |
| 2 |
--- |
| 3 |
# VCF syntax highlighting file |
| 4 |
# Maintainer: bioSyntax.org |
| 5 |
# Version: v0.1 |
| 6 |
name: vcf |
| 7 |
file_extensions: [vcf] |
| 8 |
scope: source.vcf |
| 9 |
|
| 10 |
variables: |
| 11 |
ident: '\w+' |
| 12 |
|
| 13 |
contexts: |
| 14 |
main: |
| 15 |
# Comments begin with a '##' and finish at the end of the line |
| 16 |
#- match: '\#\#' |
| 17 |
#scope: comment |
| 18 |
#push: line_comment |
| 19 |
- match: '^##' |
| 20 |
push: header |
| 21 |
|
| 22 |
# Header for the 8 columns begins with a '#' and finishes at the end of the line |
| 23 |
- match: '(\#CHROM)(\s+\w*)+$' |
| 24 |
scope: entity.name |
| 25 |
|
| 26 |
|
| 27 |
#- match: "\t" |
| 28 |
#scope: invalid |
| 29 |
|
| 30 |
# - match: '(?<=\s).+?(?==)' |
| 31 |
# scope: ntC |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
# Numbers |
| 36 |
# - match: \b(-)?[0-9.]+\b |
| 37 |
# - match: \b/(?:\D+\s+){1}(\D+)/\b |
| 38 |
# scope: invalid |
| 39 |
|
| 40 |
# CHROM |
| 41 |
- match: '^[\w]+' |
| 42 |
scope: chr.vcf |
| 43 |
|
| 44 |
# POS |
| 45 |
- match: '(?<=\s)(-)?[0-9.]+(?=\s)' |
| 46 |
scope: chrStart.vcf |
| 47 |
|
| 48 |
#TEST |
| 49 |
#- match: (?<=[\s\t])[A-Z](?={{ident}}) |
| 50 |
#scope: invalid.vcf |
| 51 |
#push: nt |
| 52 |
|
| 53 |
#ref and alt |
| 54 |
- match: '(?<=[\s\t])A(?=[A-Z,]+[\s\t])' |
| 55 |
scope: ntA |
| 56 |
push: nt |
| 57 |
|
| 58 |
- match: '(?<=[\s\t])C(?=[A-Z,]+[\s\t])' |
| 59 |
scope: ntC |
| 60 |
push: nt |
| 61 |
|
| 62 |
- match: '(?<=[\s\t])G(?=[A-Z,]+[\s\t])' |
| 63 |
scope: ntG |
| 64 |
push: nt |
| 65 |
|
| 66 |
- match: '(?<=[\s\t])(T|U)(?=[A-Z,]+[\s\t])' |
| 67 |
scope: ntT |
| 68 |
push: nt |
| 69 |
|
| 70 |
- match: '(?<=[\s\t])A(?=[\s\t])' |
| 71 |
scope: ntA |
| 72 |
- match: '(?<=[\s\t])G(?=[\s\t])' |
| 73 |
scope: ntG |
| 74 |
- match: '(?<=[\s\t])C(?=[\s\t])' |
| 75 |
scope: ntC |
| 76 |
- match: '(?<=[\s\t])(U|T)(?=[\s\t])' |
| 77 |
scope: ntT |
| 78 |
|
| 79 |
- match: '(?<=[\s\t;])[A-Za-z0-9]+=' |
| 80 |
push: tags |
| 81 |
|
| 82 |
#info |
| 83 |
# - match: . |
| 84 |
# scope: invalid |
| 85 |
#push: info |
| 86 |
|
| 87 |
# # Nucleotides |
| 88 |
# # A |
| 89 |
# - match: (?<=\s)[A](?=\s) |
| 90 |
# scope: ntA |
| 91 |
|
| 92 |
# # T |
| 93 |
# - match: (?<=\s)[T](?=\s) |
| 94 |
# scope: ntT |
| 95 |
|
| 96 |
# # G |
| 97 |
# - match: (?<=\s)[G](?=\s) |
| 98 |
# scope: ntG |
| 99 |
|
| 100 |
# # C |
| 101 |
# - match: (?<=\s)[C](?=\s) |
| 102 |
# scope: ntC |
| 103 |
|
| 104 |
# # U |
| 105 |
# - match: (?<=\s)[U](?=\s) |
| 106 |
# scope: ntT |
| 107 |
|
| 108 |
# # ACGTU |
| 109 |
# - match: "[AGCTU\\,]++" |
| 110 |
# push: nt |
| 111 |
|
| 112 |
|
| 113 |
# CHROM ID |
| 114 |
|
| 115 |
|
| 116 |
# ID |
| 117 |
# - match: (?<=\s)[0-9]*(?=\s) |
| 118 |
# scope: invalid |
| 119 |
# push: ID |
| 120 |
|
| 121 |
# REF |
| 122 |
#- match: |
| 123 |
# scope: |
| 124 |
|
| 125 |
# ALT |
| 126 |
#- match: |
| 127 |
# scope: |
| 128 |
|
| 129 |
# QUAL |
| 130 |
#- match: |
| 131 |
# scope: |
| 132 |
|
| 133 |
# FILTER |
| 134 |
#- match: |
| 135 |
# scope: |
| 136 |
|
| 137 |
# INFO |
| 138 |
# - match: '[\s][\S]+$' |
| 139 |
# scope: entity.name |
| 140 |
|
| 141 |
tags: |
| 142 |
- meta_scope: string.vcf |
| 143 |
- match: (?<=)[A-Za-z0-9\-\.,]+(?=[;\t\s]) |
| 144 |
scope: storage.type.vcf |
| 145 |
- match: '[\t\s;]' |
| 146 |
pop: true |
| 147 |
|
| 148 |
double_quoted_string: |
| 149 |
- meta_scope: string.quoted.double.example-c |
| 150 |
- match: '\\.' |
| 151 |
scope: constant.character.escape.example-c |
| 152 |
- match: '"' |
| 153 |
scope: punctuation.definition.string.end.example-c |
| 154 |
pop: true |
| 155 |
|
| 156 |
#line_comment: |
| 157 |
#- meta_scope: comment.line.example-c |
| 158 |
#- match: "<.*>" |
| 159 |
#scope: ntG |
| 160 |
#- match: $ |
| 161 |
#pop: true |
| 162 |
|
| 163 |
ID: |
| 164 |
- match: \b[0-9]\b |
| 165 |
scope: invalid |
| 166 |
pop: true |
| 167 |
|
| 168 |
nt: |
| 169 |
- meta_content_scope: string.vcf |
| 170 |
- match: 'A' |
| 171 |
scope: ntA |
| 172 |
- match: 'G' |
| 173 |
scope: ntG |
| 174 |
- match: 'C' |
| 175 |
scope: ntC |
| 176 |
- match: '(U|T)' |
| 177 |
scope: ntT |
| 178 |
- match: '[\s\t]' |
| 179 |
#scope: constant.character |
| 180 |
pop: true |
| 181 |
|
| 182 |
info: |
| 183 |
- match: \s.\; |
| 184 |
scope: invalid |
| 185 |
pop: true |
| 186 |
|
| 187 |
header: |
| 188 |
- meta_scope: comment.vcf |
| 189 |
- match: 'INFO=<' |
| 190 |
push: header_info |
| 191 |
- match: 'FILTER=<' |
| 192 |
push: header_filter |
| 193 |
- match: 'FORMAT=<' |
| 194 |
push: header_format |
| 195 |
- match: 'ALT=<' |
| 196 |
push: header_alt |
| 197 |
- match: 'assembly=.*$' |
| 198 |
scope: string.vcf |
| 199 |
- match: 'contig=<' |
| 200 |
push: header_contig |
| 201 |
- match: 'SAMPLE=<' |
| 202 |
push: header_sample |
| 203 |
- match: 'PEDIGREE=.*$' |
| 204 |
scope: aaY |
| 205 |
- match: 'pedigreeDB=.*$' |
| 206 |
scope: aaY |
| 207 |
- match: 'reference=.*$' |
| 208 |
scope: string.vcf |
| 209 |
- match: '(?<=fileformat=)[A-Za-z0-9\.]+' |
| 210 |
scope: numeric.vcf |
| 211 |
- match: '(?<=##)[A-Za-z]+=' |
| 212 |
scope: string.vcf |
| 213 |
- match: '(?<==)[A-Za-z0-9\-\.]+' |
| 214 |
scope: storage.type.vcf |
| 215 |
- match: '$' |
| 216 |
pop: true |
| 217 |
|
| 218 |
header_info: |
| 219 |
- meta_scope: entity.name.vcf |
| 220 |
#ID section |
| 221 |
- match: '(?<=ID=).*?(?=,)' |
| 222 |
scope: markup.deleted.vcf |
| 223 |
#different types - different colours |
| 224 |
- match: '(?<=Type=)Integer' |
| 225 |
scope: constant.numeric.vcf |
| 226 |
- match: '(?<=Type=)Float' |
| 227 |
scope: markup.deleted.vcf |
| 228 |
- match: '(?<=Type=)Flag' |
| 229 |
scope: storage.type.vcf |
| 230 |
- match: '(?<=Type=)Character' |
| 231 |
scope: chr.vcf |
| 232 |
- match: '(?<=Type=)String' |
| 233 |
scope: name.id.vcf |
| 234 |
#description |
| 235 |
- match: '(?<=Description=)".*"' |
| 236 |
scope: chrStart.vcf |
| 237 |
- match: '(?<=Description=).*?(?=[,>])' |
| 238 |
scope: markup.deleted.vcf |
| 239 |
- match: '$' |
| 240 |
pop: true |
| 241 |
|
| 242 |
header_filter: |
| 243 |
- meta_scope: aaC.vcf |
| 244 |
#ID section |
| 245 |
- match: '(?<=ID=).*?(?=,)' |
| 246 |
scope: markup.deleted.vcf |
| 247 |
#description |
| 248 |
- match: '(?<=Description=)".*"' |
| 249 |
scope: chrStart.vcf |
| 250 |
- match: '(?<=Description=).*?(?=[,>])' |
| 251 |
scope: markup.deleted.vcf |
| 252 |
- match: '$' |
| 253 |
pop: true |
| 254 |
|
| 255 |
header_format: |
| 256 |
- meta_scope: aaG |
| 257 |
- match: '(?<=ID=).*?(?=,)' |
| 258 |
scope: markup.deleted.vcf |
| 259 |
#different types - different colours |
| 260 |
- match: '(?<=Type=)Integer' |
| 261 |
scope: constant.numeric.vcf |
| 262 |
- match: '(?<=Type=)Float' |
| 263 |
scope: markup.deleted.vcf |
| 264 |
- match: '(?<=Type=)Character' |
| 265 |
scope: chr.vcf |
| 266 |
- match: '(?<=Type=)String' |
| 267 |
scope: name.id.vcf |
| 268 |
#description |
| 269 |
- match: '(?<=Description=)".*"' |
| 270 |
scope: chrStart.vcf |
| 271 |
- match: '(?<=Description=).*?(?=[,>])' |
| 272 |
scope: markup.deleted.vcf |
| 273 |
- match: '$' |
| 274 |
pop: true |
| 275 |
|
| 276 |
header_alt: |
| 277 |
- meta_scope: aaI.vcf |
| 278 |
#ID section |
| 279 |
- match: '(?<=ID=).*?(?=,)' |
| 280 |
scope: markup.deleted.vcf |
| 281 |
#description |
| 282 |
- match: '(?<=Description=)".*"' |
| 283 |
scope: chrStart.vcf |
| 284 |
- match: '(?<=Description=).*?(?=[,>])' |
| 285 |
scope: markup.deleted.vcf |
| 286 |
- match: '$' |
| 287 |
pop: true |
| 288 |
|
| 289 |
header_contig: |
| 290 |
- meta_scope: aaH.vcf |
| 291 |
#ID section |
| 292 |
- match: '(?<=ID=).*?(?=,)' |
| 293 |
scope: markup.deleted.vcf |
| 294 |
#description |
| 295 |
- match: '(?<=URL=).*?(?=[\,>])' |
| 296 |
scope: aaL.vcf |
| 297 |
- match: '$' |
| 298 |
pop: true |
| 299 |
|
| 300 |
header_sample: |
| 301 |
- meta_scope: aaM.vcf |
| 302 |
#ID section |
| 303 |
- match: '(?<=ID=).*?(?=,)' |
| 304 |
scope: markup.deleted.vcf |
| 305 |
#description |
| 306 |
- match: '(?<=Description=).*?(?=[,>])' |
| 307 |
scope: markup.deleted.vcf |
| 308 |
- match: '(?<=Description=).*?(?=[,>])' |
| 309 |
scope: markup.deleted.vcf |
| 310 |
- match: '$' |
| 311 |
pop: true |