pub struct MetadataBuilder { /* private fields */ }
Expand description

Builder for Metadata.

Implementations

Create Metadata from the builder.

See Metadata::builder()

Set the family id (fid) values.

Set the individual id (iid) values.

use ndarray as nd;
use bed_reader::{Metadata, assert_eq_nan};

let metadata = Metadata::builder()
   .iid(["sample1", "sample2", "sample3"])
   .build()?;
println!("{:?}", metadata.iid()); // Outputs ndarray Some(["sample1", "sample2", "sample3"])

Set the father values.

Override the mother values.

Override the sex values.

Override the phenotype values.

Override the chromosome values.

Override the SNP id (sid) values.

use ndarray as nd;
use bed_reader::{Metadata, assert_eq_nan};

let metadata = Metadata::builder()
   .sid(["SNP1", "SNP2", "SNP3", "SNP4"])
   .build()?;
println!("{:?}", metadata.sid()); // Outputs ndarray Some(["SNP1", "SNP2", "SNP3", "SNP4"])

Override the centimorgan position values.

Override the base-pair position values.

Override the allele 1 values.

Override the allele 2 values.

Merge metadata from a Metadata.

Example

In the example, we create a Metadata with iid and sid arrays. Next, we use another MetadataBuilder to set an fid array and an iid array. Then, we add the first Metadata to the MetadataBuilder, overwriting iid and setting sid. Finally, we print these three arrays and chromosome. Chromosome is None.

 use ndarray as nd;
 use bed_reader::Metadata;

 let metadata1 = Metadata::builder()
     .iid(["i1", "i2", "i3"])
     .sid(["s1", "s2", "s3", "s4"])
     .build()?;
 let metadata2 = Metadata::builder()
     .fid(["f1", "f2", "f3"])
     .iid(["x1", "x2", "x3"])
     .metadata(&metadata1)
     .build()?;

 println!("{0:?}", metadata2.fid()); // Outputs optional ndarray Some(["f1", "f2", "f3"]...)
 println!("{0:?}", metadata2.iid()); // Outputs optional ndarray Some(["i1", "i2", "i3"]...)
 println!("{0:?}", metadata2.sid()); // Outputs optional ndarray Some(["s1", "s2", "s3", "s4"]...)
 println!("{0:?}", metadata2.chromosome()); // Outputs None

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more

Checks if self is actually part of its subset T (and can be converted to it).

Use with care! Same as self.to_subset but without any property checks. Always succeeds.

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.