Struct noodles_gtf::record::Builder

source ·
pub struct Builder { /* private fields */ }
Expand description

A GTF record builder.

Implementations§

source§

impl Builder

source

pub fn set_reference_sequence_name<N>(self, reference_sequence_name: N) -> Self
where N: Into<String>,

Sets the reference sequence name.

§Examples
use noodles_gtf as gtf;
let record = gtf::Record::builder().set_reference_sequence_name("sq0").build();
assert_eq!(record.reference_sequence_name(), "sq0");
source

pub fn set_source<S>(self, source: S) -> Self
where S: Into<String>,

Sets the source.

§Examples
use noodles_gtf as gtf;
let record = gtf::Record::builder().set_source("NOODLES").build();
assert_eq!(record.source(), "NOODLES");
source

pub fn set_type<T>(self, ty: T) -> Self
where T: Into<String>,

Sets the feature type.

§Examples
use noodles_gtf as gtf;
let record = gtf::Record::builder().set_type("exon").build();
assert_eq!(record.ty(), "exon");
source

pub fn set_start(self, start: Position) -> Self

Sets the start position.

§Examples
use noodles_core::Position;
use noodles_gtf as gtf;
let start = Position::MIN;
let record = gtf::Record::builder().set_start(start).build();
assert_eq!(record.start(), start);
source

pub fn set_end(self, end: Position) -> Self

Sets the end position.

§Examples
use noodles_core::Position;
use noodles_gtf as gtf;
let end = Position::MIN;
let record = gtf::Record::builder().set_end(end).build();
assert_eq!(record.end(), end);
source

pub fn set_score(self, score: f32) -> Self

Sets the score.

§Examples
use noodles_gtf as gtf;
let record = gtf::Record::builder().set_score(1.0).build();
assert_eq!(record.score(), Some(1.0));
source

pub fn set_strand(self, strand: Strand) -> Self

Sets the strand.

§Examples
use noodles_gtf::{self as gtf, record::Strand};
let record = gtf::Record::builder().set_strand(Strand::Forward).build();
assert_eq!(record.strand(), Some(Strand::Forward));
source

pub fn set_frame(self, frame: Frame) -> Self

Sets the frame.

§Examples
use noodles_gtf::{self as gtf, record::Frame};
let frame = Frame::try_from(0)?;
let record = gtf::Record::builder().set_frame(frame).build();
assert_eq!(record.frame(), Some(frame));
Ok::<_, gtf::record::frame::ParseError>(())
source

pub fn set_attributes(self, attributes: Attributes) -> Self

Sets the attributes;

§Examples
use noodles_gtf::{self as gtf, record::{attributes::Entry, Attributes}};
let attributes = Attributes::from(vec![Entry::new("gene_id", "g0")]);
let record = gtf::Record::builder().set_attributes(attributes.clone()).build();
assert_eq!(record.attributes(), &attributes);
source

pub fn build(self) -> Record

Builds the GTF record.

§Examples
use noodles_gtf as gtf;
let record = gtf::Record::builder().build();

Trait Implementations§

source§

impl Debug for Builder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Builder

source§

fn default() -> Self

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

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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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.