Login | Register

Info | Home

BioPHP - Number of codons in a DNA/RNA sequence

Original code submitted by joseba
Code bellow is covered by GNU GPL v2 license.

Description

Last change: 2010/10/18 17:04 | Edit description | Recent Changes | Original description
Counts the number of codons (trios of base-pairs) in a DNA/RNA sequence.

Code

Last change: 2010/10/18 17:04 | Edit Code | Recent Changes | Download | Original code
function count_codons()
        {
        if (isset($this->features["CDS"]["/codon_start"]) == FALSE) $codstart = 1;
        else $codstart = $this->features["CDS"]["/codon_start"];
        $codcount = (int) (($this->seqlen() - $codstart + 1)/3);
        return $codcount;
        }