Login | Register

Info | Home

BioPHP - Expansion of a nucleic acid 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
Returns the expansion of a nucleic acid sequence, replacing special
wildcard symbols with the proper PERL regular expression.

Code

Last change: 2010/10/18 17:04 | Edit Code | Recent Changes | Download | Original code
function expand_na($string)
        {
        $string = preg_replace("/N|X/", ".", $string);
        $string = preg_replace("/R/", "[AG]", $string);
        $string = preg_replace("/Y/", "[CT]", $string);
        $string = preg_replace("/S/", "[GC]", $string);
        $string = preg_replace("/W/", "[AT]", $string);
        $string = preg_replace("/M/", "[AC]", $string);
        $string = preg_replace("/K/", "[TG]", $string);
        $string = preg_replace("/B/", "[CGT]", $string);
        $string = preg_replace("/D/", "[AGT]", $string);
        $string = preg_replace("/H/", "[ACT]", $string);
        $string = preg_replace("/R/", "[ACG]", $string);
        return $string;
        }