Struct noodles_gff::record::Builder

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

A GFF record builder.

Implementations§

source§

impl Builder

source

pub fn new() -> Self

Creates a GFF record builder.

Typically, Record::builder is used instead of calling this.

§Examples
use noodles_gff as gff;
let builder = gff::Record::builder();
source

pub fn set_reference_sequence_name( self, reference_sequence_name: String ) -> Self

Sets a GFF record reference sequence name.

§Examples
use noodles_gff as gff;

let record = gff::Record::builder()
    .set_reference_sequence_name(String::from("sq0"))
    .build();

assert_eq!(record.reference_sequence_name(), "sq0");
source

pub fn set_source(self, source: String) -> Self

Sets a GFF record source.

§Examples
use noodles_gff as gff;

let record = gff::Record::builder()
    .set_source(String::from("NOODLES"))
    .build();

assert_eq!(record.source(), "NOODLES");
source

pub fn set_type(self, ty: String) -> Self

Sets a GFF record feature type.

§Examples
use noodles_gff as gff;

let record = gff::Record::builder()
    .set_type(String::from("gene"))
    .build();

assert_eq!(record.ty(), "gene");
source

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

Sets a GFF record start position.

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

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

Sets a GFF record end position.

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

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

Sets a GFF record score.

§Examples
use noodles_gff as gff;
let record = gff::Record::builder().set_score(21.0).build();
assert_eq!(record.score(), Some(21.0));
source

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

Sets a GFF record strand.

§Examples
use noodles_gff::{self as gff, record::Strand};

let record = gff::Record::builder()
    .set_strand(Strand::Forward)
    .build();

assert_eq!(record.strand(), Strand::Forward);
source

pub fn set_phase(self, phase: Phase) -> Self

Sets a GFF record phase.

§Examples
use noodles_gff::{self as gff, record::Phase};
let record = gff::Record::builder().set_phase(Phase::Zero).build();
assert_eq!(record.phase(), Some(Phase::Zero));
source

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

Sets GFF record attributes.

§Examples
use noodles_gff::{
    self as gff,
    record::{
        attributes::field::{Tag, Value},
        Attributes,
    },
};

let attributes: Attributes = [(Tag::from("gene_id"), Value::from("ndls0"))]
    .into_iter()
    .collect();

let record = gff::Record::builder()
    .set_attributes(attributes.clone())
    .build();

assert_eq!(record.attributes(), &attributes);
source

pub fn build(self) -> Record

Builds a GFF record.

§Example
use noodles_gff as gff;
let record = gff::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.