SequenceScrambler
January 26th, 2006 by Casey
< ?php
$me = $_SERVER['PHP_SELF'];
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
echo "
Your Scrambled Sequence:”;
echo “
“;
$sequence = strtoupper($_POST['Sequence']);
$sequence = ereg_replace(’[^A-Z]‘, ”, $sequence);
$seqChar = array();
for ($i = 0; $i < strlen($sequence); $i ++)
{
array_push($seqChar, $sequence[$i]);
}
srand((float)microtime() * 1000000);
shuffle($seqChar);
echo "
“;
foreach ($seqChar as $index => $val)
{
if ($index % 50 == 49)
{
echo “
“;
}
echo “$val”;
}
echo “
“;
}
else
{
echo “
Welcome to the Sequence Scrambler
“;
echo “
The use of the Sequence Scrambler is simple. Input any sequence, and the alphabetic characters will be scrambled into a random order. This was created to assist the Bio68/168 class at Dartmouth. This could be useful in randomizing the location of bases/amino acids in a DNA or Protein sequence without altering the composition.”;
}
?>