Question

In: Computer Science

Download the Perl code of "Example 1: Conceptual Translation" from "Resources for Undergraduate Bioinformatics Instruction" at...

Download the Perl code of "Example 1: Conceptual Translation" from "Resources for Undergraduate Bioinformatics Instruction" at Wright State University http://birg.cs.wright.edu/resources/index.shtml. The program performs the conceptual translation on three forward reading frames from mRNA nucleotides to amino acids. The mRNA sequence is provided as the command line argument. Modify it to add the following features:

a. (5pts) If no argument is provided in the command line, prompt the user to input a nucleotide sequence. Note that the modified code should still take the command line argument if present. done
b. (5pts) Accept lower case letters. done

c. (5pts) Accept a DNA sequence as the input. That is, thymine (T or t), should also be valid in the input.
d. (10pts) Perform the conceptual translation on the three backward reading frames in addition to on the forward reading frames.

Note that:

You are not allowed to modify the hash table provided in the code of Example 1.

The code is required to utilize the binding operator =~ whenever possible

instead of loops.

Solutions

Expert Solution

#!/usr/local/bin/perl

# Example program 1. Perform conceptual translation from nucleotides
# to amino acids. Do this for three reading frames, skipping the
# first 0-2 nucleotides to produce the reading frames.

# Define some constants that we'll need later.

$minlength = 3;
$readingframes = 3;
$unknown = "UNK"; # If some nucleotides are unknown, print this.

# Define a hash to do matching/printing. This allows us to say things
# like: $nucleohash{ "UUU" } and receive "Phe".

%nucleohash = ( "UUU", "Phe", "UUC", "Phe", "UUA", "Leu", "UUG", "Leu",
"UCU", "Ser", "UCC", "Ser", "UCA", "Ser", "UCG", "Ser",
"UAU", "Tyr", "UAC", "Tyr", "UAA", "STP", "UAG", "STP",
"UGU", "Cys", "UGC", "Cys", "UGA", "STP", "UGG", "Trp",
"CUU", "Leu", "CUC", "Leu", "CUA", "Leu", "CUG", "Leu",
"CCU", "Pro", "CCC", "Pro", "CCA", "Pro", "CCG", "Pro",
"CAU", "His", "CAC", "His", "CAA", "Gln", "CAG", "Gln",
"CGU", "Arg", "CGC", "Arg", "CGA", "Arg", "CGG", "Arg",
"AUU", "Ile", "AUC", "Ile", "AUA", "Ile", "AUG", "Met",
"ACU", "Thr", "ACC", "Thr", "ACA", "Thr", "ACG", "Thr",
"AAU", "Asn", "AAC", "Asn", "AAA", "Lys", "AAG", "Lys",
"AGU", "Ser", "AGC", "Ser", "AGA", "Arg", "AGG", "Arg",
"GUU", "Val", "GUC", "Val", "GUA", "Val", "GUG", "Val",
"GCU", "Ala", "GCC", "Ala", "GCA", "Ala", "GCG", "Ala",
"GAU", "Asp", "GAC", "Asp", "GAA", "Glu", "GAG", "Glu",
"GGU", "Gly", "GGC", "Gly", "GGA", "Gly", "GGG", "Gly" );

# Retreive and check the command line parameter.

$input = @ARGV[0];

if ( length( $input ) < $minlength )
{
printf("Please enter the nucleotide String: ");
$input = <>;
# printf( "$0: Place the nucleotide string on the commmand line.\n\n" );
# exit( 1 );
} # if
$input = uc($input);
printf( "Nucleotide sequence: $input\n\n" );

# Run through all 3 possible reading frames, skipping the first letter
# or two for frames 1 and 2.

for ( $i = 0; $i < $readingframes; $i++ )
{
printf( "Reading frame $i: " );

# Find out how many 3-letter sequences remain, after skipping 0-2
# for the reading frame, and loop through all of these sequences.

$len = int( length( substr( $input, $i ) ) / 3 );
# printf( "length $len: \n" );
  
$len2 = int( length( substr( $input, 3-$i ) ) / 3 );
#printf( "length $len2: \n" );
for ( $j = 0; $j < $len; $j++ )
{
# Take the current 3-letter sequence, look up the corresponding
# amino acid. If it isn't in the hash table, it is unknown.
$nuc = substr( $input, $i + $j * 3, 3 );
print("nuc value: $nuc\n");
if ( defined( $nucleohash{ $nuc } ) )
{
#printf("defined");
$aa = $nucleohash{ $nuc };
} # if
else
{
#printf("undenfined\n");
$aa = $unknown;
} # else

printf( "$aa " );
} # for j
for ( $j = 0; $j < $len2; $j++ )
{
# Take the current 3-letter sequence, look up the corresponding
# amino acid. If it isn't in the hash table, it is unknown.
$nuc = substr( $input, $i + $j * 3, 3 );
print("nuc value2: $nuc\n");
if ( defined( $nucleohash{ $nuc } ) )
{
# printf("defined");
$aa = $nucleohash{ $nuc };
} # if
else
{
# printf("undenfined\n");
$aa = $unknown;
} # else

printf( "$aa " );
} # for j

printf( "\n" );
} # for i


