File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use std::io::Read;
6
6
pub enum FileType {
7
7
Bed ,
8
8
Vcf ,
9
+ Bcf ,
9
10
}
10
11
11
12
#[ derive( Debug ) ]
@@ -16,6 +17,8 @@ pub enum Compression {
16
17
None ,
17
18
}
18
19
20
+ // TODO: https://github.com/quinlan-lab/bedder-rs/blob/ffddd2b3a2075594a5375fb81b8672f4f5039acf/src/sniff.rs
21
+
19
22
pub fn sniff < R : io:: BufRead > (
20
23
rdr : & mut R ,
21
24
) -> Result < ( FileType , Compression ) , Box < dyn std:: error:: Error > > {
@@ -53,8 +56,10 @@ pub fn sniff<R: io::BufRead>(
53
56
_ => & dec_buf,
54
57
} ;
55
58
// now we guess filel type based on whats in buf
56
- let ft = if buf. starts_with ( b"##fileformat=VCFv4 " ) {
59
+ let ft = if buf. starts_with ( b"##fileformat=VCF " ) {
57
60
FileType :: Vcf
61
+ } else if buf. starts_with ( b"BCF" ) && ( buf[ 3 ] == 0x2 || buf[ 3 ] == 0x4 ) {
62
+ FileType :: Bcf
58
63
} else {
59
64
FileType :: Bed
60
65
} ;
You can’t perform that action at this time.
0 commit comments