Skip to main content

ExecutionResult

Enum ExecutionResult 

Source
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

Source

pub fn to_annotation_index<F>(self, extractor: F) -> Result<AnnotationIndex>
where F: Fn(&BedRecord) -> String,

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())
    })?;
Source

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

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

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§

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, 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.