Expand description
Advanced iterators over busrecords, grouping records by cell or molecule.
Allows to iterate over
- cells (CB)
- mRNAs (CB+UMI)
- CB+UMI+gene: in case some CB/UMI collision
To iterate over a sorted busfile, grouping all records by CB:
use bustools::iterators::CellGroupIterator; //need to bring that trait into scope
let breader = BusReader::new("/path/to/some.bus");
for (cb, vector_of_records) in breader.groupby_cb() {
// Example: the number of records in that cell
let n_molecules: usize = vector_of_records.len();
}
To iterate over a sorted busfile, grouping all records by CB+UMI:
use bustools::iterators::CbUmiGroupIterator; //need to bring that trait into scope
let breader = BusReader::new("/path/to/some.bus");
for ((cb, umi), vector_of_records) in breader.groupby_cbumi() {
// Example: the number of reads of that molecule (CB/UMI)
let n_reads: u32 = vector_of_records.iter().map(|r| r.COUNT).sum();
}
Structs§
- groups an iterator over BusRecords by cell+umi
- groups an iterator over BusRecords by cell
- enables to group things by gene
CbUmiIterator.iter().group_by_gene()
works for any iterator yieldingVec<BusRecord>
Traits§
- gets iterator chaining working! Just a wrapper around CbUmiGroupIterator::new()
- gets iterator chaining working! Just a wrapper around CellGroupIterator::new()
- gets iterator chaining working! Just a wrapper around GroupbyGene::new()