Part 4: Using Coordinates to Extract DNA
For dna sequences to reverse, we write a similar rule to the above. The only difference will be one missing letter in the perl subroutine. So, Insert a new rule “To write simple Perl code to convert data”. Name the rule something like “Genes to Reverse” and change the Perl subroutine to be the following:
sub { # Do not name your subroutine to avoid name conflicts.
my ($tag, $gene) = @_;
return ($gene) if defined($tag) && $tag =~ /complement/;
return;
}
As you can see the only difference is the missing ! The exlamation mark is a common programming method for meaning the logic “NOT”. Basically we are telling the perl subroutine to return any dna sequences that have the word Complement in their coordinates.
Your rule should look like the following now:
Click to view larger image
Now that we've extracted the genes that have to be reversed, we have to actually reverse the dna sequences to be finally done with it. Insert a new rule “To Convert or reverse data without changing length.” Name the rule something like “Reversed Genes” and change it to look like the following sentence:
“Reversed and Complemented data from Genes to Reverse”
Your rule should nowlook like the following:
Click to view larger image
|