pub struct Orphos<S: TrainingState> {
pub config: OrphosConfig,
/* private fields */
}Expand description
Main Orphos configuration and execution engine.
This struct uses the type-state pattern with the S type parameter
to ensure training is performed before gene prediction. The state
transitions from Untrained to Trained via the training methods.
§Type Parameters
§Examples
use orphos_core::engine::UntrainedOrphos;
use orphos_core::config::OrphosConfig;
use orphos_core::sequence::encoded::EncodedSequence;
// Create an untrained instance
let mut orphos = UntrainedOrphos::new();
// Encode a sequence
let sequence = b"ATGAAACGCATTAGCACCACCATT...";
let encoded = EncodedSequence::without_masking(sequence);
// Train on the sequence and get results
let trained = orphos.train_single_genome(&encoded)?;
// Use the higher-level API to analyze sequences
use orphos_core::OrphosAnalyzer;
let mut analyzer = OrphosAnalyzer::new(OrphosConfig::default());
let results = analyzer.analyze_sequence("ATGAAACGCATTAGCACCACCATT...", None)?;
println!("Found {} genes", results.genes.len());Fields§
§config: OrphosConfigConfiguration options for gene prediction
Implementations§
Source§impl Orphos<Untrained>
impl Orphos<Untrained>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new untrained Orphos instance with default configuration.
§Examples
use orphos_core::engine::UntrainedOrphos;
let orphos = UntrainedOrphos::new();Sourcepub fn with_config(config: OrphosConfig) -> Result<Self, OrphosError>
pub fn with_config(config: OrphosConfig) -> Result<Self, OrphosError>
Creates a new untrained Orphos instance with custom configuration.
§Arguments
config- Configuration options for gene prediction
§Errors
Returns OrphosError if thread pool configuration fails.
§Examples
use orphos_core::engine::UntrainedOrphos;
use orphos_core::config::{OrphosConfig, OutputFormat};
let config = OrphosConfig {
closed_ends: true,
output_format: OutputFormat::Gff,
..Default::default()
};
let orphos = UntrainedOrphos::with_config(config)?;Sourcepub fn train_single_genome(
&mut self,
encoded_sequence: &EncodedSequence,
) -> Result<TrainedOrphos, OrphosError>
pub fn train_single_genome( &mut self, encoded_sequence: &EncodedSequence, ) -> Result<TrainedOrphos, OrphosError>
Trains the model on a single complete genome sequence.
This method analyzes the sequence to build a statistical model of gene characteristics including:
- Start codon usage (ATG, GTG, TTG)
- Ribosome binding site motifs
- Codon usage patterns
- GC content bias
§Arguments
encoded_sequence- The genome sequence encoded in bitmap format
§Returns
A TrainedOrphos instance ready for gene prediction.
§Errors
Returns OrphosError::InvalidSequence if:
- The sequence is shorter than
MIN_SEQUENCE_LENGTH - The sequence contains invalid characters
- Training fails to converge
§Examples
use orphos_core::engine::UntrainedOrphos;
use orphos_core::sequence::encoded::EncodedSequence;
let mut orphos = UntrainedOrphos::new();
let sequence = b"ATGAAACGCATTAGCACCACCATT...";
let encoded = EncodedSequence::without_masking(sequence);
let trained = orphos.train_single_genome(&encoded)?;Source§impl Orphos<Trained>
impl Orphos<Trained>
Sourcepub const fn new(config: OrphosConfig, training: Training) -> Self
pub const fn new(config: OrphosConfig, training: Training) -> Self
Creates a new trained Orphos instance with pre-computed training data.
This is useful when you have previously computed training data that you want to reuse for gene prediction on multiple sequences.
§Arguments
config- Configuration options for gene predictiontraining- Pre-computed training data
§Examples
use orphos_core::engine::TrainedOrphos;
use orphos_core::config::OrphosConfig;
use orphos_core::types::Training;
let config = OrphosConfig::default();
let training = Training::default(); // In practice, load from file
let trained = TrainedOrphos::new(config, training);Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Orphos<S>
impl<S> RefUnwindSafe for Orphos<S>where
S: RefUnwindSafe,
impl<S> Send for Orphos<S>where
S: Send,
impl<S> Sync for Orphos<S>where
S: Sync,
impl<S> Unpin for Orphos<S>where
S: Unpin,
impl<S> UnwindSafe for Orphos<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.