pub fn filter_kmers_parallel<K, SD, DI>(
seqs: &ReadsPaired<DI>,
summariy_config: &SummaryConfig,
report_all_kmers: bool,
memory_size: f32,
time: bool,
) -> (BoomHashMap2<K, Exts, SD>, Vec<K>)Expand description
Process DNA sequences into kmers and determine the set of valid kmers,
their extensions, and summarize associated label/‘color’ data. The input
sequences are converted to kmers of type K, and like kmers are grouped together.
All instances of each kmer, along with their label data are then proccessed with
SummaryData::summarize, which generates an implementation of SummaryData,
which is specified with the generic SD, decides if the k-mer is ‘valid’
based on the parameters given in summary_config, and
summarizes the the individual label into a single label data structure
for the kmer. Care is taken to keep the memory consumption small.
Be aware that the configuration in summary_config only applies if the required
informaiton can be supplied by the chosen implementation of SummaryData.
E.g., the k-mers will not be filtered according to p-value when the SummaryData
only contains the number of observations.
§Arguments
seqsare the reads wrapped in aReads<u8>. See [Reads<D>]summary_configis aSummaryConfig, which contains prameters and information necessary for the filteringstranded: if true, preserve the strandedness of the input sequences, effectively assuming they are all in the positive strand. If false, the kmers will be canonicalized to the lexicographic minimum of the kmer and it’s reverse complement.report_all_kmers: if true returns the vector of all the observed kmers and performs the kmer based filteringmemory_size: gives the size bound on the memory in GB to use and automatically determines the number of passes neededtime: print information about the time needed for each step
§Returns
BoomHashMap2 Object, check rust-boomphf for details
/// # Returns BoomHashMap2 Object, check rust-boomphf for details
§Examples:
use debruijn::summarizer::{SampleInfo, SummaryConfig, TagsCountsData, StatTest, GroupFrac};
use debruijn::reads::{Reads, ReadsPaired, Strandedness};
use debruijn::filter::filter_kmers_parallel;
use debruijn::kmer::Kmer16;
use debruijn::Exts;
let mut seqs = Reads::new(Strandedness::Unstranded);
seqs.add_from_bytes("ACCGATCATATATTTTCGGGGCTAGGCGAAGCGATCTTATCGAGC".as_bytes(), None, 1u8);
seqs.add_from_bytes("GCGATCGAGCATGCTCAGCTGACGTGACTGACGTAGCTATCTTTTCGTAGCTAC".as_bytes(), None, 1u8);
seqs.add_from_bytes("GCGAGTTTGCGACTCGAGGCTATCTAGCTAGCTASGCTCTCGACTAGCTGACTTACGACGACTACG".as_bytes(), None, 2u8);
seqs.add_from_bytes("CGATTAGCTACGTAGCTAGCTGACGTACTGGGGGGTATTTCGGATCTGCGGAGCGATCT".as_bytes(), None, 2u8);
let sample_info = SampleInfo::new(
0b000011,
0b111100,
vec![23423, 3463454, 2242234, 2233243, 234322434, 2323234],
);
let summary_config = SummaryConfig::new(sample_info)
.with_min_kmer_obs(3)
.with_group_frac(GroupFrac::One, 0.333)
.with_stat_test(StatTest::StudentsTTest);
let (hashed_kmers, _) = filter_kmers_parallel::<Kmer16, TagsCountsData, _>(
&ReadsPaired::Unpaired { reads: seqs },
&summary_config,
false,
10.,
false,
);