printf( "\n" );

ouput:

Note: Question C, I did get it correctly. Please note that C is not implemented. I'm sure you will be able to do it. Thanks!!


Related Solutions

Convert the following code from awk to Perl: (please don't use a2p (awk to perl) command)...
Convert the following code from awk to Perl: (please don't use a2p (awk to perl) command) Here was the original problem: Calculate the grade for each student that appears in the data file. You may calculate the grade based on total earned points, divided by total possible points. Or, for 10 points extra credit; Use the weighted totals for this course; available in the syllabus and on the course home page. Output a list of students, their grade as a...
Ex1) Download the code from the theory section, you will find zipped file contains the code...
Ex1) Download the code from the theory section, you will find zipped file contains the code of Singly linked list and Doubly linked list, in addition to a class Student. In Class SignlyLinkedList, 1. There is a method display, what does this method do? 2. In class Test, and in main method, create a singly linked list objet, test the methods of the list. 3. To class Singly linked list, add the following methods: a- Method get(int n), it returns...
Ex1) Download the code from the theory section, you will find zipped file contains the code...
Ex1) Download the code from the theory section, you will find zipped file contains the code of Singly linked list and Doubly linked list, in addition to a class Student. In Class SignlyLinkedList, 1. There is a method display, what does this method do? 2. In class Test, and in main method, create a singly linked list objet, test the methods of the list. 3. To class Singly linked list, add the following methods: a- Method get(int n), it returns...
True and False 1. The instruction register stores machine code for the instruction being executed. 2....
True and False 1. The instruction register stores machine code for the instruction being executed. 2. Before a digital computer may execute an instruction, the instruction code must be fetched from memory. 3. A pointer is a binary code for data in the arithmetic logic unit. 4. Von Neumann computer architecture stores data and instruction codes in the same memory. 5. Complex instruction set computers have instructions with greater speed than those in reduced instruction set computers.
Module 2 Programming Assignment – Battleship Refactor Refactor your Battleship drawing code from Module 1. Download...
Module 2 Programming Assignment – Battleship Refactor Refactor your Battleship drawing code from Module 1. Download the OO template for the basic battleship game, BattleshipRefactor.zip (refer below) The template has the outline of a battleship game using OO constructs. You need to add the Grid class and complete the code so that it runs correctly. At a minimum, you need to complete the Draw and DropBomb methods with code similar to the previous assignment. There will be changes due to...
1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled...
1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled into the hexadecimal machine code D1001695 is? 3.What does the LEGv8 instruction below do? LSL X12,X12,#8
As preparation for this problem, review Conceptual Example 9. From the top of a cliff overlooking...
As preparation for this problem, review Conceptual Example 9. From the top of a cliff overlooking a lake, a person throws two stones, as shown in the drawing. The cliff is 35.0 m high. The two stones described have identical initial speeds of v0 = 17.6 m/s and are thrown at an angle θ = 31.3 °, one below the horizontal and one above the horizontal. What is the distance between the points where the stones strike the water? Neglect...
---------------------------------------------------------------------------------------------------------------- C++ //code a program for the following the given Instruction. Geometry Calculator 1. Calculate the...
---------------------------------------------------------------------------------------------------------------- C++ //code a program for the following the given Instruction. Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1-4): If the user enters 1, the program should ask for the radius of the circle and then display its area. Use 3.14159 for pi. #03   If the user enters 2, the program should ask for the length and width of...
Consider the example: (1) At CUNY for the same undergraduate course credit foreign students pay a...
Consider the example: (1) At CUNY for the same undergraduate course credit foreign students pay a higher tuition rate than U.S. students. (2) Moreover, undergraduate students pay the same tuition for 15 (or even 18) credits per semester as they do for 12. Find the correct statement about this example. A. One difference between part (1) and part (2) is: (1) unobservable consumer characteristic vs. (2) observable consumer characteristic. B. One difference between part (1) and part (2) is: (1)...
Mathlab Q1. Instruction Text % For loop code: vec = [45, -1, 7, 0, -37, 4,...
Mathlab Q1. Instruction Text % For loop code: vec = [45, -1, 7, 0, -37, 4, -3]; newvec = zeros(1,numel(vec)); % pre-allocate newvec with zeros for idx = 1:numel(vec) if vec(idx) > 1 & vec(idx) < 0 numerator = 3*vec(idx)^3; denominator = 9*vec(idx)^2 + 3; else numerator = 2*vec(idx)^3 - 2*vec(idx); denominator = 2*vec(idx)^2 - 2/vec(idx); end newvec(idx) = numerator/denominator; end
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT