BioPHP - DNA_remove_non_coding
Original code submitted by josebaCode bellow is covered by GNU GPL v2 license.
Description
Last change: 2010/10/18 17:04 | Edit description | Recent Changes | Original descriptionRemoves non coding characters from DNA sequence. Degenerated nucleotides are not removed.
Code
Last change: 2010/10/18 17:04 | Edit Code | Recent Changes | Download | Original codefunction DNA_remove_non_coding($seq) {
// change the sequence to upper case
$seq=strtoupper($seq);
// replace all X by N (to normalized sequences)
$seq=preg_replace("/X/","N",$seq);
// remove non-words (\W), non coding ([^ATGCYRWSKMDVHBN]) and digits (\d) from sequence
$seq=preg_replace("/\W|[^ATGCYRWSKMDVHBN]|\d/","",$seq);
return $seq;
}