noodles_gtf::record

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

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.