sigalign_utils/file_extension_checker/
mod.rs1use std::path::Path;
2
3const FASTA_EXTENSIONS: [&str; 6] = [
4 "fa", "fasta", "fna", "ffn", "faa", "frn", ];
10
11const GZIP_EXTENSIONS: [&str; 2] = [
12 "gz", "gzip",
13];
14
15pub fn is_fasta_file<P: AsRef<Path>>(path: P) -> bool {
16 let path = path.as_ref();
17 let extension = path.extension().unwrap_or_default();
18 FASTA_EXTENSIONS.contains(&extension.to_str().unwrap_or_default())
19}
20
21pub fn is_gzip_file<P: AsRef<Path>>(path: P) -> bool {
22 let path = path.as_ref();
23 let extension = path.extension().unwrap_or_default();
24 GZIP_EXTENSIONS.contains(&extension.to_str().unwrap_or_default())
25}