Struct ParGranges

Source
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>

Source

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/CRAM
  • ref_fasta- path to an indexed reference file for CRAM
  • regions_bed- Optional BED file path restricting the regions to be examined
  • regions_bcf- Optional BCF/VCF file path restricting the regions to be examined
  • merge_regions - If regions_bed and or regions_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 all
  • chunksize- 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 that R::P is sent on. formula is: ((BYTES_INA_GIGABYTE * channel_size_modifier) * threads) / size_of(R::P)
  • processor- Something that implements RegionProcessor
Source

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§

Source§

impl<R: Debug + 'static + RegionProcessor + Send + Sync> Debug for ParGranges<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> ErasedDestructor for T
where T: 'static,