A
Amy Lee
Hello,
I'm going to process some RNA sequences files. And I make a small script
to reverse these sequences. However, I face a problem while it's running
because of order problem.
This is my file contents.
And I wanna replace A to C, C to A, G to U, U to G. So from my point the
reversed file should be viewed like this.
This is my codes.
if (@ARGV == 1)
{
$file = $ARGV[0];
unless (-e $file)
{
print "***Error: $file dose not exist.\n";
next;
}
unless (open $FILE_IN, '<', $file)
{
print "***Error: Cannot read $file.\n";
next;
}
while (<$FILE_IN>)
{
unless (/^>.*$/)
{
s/A/C/g;
s/C/A/g;
s/G/U/g;
s/U/G/g;
}
print $_;
}
close $FILE_IN;
}
When I finished doing this task, the file is like this.
And I don't wanna use BioPerl to solve this tiny problem, anyway I'm
trying to know how to do that.
So how to solve this kind of order problem? I suppose that the replacement
must process at the same time.
Thank you very much~
Regards,
Amy Lee
I'm going to process some RNA sequences files. And I make a small script
to reverse these sequences. However, I face a problem while it's running
because of order problem.
This is my file contents.
GUACCGUseq1 ACGU
seq2
And I wanna replace A to C, C to A, G to U, U to G. So from my point the
reversed file should be viewed like this.
UGCAAUGseq1 CAUG
seq2
This is my codes.
if (@ARGV == 1)
{
$file = $ARGV[0];
unless (-e $file)
{
print "***Error: $file dose not exist.\n";
next;
}
unless (open $FILE_IN, '<', $file)
{
print "***Error: Cannot read $file.\n";
next;
}
while (<$FILE_IN>)
{
unless (/^>.*$/)
{
s/A/C/g;
s/C/A/g;
s/G/U/g;
s/U/G/g;
}
print $_;
}
close $FILE_IN;
}
When I finished doing this task, the file is like this.
GGAAAGGseq1 AAGG
seq2
And I don't wanna use BioPerl to solve this tiny problem, anyway I'm
trying to know how to do that.
So how to solve this kind of order problem? I suppose that the replacement
must process at the same time.
Thank you very much~
Regards,
Amy Lee