Documentation

OrfFinder implements OrfFinderInterface uses TranslatesUnderGeneticCode

Migrated from biotools' Service/DnaToProteinManager.php::findORF(), which was not actually a coordinate-returning ORF finder : it translated up to six frames into peptide strings and then highlighted the coding stretches (uppercasing a "*"-delimited segment long enough, optionally trimmed to its first Met) purely for display. That highlighting behavior stays a presentational concern of biotools. This class reuses the same core idea - the longest ORF in each stop-delimited segment starts at that segment's first Met - but implements it as a proper library service that returns real OpenReadingFrame coordinates, via SequenceInterface::translateCodon() (the project's own already-wired standard genetic code) rather than biotools' separate TripletApiAdapter/ TripletSpecieApiAdapter machinery, the same reuse CodonAdaptationIndexCalculator already makes.

A trailing segment that reaches the end of a frame without hitting a stop codon is still reported, with hasStopCodon() false on the ORF - a real, common case at the edge of a linear sequence or contig, not an error. Multiple Met codons within the same stop-delimited segment only ever produce one ORF, starting at the first (= longest possible) one, matching biotools' own behavior rather than reporting every nested alternative start. Class OrfFinder

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

Table of Contents

Interfaces

OrfFinderInterface
Interface OrfFinderInterface - finds every open reading frame across all six reading frames (three forward, three reverse) of a DNA sequence.

Properties

$geneticCodeTranslator  : AlternateGeneticCodeTranslator|null
$sequenceManager  : SequenceInterface

Methods

__construct()  : mixed
OrfFinder constructor.
findOrfs()  : array<string|int, OpenReadingFrame>
assertSupportedGeneticCode()  : void
buildOrf()  : OpenReadingFrame
scanFrame()  : array<string|int, OpenReadingFrame>
translateUnder()  : string

Properties

Methods

findOrfs()

public findOrfs(DnaSequence $oSequence[, int $iMinimumProteinLength = 1 ][, int $iGeneticCode = 1 ]) : array<string|int, OpenReadingFrame>
Parameters
$oSequence : DnaSequence
$iMinimumProteinLength : int = 1
$iGeneticCode : int = 1

The NCBI table the sequence is translated under ; an ORF starts at the first codon that table reads as Met and ends at one it reads as a stop

Tags
throws
InvalidArgumentException

When the genetic code is not supported

Return values
array<string|int, OpenReadingFrame>

assertSupportedGeneticCode()

private assertSupportedGeneticCode(int $iGeneticCode) : void
Parameters
$iGeneticCode : int

An NCBI table id (see GeneticCodeTable::SUPPORTED_TABLES)

Tags
throws
InvalidArgumentException

When the table is not supported

buildOrf()

private buildOrf(string $sSequenceValue, int $iOffset, int $iFrame, int $iFirstMetCodon, int $iStopOrCodonCount, int $iOriginalLength, bool $bReverse, bool $bHasStopCodon, int $iGeneticCode) : OpenReadingFrame
Parameters
$sSequenceValue : string
$iOffset : int
$iFrame : int
$iFirstMetCodon : int

Zero-based codon index of the first Met

$iStopOrCodonCount : int

The stop codon's zero-based index when $bHasStopCodon, otherwise the frame's total codon count

$iOriginalLength : int
$bReverse : bool
$bHasStopCodon : bool
$iGeneticCode : int
Return values
OpenReadingFrame

scanFrame()

private scanFrame(string $sSequenceValue, int $iOffset, int $iFrame, int $iOriginalLength, int $iMinimumProteinLength, bool $bReverse, int $iGeneticCode) : array<string|int, OpenReadingFrame>
Parameters
$sSequenceValue : string

The forward sequence, or its reverse complement when $bReverse is true

$iOffset : int

0, 1 or 2 ; the frame's zero-based starting position

$iFrame : int

The frame number to stamp on any ORF found

$iOriginalLength : int

Length of the original, forward-strand sequence

$iMinimumProteinLength : int
$bReverse : bool
$iGeneticCode : int
Return values
array<string|int, OpenReadingFrame>

translateUnder()

private translateUnder(string $sCodon, int $iGeneticCode) : string
Parameters
$sCodon : string
$iGeneticCode : int
Return values
string —

The amino acid, "*" for a stop, "X" for an ambiguous codon

On this page

Search results