Debian Codegraph @

sublime/sam.sublime-syntax

raw
1 %YAML 1.2
2 ---
3 # SAM syntax highlighting file
4 # Maintainer: bioSyntax.org
5 # Version: v0.1
6 # See http://www.sublimetext.com/docs/3/syntax.html
7 name: sam
8 file_extensions:
9 - sam
10 scope: source.sam
11 contexts:
12 main:
13 - match: '^@HD'
14 scope: header.sam
15 push: header_entry_hd
16
17 - match: '^@SQ'
18 scope: header.sam
19 push: header_entry_sq
20
21 - match: '^@RG'
22 scope: header.sam
23 push: header_entry_rg
24
25 - match: '^@PG'
26 scope: header.sam
27 push: header_entry_pg
28
29 - match: '^@CO'
30 scope: header.sam
31 push: header_entry_co
32
33 # entering sequence alignment section
34 # column 1 of sequence alignment: QNAME
35 - match: '^[\S]*\t'
36 scope: keyword.sam
37 push: flag_column
38
39
40 # header entries
41
42 header_entry_hd:
43 - meta_scope: string.sam
44 - match: '(?<=[A-Z]{2}:)"'
45 scope: invalid.sam
46 push: header_entry_quote
47 - match: '(?<=VN:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
48 scope: numeric.sam
49
50 # Sort Order for sam file
51 # Distinguishes sorted from unsorted files
52 - match: '(?<=SO:)(coordinate|queryname(?=\s+[A-Z]{2}:)|.+$)'
53 scope: bon.sam
54 - match: '(?<=SO:)(unsorted|unknown(?=\s+[A-Z]{2}:)|.+$)'
55 scope: mal.sam
56 - match: '(?<=SO:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
57 scope: keyword.sam
58
59 - match: '(?<=GO:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
60 scope: keyword.sam
61 - match: '$'
62 pop: true
63
64 header_entry_sq:
65 - meta_scope: string.sam
66 - match: '(?<=[A-Z]{2}:)"'
67 scope: invalid.sam
68 push: header_entry_quote
69 - match: '(?<=SN:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
70 scope: chr.sam
71 - match: '(?<=LN:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
72 scope: chrStart.sam
73 - match: '(?<=AH:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
74 scope: keyword.sam
75 - match: '(?<=AN:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
76 scope: keyword.sam
77 - match: '(?<=AS:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
78 scope: keyword.sam
79 - match: '(?<=M5:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
80 scope: keyword.sam
81 - match: '(?<=SP:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
82 scope: keyword.sam
83 - match: '(?<=UR:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
84 scope: keyword.sam
85 - match: $
86 pop: true
87
88 header_entry_rg:
89 - meta_scope: string.sam
90 - match: '(?<=[A-Z]{2}:)"'
91 scope: invalid.sam
92 push: header_entry_quote
93 - match: '(?<=ID:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
94 scope: library.sam
95 - match: '(?<=LB:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
96 scope: library.sam
97 - match: '(?<=CN:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
98 scope: keyword.sam
99 - match: '(?<=DS:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
100 scope: keyword.sam
101 - match: '(?<=DT:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
102 scope: keyword.sam
103 - match: '(?<=FO:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
104 scope: keyword.sam
105 - match: '(?<=KS:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
106 scope: keyword.sam
107 - match: '(?<=PG:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
108 scope: platform.sam
109 - match: '(?<=PI:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
110 scope: keyword.sam
111 - match: '(?<=PL:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
112 scope: platform.sam
113 - match: '(?<=PM:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
114 scope: keyword.sam
115 - match: '(?<=PU:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
116 scope: platform.sam
117 - match: '(?<=SM:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
118 scope: library.sam
119 - match: $
120 pop: true
121
122 header_entry_pg:
123 - meta_scope: string.sam
124 - match: '(?<=[A-Z]{2}:)"'
125 scope: variable.parameter.sam
126 push: header_entry_quote
127 - match: '(?<=ID:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
128 scope: software.sam
129 - match: '(?<=PN:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
130 scope: software.sam
131 - match: '(?<=CL:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
132 scope: command.sam
133 - match: '(?<=PP:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
134 scope: software.sam
135 - match: '(?<=DS:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
136 scope: string.sam
137 - match: '(?<=VN:)(.+?(?=\s+[A-Z]{2}:)|.+$)'
138 scope: numeric.sam
139 - match: $
140 pop: true
141
142 header_entry_co:
143 - meta_scope: string.sam
144 - match: '(?<=[A-Z]{2}:)"'
145 scope: comment.am
146 push: header_entry_quote
147 - match: $
148 pop: true
149
150 header_entry_quote:
151 - meta_scope: variable.parameter.sam
152 - match: '"'
153 pop: true
154
155
156 # sequence alignment columns
157
158 # column 2: FLAG
159 flag_column:
160 # Read Flag
161 # If flag > 512
162 # read is QC-fail | PCRdup | 2' alignment
163 - match: '[0-9]{1,2}(?=\t)'
164 scope: numeric.sam
165 - match: '[1-4][0-9]{1,2}(?=\t)'
166 scope: numeric.sam
167 - match: '[5][0][0-9](?=\t)'
168 scope: numeric.sam
169 - match: '[5][1][01](?=\t)'
170 scope: numeric.sam
171
172 - match: '[5][1][01]'
173 scope: ntC.sam
174 - match: '[\S]*'
175 scope: ntC.sam
176
177 - match: \t
178 push: rname_column
179 - match: $
180 pop: true
181
182 # column 3: RNAME: usually a chromosome id
183 rname_column:
184 - match: '[\S]*'
185 scope: chr.sam
186 - match: \t
187 push: pos_column
188 - match: $
189 pop: true
190
191 # column 4: POS: 1-based leftmost mapping POSition of the first CIGAR operation that “consumes” a reference base
192 pos_column:
193 - match: '[\S]*'
194 scope: chrStart.sam
195 - match: \t
196 push: mapq_column
197 - match: $
198 pop: true
199
200 # column 5: MAPQ: MAPping Quality.
201 mapq_column:
202 - match: '(255|[0-9])(?=\t)'
203 scope: gradbw1
204 - match: '1[0-9](?=\t)'
205 scope: gradbw3
206 - match: '2[0-9](?=\t)'
207 scope: gradbw5
208 - match: '3[0-9](?=\t)'
209 scope: gradbw7
210 - match: '4[0-9](?=\t)'
211 scope: gradbw9
212 - match: '[\S]*'
213 scope: gradbw9
214
215 - match: \t
216 push: cigar_column
217 - match: $
218 pop: true
219
220
221 # column 6: CIGAR: Alignment details
222 cigar_column:
223 # CIGAR Strings
224 # M: Alignment match
225 # I: Insertion
226 # D: Deletion
227 # N: Skipped region (intron)
228 # S: Soft Clip
229 # H: Hard Clip
230 # P: Padding
231 # =: Sequence Match
232 # X: Sequence Mismatch
233 # *: String Absent
234
235 - match: '\d+[NSHP]'
236 scope: cigClip.sam
237 - match: '\d+[M=]'
238 scope: cigMat.sam
239 - match: '\d+[X]'
240 scope: cigMis.sam
241 - match: '\d+[D]'
242 scope: cigDel.sam
243 - match: '\d+[I]'
244 scope: cigIns.sam
245 - match: '[\S]*'
246 scope: comment.sam
247 - match: \t
248 push: rnext_column
249 - match: $
250 pop: true
251
252 # column 7: RNEXT Reference sequence name of the primary alignment of the NEXT read in the template.
253 rnext_column:
254 - match: "="
255 scope: chr.sam
256 push: pnext_column_gateway
257 - match: "[0-9]*(?=\t)"
258 scope: chrStart.sam
259 push: pnext_column_gateway
260 - match: "\\*"
261 scope: keyword.sam
262 push: pnext_alt_seq_column_gateway
263 - match: '[\S]*(?=\t)'
264 scope: keyword.Start
265 push: pnext_alt_seq_column_gateway
266 - match: $
267 pop: true
268
269 # column 8: PNEXT: Position of the primary alignment of the NEXT read in the template.
270
271 pnext_column_gateway:
272 - match: \t
273 push: pnext_column
274 - match: $
275 pop: true
276
277 pnext_column:
278 # - meta_scope: invalid.sam
279 - match: '[\S]*'
280 scope: chrStart.sam
281 - match: \t
282 push: tlen_column
283 - match: $
284 pop: true
285
286 pnext_alt_seq_column_gateway:
287 - match: \t
288 push: pnext_alt_seq_column
289 - match: $
290 pop: true
291
292 pnext_alt_seq_column:
293 # - meta_scope: invalid.sam
294 - match: '[\S]*'
295 scope: keyword.Start
296 - match: \t
297 push: tlen_column
298 - match: $
299 pop: true
300
301 # column 9: TLEN: signed observed Template LENgth.
302 tlen_column:
303 - match: '[\S]*'
304 scope: comment.sam
305 - match: \t
306 push: seq_column
307 - match: $
308 pop: true
309
310 # column 10: SEQ: segment SEQuence.
311 seq_column:
312 - match: "A"
313 scope: ntA.sam
314 - match: "C"
315 scope: ntC.sam
316 - match: "G"
317 scope: ntG.sam
318 - match: "T"
319 scope: ntT.sam
320 - match: "N"
321 scope: ntN.sam
322 - match: \t
323 push: qual_column
324 - match: $
325 pop: true
326
327 # column 11: QUAL: ASCII of base QUALity plus 33 (same as the
328 # quality string in the Sanger FASTQ format).
329 # Complete Phred Scale
330 #!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
331
332 # Illumina 1.8 Scale (IMPLEMENTED)
333 # 0.2.......................26...31.......41
334 # !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKL
335 # | | | | | | | | | | | ...
336
337 qual_column:
338 - match: "[\\!\\#\\$]"
339 scope: gradbw0
340 - match: "[%\\&\\'\\(]"
341 scope: gradbw1
342 - match: "[\\)\\*\\+\\,]"
343 scope: gradbw2
344 - match: "[\\-\\.\\/0]"
345 scope: gradbw3
346 - match: "[1-4]"
347 scope: gradbw4
348 - match: "[5-8]"
349 scope: gradbw5
350 - match: "[9\\:\\;\\<]"
351 scope: gradbw6
352 - match: "[\\=\\>\\?\\@]"
353 scope: gradbw7
354 - match: "[ABCD]"
355 scope: gradbw8
356 - match: "[EFGHIJ]"
357 scope: gradbw9
358 - match: "[K-Z\\[\\\\]"
359 scope: gradbw10
360 - match: "[\\]\\^\\_\\`a-f]"
361 scope: gradbw10
362 - match: "[g-p]"
363 scope: gradbw10
364 - match: "[q-z]"
365 scope: gradbw10
366 - match: "[\\{\\|\\}\\~]"
367 scope: gradbw10
368 - match: \t
369 push: data_tag_entry
370 - match: $
371 pop: true
372
373 data_tag_entry:
374 - meta_scope: string.sam
375 # Data Classes: numeric / string / class
376 # A Printable
377 # i signed integer
378 # f floating point
379 # Z string with spaces
380 # H byte array hex
381 # B Integer/Numeric Array
382 - match: "[A-Z]{2}(?=:)"
383 scope: string.sam
384 - match: "(?<=:)[AifZHB]:"
385 scope: comment.sam
386
387 - match: "(?<=[ifH]:)(.+?(?=\t)|.+$)"
388 scope: numeric.sam
389 - match: "(?<=[AZB]:)(.+?(?=\t)|.+$)"
390 scope: numeric2.sam
391
392 - match: "$"
393 pop: true