Deleted Added
full compact
bioinformatics (302408) bioinformatics (309847)
1
2#------------------------------------------------------------------------------
1
2#------------------------------------------------------------------------------
3# $File: bioinformatics,v 1.2 2016/02/14 15:53:53 christos Exp $
3# $File: bioinformatics,v 1.4 2016/06/20 16:13:46 christos Exp $
4# bioinfomatics: file(1) magic for Bioinfomatics file formats
5
6###############################################################################
7# BGZF (Blocked GNU Zip Format) - gzip compatible, but also indexable
8# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml)
9###############################################################################
100 string \037\213
11>3 byte &0x04
12>>12 string BC
13>>>14 leshort &0x02 Blocked GNU Zip Format (BGZF; gzip compatible)
14>>>>16 leshort x \b, block length %d
15!:mime application/x-gzip
16
17
18###############################################################################
4# bioinfomatics: file(1) magic for Bioinfomatics file formats
5
6###############################################################################
7# BGZF (Blocked GNU Zip Format) - gzip compatible, but also indexable
8# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml)
9###############################################################################
100 string \037\213
11>3 byte &0x04
12>>12 string BC
13>>>14 leshort &0x02 Blocked GNU Zip Format (BGZF; gzip compatible)
14>>>>16 leshort x \b, block length %d
15!:mime application/x-gzip
16
17
18###############################################################################
19# Tabix index file
19# Tabix index file
20# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml)
21###############################################################################
220 string TBI\1 SAMtools TBI (Tabix index format)
23>0x04 lelong =1 \b, with %d reference sequence
24>0x04 lelong >1 \b, with %d reference sequences
25>0x08 lelong &0x10000 \b, using half-closed-half-open coordinates (BED style)
20# used by SAMtools bgzip/tabix (http://samtools.sourceforge.net/tabix.shtml)
21###############################################################################
220 string TBI\1 SAMtools TBI (Tabix index format)
23>0x04 lelong =1 \b, with %d reference sequence
24>0x04 lelong >1 \b, with %d reference sequences
25>0x08 lelong &0x10000 \b, using half-closed-half-open coordinates (BED style)
26>0x08 lelong ^0x10000
26>0x08 lelong ^0x10000
27>>0x08 lelong =0 \b, using closed and one based coordinates (GFF style)
28>>0x08 lelong =1 \b, using SAM format
29>>0x08 lelong =2 \b, using VCF format
30>0x0c lelong x \b, sequence name column: %d
31>0x10 lelong x \b, region start column: %d
27>>0x08 lelong =0 \b, using closed and one based coordinates (GFF style)
28>>0x08 lelong =1 \b, using SAM format
29>>0x08 lelong =2 \b, using VCF format
30>0x0c lelong x \b, sequence name column: %d
31>0x10 lelong x \b, region start column: %d
32>0x08 lelong =0
32>0x08 lelong =0
33>>0x14 lelong x \b, region end column: %d
34>0x18 byte x \b, comment character: %c
35>0x1c lelong x \b, skip line count: %d
36
37
38###############################################################################
33>>0x14 lelong x \b, region end column: %d
34>0x18 byte x \b, comment character: %c
35>0x1c lelong x \b, skip line count: %d
36
37
38###############################################################################
39# BAM (Binary Sequence Alignment/Map format)
40# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
39# BAM (Binary Sequence Alignment/Map format)
40# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
41# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
42###############################################################################
430 string BAM\1 SAMtools BAM (Binary Sequence Alignment/Map)
41# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
42###############################################################################
430 string BAM\1 SAMtools BAM (Binary Sequence Alignment/Map)
44>0x04 lelong >0
44>0x04 lelong >0
45>>&0x00 regex =^[@]HD\t.*VN: \b, with SAM header
46>>>&0 regex =[0-9.]+ \b version %s
47>>&(0x04) lelong >0 \b, with %d reference sequences
48
49
50###############################################################################
51# BAI (BAM indexing format)
45>>&0x00 regex =^[@]HD\t.*VN: \b, with SAM header
46>>>&0 regex =[0-9.]+ \b version %s
47>>&(0x04) lelong >0 \b, with %d reference sequences
48
49
50###############################################################################
51# BAI (BAM indexing format)
52# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
52# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
53###############################################################################
540 string BAI\1 SAMtools BAI (BAM indexing format)
55>0x04 lelong >0 \b, with %d reference sequences
56
57
58###############################################################################
53###############################################################################
540 string BAI\1 SAMtools BAI (BAM indexing format)
55>0x04 lelong >0 \b, with %d reference sequences
56
57
58###############################################################################
59# CRAM (Binary Sequence Alignment/Map format)
59# CRAM (Binary Sequence Alignment/Map format)
60###############################################################################
610 string CRAM CRAM
62>0x04 byte >-1 version %d.
63>0x05 byte >-1 \b%d
64>0x06 string >\0 (identified as %s)
65
66
67###############################################################################
68# BCF (Binary Call Format), version 1
69# used by SAMtools & VCFtools (http://vcftools.sourceforge.net/bcf.pdf)
70# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
71###############################################################################
60###############################################################################
610 string CRAM CRAM
62>0x04 byte >-1 version %d.
63>0x05 byte >-1 \b%d
64>0x06 string >\0 (identified as %s)
65
66
67###############################################################################
68# BCF (Binary Call Format), version 1
69# used by SAMtools & VCFtools (http://vcftools.sourceforge.net/bcf.pdf)
70# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
71###############################################################################
720 string BCF\4
720 string BCF\4
73# length of seqnm data in bytes is positive
73# length of seqnm data in bytes is positive
74>&0x00 lelong >0
74>&0x00 lelong >0
75# length of smpl data in bytes is positive
76>>&(&-0x04) lelong >0 SAMtools BCF (Binary Call Format)
77# length of meta in bytes
75# length of smpl data in bytes is positive
76>>&(&-0x04) lelong >0 SAMtools BCF (Binary Call Format)
77# length of meta in bytes
78>>>&(&-0x04) lelong >0
78>>>&(&-0x04) lelong >0
79# have meta text string
80>>>>&0x00 search ##samtoolsVersion=
81>>>>>&0x00 string x \b, generated by SAMtools version %s
82
83
84###############################################################################
85# BCF (Binary Call Format), version 2.1
86# used by SAMtools (http://samtools.github.io/hts-specs/BCFv2_qref.pdf)
87# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
88###############################################################################
890 string BCF\2\1 Binary Call Format (BCF) version 2.1
90# length of header text
79# have meta text string
80>>>>&0x00 search ##samtoolsVersion=
81>>>>>&0x00 string x \b, generated by SAMtools version %s
82
83
84###############################################################################
85# BCF (Binary Call Format), version 2.1
86# used by SAMtools (http://samtools.github.io/hts-specs/BCFv2_qref.pdf)
87# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
88###############################################################################
890 string BCF\2\1 Binary Call Format (BCF) version 2.1
90# length of header text
91>&0x00 lelong >0
91>&0x00 lelong >0
92# have header string
93>>&0x00 search ##samtoolsVersion=
94>>>&0x00 string x \b, generated by SAMtools version %s
95
96
97###############################################################################
98# BCF (Binary Call Format), version 2.2
99# used by SAMtools (http://samtools.github.io/hts-specs/BCFv2_qref.pdf)
100# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
101###############################################################################
1020 string BCF\2\2 Binary Call Format (BCF) version 2.2
103# length of header text
92# have header string
93>>&0x00 search ##samtoolsVersion=
94>>>&0x00 string x \b, generated by SAMtools version %s
95
96
97###############################################################################
98# BCF (Binary Call Format), version 2.2
99# used by SAMtools (http://samtools.github.io/hts-specs/BCFv2_qref.pdf)
100# data is normally present only within compressed BGZF blocks (CDATA), so use file -z to examine it
101###############################################################################
1020 string BCF\2\2 Binary Call Format (BCF) version 2.2
103# length of header text
104>&0x00 lelong >0
104>&0x00 lelong >0
105# have header string
106>>&0x00 search ##samtoolsVersion=
107>>>&0x00 string x \b, generated by SAMtools version %s
108
109###############################################################################
110# VCF (Variant Call Format)
111# used by VCFtools (http://vcftools.sourceforge.net/)
112###############################################################################
1130 search ##fileformat=VCFv Variant Call Format (VCF)
114>&0 string x \b version %s
115
116###############################################################################
117# FASTQ
118# used by MAQ (http://maq.sourceforge.net/fastq.shtml)
119###############################################################################
120# XXX Broken?
121# @<seqname>
105# have header string
106>>&0x00 search ##samtoolsVersion=
107>>>&0x00 string x \b, generated by SAMtools version %s
108
109###############################################################################
110# VCF (Variant Call Format)
111# used by VCFtools (http://vcftools.sourceforge.net/)
112###############################################################################
1130 search ##fileformat=VCFv Variant Call Format (VCF)
114>&0 string x \b version %s
115
116###############################################################################
117# FASTQ
118# used by MAQ (http://maq.sourceforge.net/fastq.shtml)
119###############################################################################
120# XXX Broken?
121# @<seqname>
122#0 regex =^@[A-Za-z0-9_.:-]+\?\n
122#0 regex =^@[A-Za-z0-9_.:-]+\?\n
123# <seq>
124#>&1 regex =^[A-Za-z\n.~]++
125# +[<seqname>]
123# <seq>
124#>&1 regex =^[A-Za-z\n.~]++
125# +[<seqname>]
126#>>&1 regex =^[A-Za-z0-9_.:-]*\?\n
126#>>&1 regex =^[A-Za-z0-9_.:-]*\?\n
127# <qual>
128#>>>&1 regex =^[!-~\n]+\n FASTQ
129
130###############################################################################
131# FASTA
132# used by FASTA (http://fasta.bioch.virginia.edu/fasta_www2/fasta_guide.pdf)
133###############################################################################
134#0 byte 0x3e
127# <qual>
128#>>>&1 regex =^[!-~\n]+\n FASTQ
129
130###############################################################################
131# FASTA
132# used by FASTA (http://fasta.bioch.virginia.edu/fasta_www2/fasta_guide.pdf)
133###############################################################################
134#0 byte 0x3e
135# q>0 regex =^[>][!-~\t\ ]+$
135# q>0 regex =^[>][!-~\t\ ]+$
136# Amino Acid codes: [A-IK-Z*-]+
137#>>1 regex !=[!-'Jj;:=?@^`|~\\] FASTA
138# IUPAC codes/gaps: [ACGTURYKMSWBDHVNX-]+
139# not in IUPAC codes/gaps: [EFIJLOPQZ]
140#>>>1 regex !=[EFIJLOPQZefijlopqz] \b, with IUPAC nucleotide codes
141#>>>1 regex =^[EFIJLOPQZefijlopqz]+$ \b, with Amino Acid codes
142
143###############################################################################
136# Amino Acid codes: [A-IK-Z*-]+
137#>>1 regex !=[!-'Jj;:=?@^`|~\\] FASTA
138# IUPAC codes/gaps: [ACGTURYKMSWBDHVNX-]+
139# not in IUPAC codes/gaps: [EFIJLOPQZ]
140#>>>1 regex !=[EFIJLOPQZefijlopqz] \b, with IUPAC nucleotide codes
141#>>>1 regex =^[EFIJLOPQZefijlopqz]+$ \b, with Amino Acid codes
142
143###############################################################################
144# SAM (Sequence Alignment/Map format)
145# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
144# SAM (Sequence Alignment/Map format)
145# used by SAMtools (http://samtools.sourceforge.net/SAM1.pdf)
146###############################################################################
147# Short-cut version to recognise SAM files with (optional) header at beginning
148###############################################################################
146###############################################################################
147# Short-cut version to recognise SAM files with (optional) header at beginning
148###############################################################################
1490 string @HD\t
1490 string @HD\t
150>4 search VN: Sequence Alignment/Map (SAM), with header
151>>&0 regex [0-9.]+ \b version %s
152###############################################################################
153# Longer version to recognise SAM alignment lines using (many) regexes
154###############################################################################
155# SAM Alignment QNAME
150>4 search VN: Sequence Alignment/Map (SAM), with header
151>>&0 regex [0-9.]+ \b version %s
152###############################################################################
153# Longer version to recognise SAM alignment lines using (many) regexes
154###############################################################################
155# SAM Alignment QNAME
1560 regex =^[!-?A-~]{1,255}(\t[^\t]+){11}
1560 regex =^[!-?A-~]{1,255}(\t[^\t]+){11}
157# SAM Alignment FLAG
157# SAM Alignment FLAG
158>0 regex =^([^\t]+\t){1}[0-9]{1,5}\t
158>0 regex =^([^\t]+\t){1}[0-9]{1,5}\t
159# SAM Alignment RNAME
159# SAM Alignment RNAME
160>>0 regex =^([^\t]+\t){2}\\*|[^*=]*\t
160>>0 regex =^([^\t]+\t){2}\\*|[^*=]*\t
161# SAM Alignment POS
161# SAM Alignment POS
162>>>0 regex =^([^\t]+\t){3}[0-9]{1,9}\t
162>>>0 regex =^([^\t]+\t){3}[0-9]{1,9}\t
163# SAM Alignment MAPQ
163# SAM Alignment MAPQ
164>>>>0 regex =^([^\t]+\t){4}[0-9]{1,3}\t
164>>>>0 regex =^([^\t]+\t){4}[0-9]{1,3}\t
165# SAM Alignment CIGAR
165# SAM Alignment CIGAR
166>>>>>0 regex =\t\\*|([0-9]+[MIDNSHPX=])+)\t
166>>>>>0 regex =\t(\\*|([0-9]+[MIDNSHPX=])+)\t
167# SAM Alignment RNEXT
167# SAM Alignment RNEXT
168>>>>>>0 regex =\t(\\*|=|[!-()+->?-~][!-~]*)\t
168>>>>>>0 regex =\t(\\*|=|[!-()+->?-~][!-~]*)\t
169# SAM Alignment PNEXT
169# SAM Alignment PNEXT
170>>>>>>>0 regex =^([^\t]+\t){7}[0-9]{1,9}\t
170>>>>>>>0 regex =^([^\t]+\t){7}[0-9]{1,9}\t
171# SAM Alignment TLEN
171# SAM Alignment TLEN
172>>>>>>>>0 regex =\t[+-]{0,1}[0-9]{1,9}\t.*\t
172>>>>>>>>0 regex =\t[+-]{0,1}[0-9]{1,9}\t.*\t
173# SAM Alignment SEQ
173# SAM Alignment SEQ
174>>>>>>>>>0 regex =^([^\t]+\t){9}(\\*|[A-Za-z=.]+)\t
174>>>>>>>>>0 regex =^([^\t]+\t){9}(\\*|[A-Za-z=.]+)\t
175# SAM Alignment QUAL
176>>>>>>>>>>0 regex =^([^\t]+\t){10}[!-~]+ Sequence Alignment/Map (SAM)
177>>>>>>>>>>>0 regex =^[@]HD\t.*VN: \b, with header
178>>>>>>>>>>>>&0 regex =[0-9.]+ \b version %s
175# SAM Alignment QUAL
176>>>>>>>>>>0 regex =^([^\t]+\t){10}[!-~]+ Sequence Alignment/Map (SAM)
177>>>>>>>>>>>0 regex =^[@]HD\t.*VN: \b, with header
178>>>>>>>>>>>>&0 regex =[0-9.]+ \b version %s