sigalign_utils/file_extension_checker/
mod.rs

1use std::path::Path;
2
3const FASTA_EXTENSIONS: [&str; 6] = [
4    "fa", "fasta", // General extension
5    "fna", //For nucleotide
6    "ffn", // For nucleotide of coding regions (genes)
7    "faa", //For amino acid (protein)
8    "frn", // For non-coding RNA sequences
9];
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}