Struct atglib::spliceai::Writer

source ·
pub struct Writer<W: Write> { /* private fields */ }
Expand description

Writes Transcripts into a BufWriter to be used as gene annotation by SpliceAI

Examples

use atglib::tests;;
use atglib::spliceai::Writer;
use atglib::models::TranscriptWrite;

let transcripts = vec![tests::transcripts::standard_transcript()];

let output = Vec::new(); // substitute this with proper IO (io::stdout())
let mut writer = Writer::new(output);
writer.write_transcript_vec(&transcripts);

assert_eq!(
writer.into_inner().unwrap(), // this is our actual output
b"#NAME\tCHROM\tSTRAND\tTX_START\tTX_END\tEXON_START\tEXON_END
Test-Gene\tchr1\t+\t11\t55\t11,21,31,41,51,\t15,25,35,45,55,
"
);

Implementations§

source§

impl Writer<File>

source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self, ReadWriteError>

source§

impl<W: Write> Writer<W>

source

pub fn new(writer: W) -> Self

Creates a new generic Writer for any `std::io::Read`` object

Use this method when you want to write to stdout or a remote source, e.g. via HTTP

source

pub fn with_capacity(capacity: usize, writer: W) -> Self

source

pub fn flush(&mut self) -> Result<(), AtgError>

source

pub fn into_inner(self) -> Result<W, AtgError>

source

pub fn write_header(&mut self) -> Result<(), Error>

Trait Implementations§

source§

impl<W: Write> TranscriptWrite for Writer<W>

source§

fn writeln_single_transcript( &mut self, transcript: &Transcript ) -> Result<(), Error>

Writes a single transcript formatted for SpliceAI with an extra newline

source§

fn write_single_transcript( &mut self, transcript: &Transcript ) -> Result<(), Error>

source§

fn write_transcripts(&mut self, transcripts: &Transcripts) -> Result<(), Error>

source§

fn write_transcript_vec( &mut self, transcripts: &[Transcript] ) -> Result<(), Error>

Auto Trait Implementations§

§

impl<W> RefUnwindSafe for Writer<W>where W: RefUnwindSafe,

§

impl<W> Send for Writer<W>where W: Send,

§

impl<W> Sync for Writer<W>where W: Sync,

§

impl<W> Unpin for Writer<W>where W: Unpin,

§

impl<W> UnwindSafe for Writer<W>where W: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.