pub enum ExecutionResult {
Vcf(VcfExecution),
Bam(BamExecution),
Bed(BedExecution),
Fastq(FastqExecution),
}Expand description
Result of executing a plan - holds the reader and metadata
Variants§
Implementations§
Source§impl ExecutionResult
impl ExecutionResult
Sourcepub fn to_annotation_index<F>(self, extractor: F) -> Result<AnnotationIndex>
pub fn to_annotation_index<F>(self, extractor: F) -> Result<AnnotationIndex>
Build an annotation index from BED execution results
This provides an ergonomic way to go directly from a filtered query to an annotation index without manual iteration.
§Examples
use genomicframe_core::plan::LogicalPlan;
use genomicframe_core::execution::execute;
use genomicframe_core::expression::col;
use genomicframe_core::schema::{lit, FileFormat};
// Query: Large genes only
let plan = LogicalPlan::scan("genes.bed", FileFormat::Bed)
.filter(col("length").gte(lit(1000)));
// Execute and build annotation index in one go!
let genes = execute(plan)?
.to_annotation_index(|record| {
record.name.clone().unwrap_or_else(|| "unknown".to_string())
})?;Sourcepub fn annotate_with_genes(
self,
genes: &AnnotationIndex,
exons: &AnnotationIndex,
) -> Result<AnnotationResult>
pub fn annotate_with_genes( self, genes: &AnnotationIndex, exons: &AnnotationIndex, ) -> Result<AnnotationResult>
Annotate VCF variants with gene/exon information
This provides an ergonomic way to annotate variants from VCF files with gene and exon annotations, returning structured statistics.
§Examples
use genomicframe_core::plan::LogicalPlan;
use genomicframe_core::execution::execute;
use genomicframe_core::expression::{col, lit};
use genomicframe_core::schema::FileFormat;
// Load annotation indexes (genes and exons)
let genes = /* ... load genes ... */;
let exons = /* ... load exons ... */;
// Query and annotate in one go!
let plan = LogicalPlan::scan("variants.vcf", FileFormat::Vcf)
.filter(col("qual").gte(lit(30.0)));
let result = execute(plan)?
.annotate_with_genes(&genes, &exons)?;
println!("Genic variants: {}", result.genic_variants);
println!("Exonic variants: {}", result.exonic_variants);Sourcepub fn count(self) -> Result<usize>
pub fn count(self) -> Result<usize>
Count total records in the execution result
This consumes the iterator and returns the total count.
§Examples
use genomicframe_core::plan::LogicalPlan;
use genomicframe_core::execution::execute;
use genomicframe_core::schema::FileFormat;
let plan = LogicalPlan::scan("variants.vcf", FileFormat::Vcf);
let count = execute(plan)?.count()?;
println!("Total variants: {}", count);Sourcepub fn head(self, n: usize) -> Result<String>
pub fn head(self, n: usize) -> Result<String>
Peek at the first N records
Returns a string representation of the first N records for quick inspection. This is useful for exploratory analysis and debugging.
§Examples
use genomicframe_core::plan::LogicalPlan;
use genomicframe_core::execution::execute;
use genomicframe_core::expression::col;
use genomicframe_core::schema::FileFormat;
let plan = LogicalPlan::scan("variants.vcf", FileFormat::Vcf);
let preview = execute(plan)?.head(5)?;
println!("{}", preview);Auto Trait Implementations§
impl Freeze for ExecutionResult
impl !RefUnwindSafe for ExecutionResult
impl !Send for ExecutionResult
impl !Sync for ExecutionResult
impl Unpin for ExecutionResult
impl UnsafeUnpin for ExecutionResult
impl !UnwindSafe for ExecutionResult
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
Mutably borrows from an owned value. Read more
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>
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 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>
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