pub struct ParGranges<R: 'static + RegionProcessor + Send + Sync> { /* private fields */ }
Expand description
ParGranges holds all the information and configuration needed to launch the
ParGranges::process
.
Implementations§
Source§impl<R: RegionProcessor + Send + Sync> ParGranges<R>
impl<R: RegionProcessor + Send + Sync> ParGranges<R>
Sourcepub fn new(
reads: PathBuf,
ref_fasta: Option<PathBuf>,
regions_bed: Option<PathBuf>,
regions_bcf: Option<PathBuf>,
merge_regions: bool,
threads: Option<usize>,
chunksize: Option<u32>,
channel_size_modifier: Option<f64>,
processor: R,
) -> Self
pub fn new( reads: PathBuf, ref_fasta: Option<PathBuf>, regions_bed: Option<PathBuf>, regions_bcf: Option<PathBuf>, merge_regions: bool, threads: Option<usize>, chunksize: Option<u32>, channel_size_modifier: Option<f64>, processor: R, ) -> Self
Create a ParIO object
§Arguments
reads
- path to an indexed BAM/CRAMref_fasta
- path to an indexed reference file for CRAMregions_bed
- Optional BED file path restricting the regions to be examinedregions_bcf
- Optional BCF/VCF file path restricting the regions to be examinedmerge_regions
- Ifregions_bed
and orregions_bcf
is specified, and this is true, merge any overlapping regions to avoid duplicate output.threads
- Optional threads to restrict the number of threads this process will use, defaults to allchunksize
- optional argument to change the default chunksize of 1_000_000.chunksize
determines the number of bases each worker will get to work on at one time.channel_size_modifier
- Optional argument to modify the default size ration of the channel thatR::P
is sent on. formula is: ((BYTES_INA_GIGABYTE * channel_size_modifier) * threads) / size_of(R::P)processor
- Something that implementsRegionProcessor
Sourcepub fn process(self) -> Result<Receiver<R::P>>
pub fn process(self) -> Result<Receiver<R::P>>
Process each region.
This method splits the sequences in the BAM/CRAM header into chunksize
* self.threads
regions (aka ‘super chunks’).
It then queries that ‘super chunk’ against the intervals (either the BED file, or the whole genome broken up into chunksize
regions). The results of that query are then processed by a pool of workers that apply process_region
to reach interval to
do perbase analysis on. The collected result for each region is then sent back over the returned Receiver<R::P>
channel
for the caller to use. The results will be returned in order according to the order of the intervals used to drive this method.
While one ‘super chunk’ is being worked on by all workers, the last ‘super chunks’ results are being printed to either to a file or to STDOUT, in order.
Note, a common use case of this will be to fetch a region and do a pileup. The bounds of bases being looked at should still be checked since a fetch will pull all reads that overlap the region in question.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for ParGranges<R>where
R: Freeze,
impl<R> !RefUnwindSafe for ParGranges<R>
impl<R> Send for ParGranges<R>
impl<R> Sync for ParGranges<R>
impl<R> Unpin for ParGranges<R>where
R: Unpin,
impl<R> !UnwindSafe for ParGranges<R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.