pub struct Scanner { /* private fields */ }Expand description
A GFF scanner.
Schema parameters (fields, attribute definitions) are declared at construction time. Scan methods accept only column projection, batch size, and limit.
§Examples
use oxbow::gxf::scanner::gff::Scanner;
use std::fs::File;
use std::io::BufReader;
let inner = File::open("sample.gff").map(BufReader::new).unwrap();
let mut fmt_reader = noodles::gff::io::Reader::new(inner);
let attr_defs = Scanner::attribute_defs(&mut fmt_reader, Some(1000)).unwrap();
let scanner = Scanner::new(None, None, Some(attr_defs)).unwrap();
let batches = scanner.scan(fmt_reader, None, None, Some(1000));Implementations§
Source§impl Scanner
impl Scanner
Sourcepub fn new(
header: Option<Header>,
fields: Option<Vec<String>>,
attr_defs: Option<Vec<(String, String)>>,
) -> Result<Self>
pub fn new( header: Option<Header>, fields: Option<Vec<String>>, attr_defs: Option<Vec<(String, String)>>, ) -> Result<Self>
Creates a GFF scanner from schema parameters.
The schema is validated and cached at construction time.
Sourcepub fn chrom_names(&self) -> Result<Vec<String>>
pub fn chrom_names(&self) -> Result<Vec<String>>
Returns the reference sequence names if an index header was provided.
Sourcepub fn field_names(&self) -> Vec<String>
pub fn field_names(&self) -> Vec<String>
Returns the fixed field names.
Source§impl Scanner
impl Scanner
Sourcepub fn attribute_defs<R: BufRead>(
fmt_reader: &mut Reader<R>,
scan_rows: Option<usize>,
) -> Result<Vec<(String, String)>>
pub fn attribute_defs<R: BufRead>( fmt_reader: &mut Reader<R>, scan_rows: Option<usize>, ) -> Result<Vec<(String, String)>>
Discovers attribute definitions by scanning over records.
The scan will begin at the current position of the reader and will move the cursor to the end of the last record scanned.
Sourcepub fn scan<R: BufRead>(
&self,
fmt_reader: Reader<R>,
columns: Option<Vec<String>>,
batch_size: Option<usize>,
limit: Option<usize>,
) -> Result<impl RecordBatchReader>
pub fn scan<R: BufRead>( &self, fmt_reader: Reader<R>, columns: Option<Vec<String>>, batch_size: Option<usize>, limit: Option<usize>, ) -> Result<impl RecordBatchReader>
Returns an iterator yielding record batches.
Sourcepub fn scan_query<R: BufRead + Seek>(
&self,
fmt_reader: Reader<R>,
region: Region,
index: impl BinningIndex,
columns: Option<Vec<String>>,
batch_size: Option<usize>,
limit: Option<usize>,
) -> Result<impl RecordBatchReader>
pub fn scan_query<R: BufRead + Seek>( &self, fmt_reader: Reader<R>, region: Region, index: impl BinningIndex, columns: Option<Vec<String>>, batch_size: Option<usize>, limit: Option<usize>, ) -> Result<impl RecordBatchReader>
Returns an iterator yielding record batches satisfying a genomic range query.
Sourcepub fn scan_byte_ranges<R: BufRead + Seek>(
&self,
fmt_reader: Reader<R>,
byte_ranges: Vec<(u64, u64)>,
columns: Option<Vec<String>>,
batch_size: Option<usize>,
limit: Option<usize>,
) -> Result<impl RecordBatchReader>
pub fn scan_byte_ranges<R: BufRead + Seek>( &self, fmt_reader: Reader<R>, byte_ranges: Vec<(u64, u64)>, columns: Option<Vec<String>>, batch_size: Option<usize>, limit: Option<usize>, ) -> Result<impl RecordBatchReader>
Returns an iterator yielding record batches from specified byte ranges.
Sourcepub fn scan_virtual_ranges<R: BufRead + Seek>(
&self,
fmt_reader: Reader<R>,
vpos_ranges: Vec<(VirtualPosition, VirtualPosition)>,
columns: Option<Vec<String>>,
batch_size: Option<usize>,
limit: Option<usize>,
) -> Result<impl RecordBatchReader>
pub fn scan_virtual_ranges<R: BufRead + Seek>( &self, fmt_reader: Reader<R>, vpos_ranges: Vec<(VirtualPosition, VirtualPosition)>, columns: Option<Vec<String>>, batch_size: Option<usize>, limit: Option<usize>, ) -> Result<impl RecordBatchReader>
Returns an iterator yielding record batches from specified virtual position ranges.
Auto Trait Implementations§
impl Freeze for Scanner
impl RefUnwindSafe for Scanner
impl Send for Scanner
impl Sync for Scanner
impl Unpin for Scanner
impl UnsafeUnpin for Scanner
impl UnwindSafe for Scanner
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 more