mod flat_bwt;
mod reader;
mod writer;
#[cfg(test)]
mod tests;
use crate::core::core_types::Orientation;
use crate::core::graph_dto::CoreGraphDTO;
use crate::error::PanResult;
use crate::traits::{GraphParser, GraphSerializer};
use gbz_construct::Orientation as GbzOrientation;
use std::io::{Read, Seek, Write};
pub struct GBZCodec;
impl<R: Read + Seek> GraphParser<R> for GBZCodec {
fn parse(&self, reader: &mut R) -> PanResult<CoreGraphDTO> {
reader::parse(reader)
}
}
impl GraphSerializer for GBZCodec {
fn serialize(&self, graph: &CoreGraphDTO, writer: &mut dyn Write) -> PanResult<()> {
writer::write(graph, writer)
}
}
impl From<GbzOrientation> for Orientation {
fn from(o: GbzOrientation) -> Self {
match o {
GbzOrientation::Forward => Self::Forward,
GbzOrientation::Reverse => Self::Reverse,
}
}
}
impl From<Orientation> for GbzOrientation {
fn from(o: Orientation) -> Self {
match o {
Orientation::Forward => Self::Forward,
Orientation::Reverse => Self::Reverse,
}
}
}