Skip to content

Models

The main engine for finding genes, holding the HMM in memory.

Methods:

  • __new__

    Initialize the GeneFinder.

  • find_genes

    Predict open reading frames in a given DNA sequence.

  • find_genes_batch

    Predict open reading frames for a batch of DNA sequences using Rayon.

  • global_model

    Exposes the underlying global HMM parameters (read-only).

  • local_models

    Exposes the underlying local (GC-specific) HMM parameters (read-only).

  • run_file

    Run the full CLI pipeline purely in Rust without python loop overhead.

__new__

Python
__new__(model: Model, whole_genome: Optional[bool] = None) -> GeneFinder

Initialize the GeneFinder.

Parameters:

  • model

    (Model) –

    The sequencing error model to use (e.g., pyfgs.Model.Illumina5).

  • whole_genome

    (bool, default: None ) –

    Set to True if analyzing complete genomic sequences rather than short reads. Defaults to False.

find_genes

Python
find_genes(sequence: bytes) -> list[Gene]

Predict open reading frames in a given DNA sequence.

This method releases the GIL, allowing for safe multi-threading across multiple CPU cores.

Parameters:

  • sequence

    (bytes) –

    The raw nucleotide bytes.

Returns:

  • list[Gene]

    List[Gene]: A list of predicted Gene objects.

find_genes_batch

Python
find_genes_batch(sequences: Sequence[bytes]) -> GeneBatch

Predict open reading frames for a batch of DNA sequences using Rayon.

Parameters:

  • sequences

    (list[bytes]) –

    A list of raw nucleotide bytes.

Returns:

  • GeneBatch

    List[List[Gene]]: A list of predicted Gene objects for each sequence.

global_model

Python
global_model() -> HmmGlobal

Exposes the underlying global HMM parameters (read-only).

local_models

Python
local_models() -> list[HmmLocal]

Exposes the underlying local (GC-specific) HMM parameters (read-only).

run_file

Python
run_file(input_path: str, is_fastq: bool, outputs: Mapping[str, str]) -> None

Run the full CLI pipeline purely in Rust without python loop overhead.

Parameters:

  • input_path

    (str) –

    The path to the FASTA/FASTQ file or "-" for stdin.

  • is_fastq

    (bool) –

    True if parsing as FASTQ.

  • outputs

    (Dict[str, str]) –

    Output formats and paths.

A wrapper around the FragGeneScanRs Global HMM states

Methods:

  • pi

    Initial state probabilities

  • tr_ii

    Insertion-to-insertion transition matrix [4 x 4]

  • tr_mi

    Match-to-insertion transition matrix [4 x 4]

  • transitions

    Transition probabilities (MM, MI, MD, II, IM, DD, DM, GE, GG, ER, RS, RR, ES, ES1)

pi

Python
pi() -> NDArray[float64]

Initial state probabilities

tr_ii

Python
tr_ii() -> NDArray[float64]

Insertion-to-insertion transition matrix [4 x 4]

tr_mi

Python
tr_mi() -> NDArray[float64]

Match-to-insertion transition matrix [4 x 4]

transitions

Python
transitions() -> dict

Transition probabilities (MM, MI, MD, II, IM, DD, DM, GE, GG, ER, RS, RR, ES, ES1)

A wrapper around the FragGeneScanRs Local (GC-specific) HMM states

Methods:

  • e_m

    Emission probabilities for match states [PERIOD x BI_ACGT x ACGT]

  • e_m1

    Emission probabilities for match reverse states [PERIOD x BI_ACGT x ACGT]

  • tr_e

    End state transitions [WINDOW x TRI_ACGT]

  • tr_e1

    Reverse end state transitions [WINDOW x TRI_ACGT]

  • tr_rr

    Background noncoding transition matrix [4 x 4]

  • tr_s

    Start state transitions [WINDOW x TRI_ACGT]

  • tr_s1

    Reverse start state transitions [WINDOW x TRI_ACGT]

e_m

Python
e_m() -> NDArray[float64]

Emission probabilities for match states [PERIOD x BI_ACGT x ACGT]

e_m1

Python
e_m1() -> NDArray[float64]

Emission probabilities for match reverse states [PERIOD x BI_ACGT x ACGT]

tr_e

Python
tr_e() -> NDArray[float64]

End state transitions [WINDOW x TRI_ACGT]

tr_e1

Python
tr_e1() -> NDArray[float64]

Reverse end state transitions [WINDOW x TRI_ACGT]

tr_rr

Python
tr_rr() -> NDArray[float64]

Background noncoding transition matrix [4 x 4]

tr_s

Python
tr_s() -> NDArray[float64]

Start state transitions [WINDOW x TRI_ACGT]

tr_s1

Python
tr_s1() -> NDArray[float64]

Reverse start state transitions [WINDOW x TRI_ACGT]


              flowchart TD
              pyfgs.Model[Model]

              

              click pyfgs.Model href "" "pyfgs.Model"
            

The available sequencing error models for FragGeneScanRs.