Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a perl program that has functions defined for the follow: 1. function comp

ID: 3629628 • Letter: W

Question

Write a perl program that has functions defined for the follow:

1. function complement_and_reverse:
Takes a string that consists of any combination of A, G, C, or T and
produces the watson-crick complement. A->C, G->T, and vice versa. The
string is then reversed and that value is returned

2. function create_windows:
Takes a string an integer that defines the window size, and an integer
value that defines a sliding amount. The function will return a list
of strings such that, the initial string is broken into windows defined
by the window size, that shift by the sliding amount.

ex: "ACGCGTGTTA", 4, 2 would return ["ACGC", "GCGT", "GTGT", "GTTA", "TA"]

3. function get_reads:
Takes a string that is a path to a file containing one string per line.
The function will return a list of valid strings contained in the file

(a valid string only contains A, G, C, or T)

4. function write_windows:
Takes a string that is a path to a file and a list of strings (windows).
The function will open a file and write all windows to the file.

5. Finally make a menu that is user driver. it will have an option for each of
these commands.

Explanation / Answer

1)A)Here im taking the string as ACGGGAGGACGGGAAAATTACTACGGCATTAGC

     And printing its reverse compliment.

The program is as follows…

#!/usr/bin/perl -w

# Calculating the reverse complement of a strand of DNA

# The DNA

$DNA = 'ACGGGAGGACGGGAAAATTACTACGGCATTAGC';

# Print the DNA onto the screen

print "Here is the starting DNA: ";

print "$DNA ";

# First, copy the DNA into new variable $revcom

# (short for REVerse COMplement)

# Notice that variable names can use lowercase letters like

# "revcom" as well as uppercase like "DNA". In fact,

#lowercase is more common.

# It doesn't matter if we first reverse the string and then

# do the complementation; or if we first do the complementation

# and then reverse the string. Same result each time.

# So when we make the copy we'll do the reverse in the same statement.

# $revcom = reverse $DNA;

# Next substitute all bases by their complements,

# A->T, T->A, G->C, C->G

#

$revcom =~ s/A/T/g;

$revcom =~ s/T/A/g;

$revcom =~ s/G/C/g;

$revcom =~ s/C/G/g;

# Print the reverse complement DNA onto the screen

print "Here is the reverse complement DNA: ";

print "$revcom ";

$revcom = reverse $DNA;

# See the text for a discussion of tr///

$revcom =~ tr/ACGTacgt/TGCAtgca/;

# Print the reverse complement DNA onto the screen

print "Here is the reverse complement DNA: ";

print "$revcom ";

print " This time it worked! ";

exit;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote