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§
sourcefn column_names<'a, 'h: 'a>(
&'a self,
header: &'h Header,
) -> Box<dyn Iterator<Item = Result<&'a str>> + 'a>
fn column_names<'a, 'h: 'a>( &'a self, header: &'h Header, ) -> Box<dyn Iterator<Item = Result<&'a str>> + 'a>
Returns the column names.
sourcefn select<'a, 'h: 'a>(
&'a self,
header: &'h Header,
column_name: &str,
) -> Option<Result<Box<dyn Series + 'a>>>
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.
Trait Implementations§
source§impl Samples for Box<dyn Samples + '_>
impl Samples for Box<dyn Samples + '_>
source§fn column_names<'a, 'h: 'a>(
&'a self,
header: &'h Header,
) -> Box<dyn Iterator<Item = Result<&'a str>> + 'a>
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>>>
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.