note 83034 added to function.str-split

From: Date: Wed, 07 May 2008 18:42:10 +0000
Subject: note 83034 added to function.str-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-139149@lists.php.net to get a copy of this message
A good use of str_split is reverse translating an amino acid sequence. <? /* reverse translate an aa sequence using its dna counterpart */ function reverseTranslate($aaSeq,$ntSeq){ $nt=str_split($ntSeq,3); $aa=str_split($aaSeq,1); $gapChar=array('*','-'); $numAa=count($aa); $ntIndex=0; $newNtSeq=""; for($i=0;$i<$numAa;$i++){ // if the aa is a gap, then just put on a gap character if(in_array($aa[$i],$gapChar)){ $newNtSeq.='---'; } else{ $newNtSeq.=$nt[$ntIndex]; $ntIndex++; } } return $newNtSeq; } ?> ---- Server IP: 209.41.74.194 Probable Submitter: 130.207.66.123 ---- Manual Page -- http://www.php.net/manual/en/function.str-split.php Edit -- https://master.php.net/note/edit/83034 Del: integrated -- https://master.php.net/note/delete/83034/integrated Del: useless -- https://master.php.net/note/delete/83034/useless Del: bad code -- https://master.php.net/note/delete/83034/bad+code Del: spam -- https://master.php.net/note/delete/83034/spam Del: non-english -- https://master.php.net/note/delete/83034/non-english Del: in docs -- https://master.php.net/note/delete/83034/in+docs Del: other reasons-- https://master.php.net/note/delete/83034 Reject -- https://master.php.net/note/reject/83034 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139149) next »