noodles_vcf::variant::record::samples

Trait Samples

Source
pub trait Samples {
    // Required methods
    fn is_empty(&self) -> bool;
    fn len(&self) -> usize;
    fn column_names<'a, 'h: 'a>(
        &'a self,
        header: &'h Header,
    ) -> Box<dyn Iterator<Item = Result<&'a str>> + 'a>;
    fn select<'a, 'h: 'a>(
        &'a self,
        header: &'h Header,
        column_name: &str,
    ) -> Option<Result<Box<dyn Series + 'a>>>;
    fn series(
        &self,
    ) -> Box<dyn Iterator<Item = Result<Box<dyn Series + '_>>> + '_>;
    fn iter(&self) -> Box<dyn Iterator<Item = Box<dyn Sample + '_>> + '_>;
}
Expand description

Variant record samples.

Variant record samples are described similarly to a data frame: rows and columns are samples and series, respectively.

Take, for example, the following samples in a VCF record.

FORMAT	sample1	sample2	sample3
GT:GQ:DP	0|0:21:1	1|0:34:2	1/1:55:5

This trait provides an interface over this data as a table.

          GT     GQ    DP
        +-----+-----+-----+
sample1 | 0|0 |  21 |   1 |
sample2 | 1|0 |  34 |   2 |
sample3 | 1/1 |  55 |   5 |
        +-----+-----+-----+

A sample contains the values of a row (e.g., sample1 = [“0|0”, 21, 1]); and a column, the values of a series (e.g., GT = [“0|0”, “1|0”, “1/1”]).

Required Methods§

Source

fn is_empty(&self) -> bool

Returns whether there are any samples.

Source

fn len(&self) -> usize

Returns the number of samples.

Source

fn column_names<'a, 'h: 'a>( &'a self, header: &'h Header, ) -> Box<dyn Iterator<Item = Result<&'a str>> + 'a>

Returns the column names.

Source

fn select<'a, 'h: 'a>( &'a self, header: &'h Header, column_name: &str, ) -> Option<Result<Box<dyn Series + 'a>>>

Returns the series with the given column name.

Source

fn series(&self) -> Box<dyn Iterator<Item = Result<Box<dyn Series + '_>>> + '_>

Returns an iterator over series.

Source

fn iter(&self) -> Box<dyn Iterator<Item = Box<dyn Sample + '_>> + '_>

Returns an iterator over samples.

Trait Implementations§

Source§

impl Samples for Box<dyn Samples + '_>

Source§

fn is_empty(&self) -> bool

Returns whether there are any samples.
Source§

fn len(&self) -> usize

Returns the number of samples.
Source§

fn column_names<'a, 'h: 'a>( &'a self, header: &'h Header, ) -> Box<dyn Iterator<Item = Result<&'a str>> + 'a>

Returns the column names.
Source§

fn select<'a, 'h: 'a>( &'a self, header: &'h Header, column_name: &str, ) -> Option<Result<Box<dyn Series + 'a>>>

Returns the series with the given column name.
Source§

fn series(&self) -> Box<dyn Iterator<Item = Result<Box<dyn Series + '_>>> + '_>

Returns an iterator over series.
Source§

fn iter(&self) -> Box<dyn Iterator<Item = Box<dyn Sample + '_>> + '_>

Returns an iterator over samples.

Implementations on Foreign Types§

Source§

impl Samples for Box<dyn Samples + '_>

Source§

fn is_empty(&self) -> bool

Source§

fn len(&self) -> usize

Source§

fn column_names<'a, 'h: 'a>( &'a self, header: &'h Header, ) -> Box<dyn Iterator<Item = Result<&'a str>> + 'a>

Source§

fn select<'a, 'h: 'a>( &'a self, header: &'h Header, column_name: &str, ) -> Option<Result<Box<dyn Series + 'a>>>

Source§

fn series(&self) -> Box<dyn Iterator<Item = Result<Box<dyn Series + '_>>> + '_>

Source§

fn iter(&self) -> Box<dyn Iterator<Item = Box<dyn Sample + '_>> + '_>

Implementors§

Source§

impl Samples for &noodles_vcf::variant::record_buf::samples::Samples

Source§

impl Samples for noodles_vcf::variant::record_buf::samples::Samples

Source§

impl<'r> Samples for noodles_vcf::record::samples::Samples<'r>