|
Zip and Skip Tries
|
Contains utilities for working with genetic data and file formats. More...
Classes | |
| struct | GeneManager |
| Manages efficient loading of multiple genetic sequences from a combined file. More... | |
Enumerations | |
| enum class | FileType { GBK , FNA , DNA , DNA_BIN , DNA_BIN_COMBINED , UNKNOWN } |
| Enumerates the supported genetic file formats. More... | |
Functions | |
| Gene | from_gbk (const std::string &filename) |
| Loads a gene from a GenBank format file. | |
| Gene | from_fna (const std::string &filename) |
| Loads a gene from a FASTA nucleotide format file. | |
| Gene | from_dna (const std::string &filename) |
| Loads a gene from a plain text DNA format file. | |
| Gene | from_file (const std::string &filename) |
| Loads a gene from a file with automatic format detection. | |
| Gene | from_file (const std::filesystem::path &path) |
| Loads a gene from a file path with automatic format detection. | |
| Gene | from_file (const std::filesystem::directory_entry &entry) |
| Loads a gene from a directory entry with automatic format detection. | |
| void | to_dna (const Gene &gene, const std::string &filename) |
| Saves a gene to a plain text DNA format file. | |
| std::vector< Gene > | from_directory (const std::string &dirname) |
| Loads all genes from files in a directory with automatic format detection. | |
| std::vector< Gene > | from_directory (const std::string &dirname, FileType type) |
| Loads all genes from files of a specific format in a directory. | |
| std::vector< std::string > | get_dna_strings_from_directory (const std::string &dirname) |
| Extracts DNA strings from all supported files in a directory. | |
| FileType | get_file_type (const std::string &filename) |
| Determines the file type based on its filename extension. | |
| FileType | get_file_type (const std::filesystem::path &path) |
| Determines the file type based on its path's extension. | |
| FileType | get_file_type (const std::filesystem::directory_entry &entry) |
| Determines the file type based on a directory entry's path extension. | |
| Gene | from_stream (std::istream &stream) |
| Loads a gene from an input stream. | |
| std::vector< std::filesystem::path > | get_virus_nucleotide_paths () |
| Gets paths to all virus nucleotide files in the virus directory. | |
| void | combine_dna_bin_files (const std::string &dirname, const std::string &combined_filename) |
| Combines multiple binary DNA files into a single combined file. | |
Variables | |
| static const std::string | GENETIC_DIRECTORY = "genetic/" |
| Path to the genetic data directory. | |
| static const std::string | VIRUS_DIRECTORY = GENETIC_DIRECTORY + "virus/" |
| Path to the virus genome data directory. | |
| static const std::string | ABC_HUMI_DIRECTORY = GENETIC_DIRECTORY + "ABC-HuMi/" |
| Path to the ABC-HuMi dataset directory. | |
| static const std::string | DNA_EXTENSION = ".dna" |
| File extension for plain text DNA files. | |
| static const std::string | DNA_BIN_EXTENSION = ".dna.bin" |
| File extension for binary DNA files. | |
| static const std::string | DNA_BIN_COMBINED_EXTENSION = ".dna.bin.combined" |
| File extension for combined binary DNA files. | |
| static const std::string | DNA_BIN_SIZES_EXTENSION = ".dna.bin.sizes" |
| File extension for binary DNA file size information. | |
| static const std::string | GBK_EXTENSION = ".gbk" |
| File extension for GenBank format files. | |
| static const std::string | FNA_EXTENSION = ".fna" |
| File extension for FASTA nucleotide format files. | |
Contains utilities for working with genetic data and file formats.
Provides constants, enums, and functions for loading, saving, and manipulating genetic data from various file formats. The namespace encapsulates all functionality related to genetic sequence processing.
|
strong |
Enumerates the supported genetic file formats.
This enumeration identifies the different file formats that can be processed by the genetics utility functions. Each format has specific parsing rules implemented in the corresponding from_* functions.
Definition at line 73 of file genetics.cuh.
| void genetics::combine_dna_bin_files | ( | const std::string & | dirname, |
| const std::string & | combined_filename | ||
| ) |
Combines multiple binary DNA files into a single combined file.
Creates a combined binary file and a separate size file that tracks the size of each original file for later extraction.
| dirname | Directory containing binary DNA files to combine. |
| combined_filename | Name of the output combined file. |
Definition at line 335 of file genetics.cu.
Loads all genes from files in a directory with automatic format detection.
Implementation of from_directory function that loads genes from all files in a directory.
| dirname | Path to the directory containing genetic data files. |
Iterates through all files in the specified directory and attempts to load each file as a genetic sequence using automatic format detection. This version handles all supported file types.
| dirname | Path to the directory containing genetic data files. |
Definition at line 183 of file genetics.cu.
Loads all genes from files of a specific format in a directory.
| dirname | Path to the directory containing genetic data files. |
| type | The specific file type to load. |
Definition at line 195 of file genetics.cu.
Loads a gene from a plain text DNA format file.
Implementation of from_dna function for loading genes from DNA format files.
| filename | Path to the DNA (.dna) file. |
| std::invalid_argument | if the file cannot be opened. |
Opens a DNA format file and passes the file stream to from_stream to extract the nucleotide sequence. DNA format files contain only nucleotide characters.
| filename | Path to the DNA format file. |
| std::invalid_argument | if the file cannot be opened. |
Definition at line 152 of file genetics.cu.
Loads a gene from a directory entry with automatic format detection.
| entry | A filesystem directory entry pointing to the genetic data file. |
| std::invalid_argument | if the file cannot be opened or has an unsupported format. |
Definition at line 318 of file genetics.cu.
Loads a gene from a file path with automatic format detection.
| path | A filesystem path to the genetic data file. |
| std::invalid_argument | if the file cannot be opened or has an unsupported format. |
Definition at line 313 of file genetics.cu.
Loads a gene from a file with automatic format detection.
Determines the file type based on its extension and calls the appropriate parsing function.
| filename | Path to the genetic data file. |
| std::invalid_argument | if the file cannot be opened or has an unsupported format. |
Definition at line 284 of file genetics.cu.
Loads a gene from a FASTA nucleotide format file.
Implementation of from_fna function for parsing FASTA nucleotide format files.
| filename | Path to the FASTA nucleotide (.fna) file. |
| std::invalid_argument | if the file cannot be opened. |
FASTA files start with a header line (beginning with '>') followed by the nucleotide sequence. This function skips the first line (header) and then passes the file stream to from_stream to extract the actual nucleotide sequence.
| filename | Path to the FASTA nucleotide file. |
| std::invalid_argument | if the file cannot be opened. |
Definition at line 107 of file genetics.cu.
Loads a gene from a GenBank format file.
Implementation of from_gbk function for parsing GenBank format files.
| filename | Path to the GenBank (.gbk) file. |
| std::invalid_argument | if the file cannot be opened. |
GenBank files have a specific format with a header section followed by a section that begins with "ORIGIN" followed by the nucleotide sequence. This function skips the header section and then passes the file stream to from_stream to extract the actual nucleotide sequence.
| filename | Path to the GenBank file. |
| std::invalid_argument | if the file cannot be opened. |
Definition at line 71 of file genetics.cu.
| Gene genetics::from_stream | ( | std::istream & | stream | ) |
Loads a gene from an input stream.
Implementation of from_stream function that parses genetic sequences from a stream.
Reads valid nucleotides from the stream until EOF, skipping invalid characters.
| stream | The input stream to read from. |
Reads the stream line by line, extracting valid nucleotides and adding them to the gene sequence. Invalid characters are skipped. Aborts if a FASTA header marker ('>') is encountered, as this indicates incorrect parsing logic.
| stream | Input stream containing genetic data. |
Definition at line 36 of file genetics.cu.
| std::vector< std::string > genetics::get_dna_strings_from_directory | ( | const std::string & | dirname | ) |
Extracts DNA strings from all supported files in a directory.
| dirname | Path to the directory containing genetic data files. |
Definition at line 212 of file genetics.cu.
Determines the file type based on a directory entry's path extension.
| entry | A filesystem directory entry to analyze. |
Definition at line 308 of file genetics.cu.
Determines the file type based on its path's extension.
| path | A filesystem path to analyze. |
Definition at line 303 of file genetics.cu.
Determines the file type based on its filename extension.
| filename | The filename to analyze. |
Definition at line 256 of file genetics.cu.
| std::vector< std::filesystem::path > genetics::get_virus_nucleotide_paths | ( | ) |
Gets paths to all virus nucleotide files in the virus directory.
Definition at line 323 of file genetics.cu.
Saves a gene to a plain text DNA format file.
Implementation of to_dna function for saving genes to DNA format files.
| gene | The genetic sequence to save. |
| filename | Path where the DNA file will be saved. |
| std::runtime_error | if the file cannot be created or written to. |
Writes the gene to a text file in DNA format, using the stream output operator of the Gene class to convert the gene to a string representation.
| gene | The genetic sequence to save. |
| filename | Path where the DNA file will be saved. |
| std::invalid_argument | if the file cannot be opened for writing. |
Definition at line 132 of file genetics.cu.
|
static |
Path to the ABC-HuMi dataset directory.
Definition at line 46 of file genetics.cuh.
|
static |
File extension for combined binary DNA files.
Definition at line 55 of file genetics.cuh.
|
static |
File extension for binary DNA files.
Definition at line 52 of file genetics.cuh.
|
static |
File extension for binary DNA file size information.
Definition at line 58 of file genetics.cuh.
|
static |
File extension for plain text DNA files.
Definition at line 49 of file genetics.cuh.
|
static |
File extension for FASTA nucleotide format files.
Definition at line 64 of file genetics.cuh.
|
static |
File extension for GenBank format files.
Definition at line 61 of file genetics.cuh.
|
static |
Path to the genetic data directory.
Definition at line 40 of file genetics.cuh.
|
static |
Path to the virus genome data directory.
Definition at line 43 of file genetics.cuh.