C
carriehecker
I am trying to write a subroutine for the mutation of only the third
nucleotide in a series of three. I don't really know perl all that
well, so I was hoping someone would be able to tell me where I am
going wrong, and why I am getting a lot of errors when I edit my code.
Here is my subroutine:
sub strategy2
{
# split on the empty pattern; returns individual letters
my @nucleotides = split ( //, $origDNASeq );
my $nuc = (@nucleotides);
my $nucFile = "hsp70_nuc.fasta.txt";
open ($origDNASeq, '<', $nucFile);
# build new sequence
my $newDNASeq = "";
while ($origDNASeq = <$nucFile>)
{
if ($origDNASeq =~ m/^((.)(.)(.).*)/)
{
if (rand(1) < $mutationRate)
{
# randomly mutate $nuc to a new nucleotide (A, C, G, T)
$newDNASeq = $newDNASeq . $1 . $2 . randNuc($nuc);
}
else
{
# append original nucleotide to new sequence
$newDNASeq = $newDNASeq . $1 . $2 . $3;
}
}
else
{
}
}
#print "$newDNASeq";
# translate new DNreadInDNA( $aaFile )A sequence to protein sequence
my $newProtSeq = translate( $newDNASeq );
# calculate the percent identity
my $identity = calcIdentity( $newProtSeq, $origProtSeq );
return $identity;
}
Could anyone provide some helpful hints on how to get this thing
working correctly? I'd be happy to answer any more questions if I
didn't make anything clear enough. Thanks so much for your time!
Carrie H.
nucleotide in a series of three. I don't really know perl all that
well, so I was hoping someone would be able to tell me where I am
going wrong, and why I am getting a lot of errors when I edit my code.
Here is my subroutine:
sub strategy2
{
# split on the empty pattern; returns individual letters
my @nucleotides = split ( //, $origDNASeq );
my $nuc = (@nucleotides);
my $nucFile = "hsp70_nuc.fasta.txt";
open ($origDNASeq, '<', $nucFile);
# build new sequence
my $newDNASeq = "";
while ($origDNASeq = <$nucFile>)
{
if ($origDNASeq =~ m/^((.)(.)(.).*)/)
{
if (rand(1) < $mutationRate)
{
# randomly mutate $nuc to a new nucleotide (A, C, G, T)
$newDNASeq = $newDNASeq . $1 . $2 . randNuc($nuc);
}
else
{
# append original nucleotide to new sequence
$newDNASeq = $newDNASeq . $1 . $2 . $3;
}
}
else
{
}
}
#print "$newDNASeq";
# translate new DNreadInDNA( $aaFile )A sequence to protein sequence
my $newProtSeq = translate( $newDNASeq );
# calculate the percent identity
my $identity = calcIdentity( $newProtSeq, $origProtSeq );
return $identity;
}
Could anyone provide some helpful hints on how to get this thing
working correctly? I'd be happy to answer any more questions if I
didn't make anything clear enough. Thanks so much for your time!
Carrie H.