Orphos

Struct Orphos 

Source
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: OrphosConfig

Configuration options for gene prediction

Implementations§

Source§

impl Orphos<Untrained>

Source

pub fn new() -> Self

Creates a new untrained Orphos instance with default configuration.

§Examples
use orphos_core::engine::UntrainedOrphos;

let orphos = UntrainedOrphos::new();
Source

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)?;
Source

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>

Source

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 prediction
  • training - 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§

Source§

impl<S: Debug + TrainingState> Debug for Orphos<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Default + TrainingState> Default for Orphos<S>

Source§

fn default() -> Orphos<S>

Returns the “default value” for a type. Read more

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V