|
Posted by Benjamin Esham on 07/27/06 04:43
vito wrote:
> i wrote a program
>
> $seq = preg_replace("/[\s\r\n0-9]/", "", $seq);
>
> but it generates an output of fragmented sequences (i.e. partially
> processed result), what is the problem?
Your regular expression may be giving unexpected results: since the RE is
double-quoted, the \r and \n are converted to their respective special
characters *before* being sent to preg_replace(), while the \s is left to be
processed by preg_replace(). You might try
$seq = preg_replace('/[[:space:]0-9]/', '', $seq);
which sidesteps the issue entirely by using [:space:]. Personally, I would
just use
$seq = preg_replace('/[^acgt]/', '', $seq);
which removes everything except for the characters [acgt]. This will work
no matter what other stuff happens to be present in the input file.
HTH,
--
Benjamin D. Esham
bdesham@gmail.com | AIM: bdesham128 | Jabber: same as e-mail
Más sabe el diablo por viejo que por diablo. (Spanish proverb)
Navigation:
[Reply to this message]
|