use crate::attributes::Attributes;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Strand {
Forward,
Reverse,
Unstranded, Unknown, }
impl Strand {
pub fn parse(s: &str) -> Strand {
match s {
"+" => Strand::Forward,
"-" => Strand::Reverse,
"?" => Strand::Unknown,
_ => Strand::Unstranded,
}
}
pub fn as_str(&self) -> &'static str {
match self {
Strand::Forward => "+",
Strand::Reverse => "-",
Strand::Unstranded => ".",
Strand::Unknown => "?",
}
}
}
#[derive(Debug, Clone)]
pub struct Record {
pub seqid: String,
pub source: String,
pub feature_type: String,
pub start: u64,
pub end: u64,
pub score: String,
pub strand: Strand,
pub phase: String,
pub attributes: Attributes,
}
impl Record {
pub fn id(&self) -> Option<&str> {
self.attributes.get("ID")
}
pub fn parent(&self) -> Option<&str> {
self.attributes.first("Parent")
}
}