Reverse Complement DNA - Introduction to Computing Using MATLAB | CS 1112, Assignments of Computer Science

Material Type: Assignment; Professor: Fan; Class: Introduction to Computing Using MATLAB; Subject: Computer Science; University: Cornell University; Term: Fall 2008;

Typology: Assignments

Pre 2010

Uploaded on 08/31/2009

koofers-user-o3y
koofers-user-o3y 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS100M Section Exercise 9
1 Reverse complement
In the DNA double helix, two strands twist together and “face” each other. The two strands are reverse-
complementary, i.e., reading one strand in reverse order and exchanging each base with its complement gives the
other strand. A and T are complementary; C and G are complementary.
For example, given the DNA sequence
AGTAGCAT
the reverse sequence is
TACGATGA
so the reverse complement is
ATGCTACT
Write a function rComplement(dna) to return the reverse complement of a DNA strand. Use a loop to reverse
the strand—do not use vectorized code. Assume that dna contains only the letters ’A’, ’T’, ’C’, and ’G’.
2 Counting a DNA pattern
Write a function countPattern(dna,p) to find out (and return) how many times a pattern poccurs in dna.
Assume both parameters to be strings that contain the letters ’A’, ’T’, ’C’, and ’G’ only. Note that if pis longer
than dna, then pappears in dna zero times. Use the built-in function strcmp to compare two strings. Again,
use a loop to solve this problem
3 Counting a DNA pattern—challenge edition!
Rewrite the function countPattern(dna,p) without using the strcmp function.
1

Partial preview of the text

Download Reverse Complement DNA - Introduction to Computing Using MATLAB | CS 1112 and more Assignments Computer Science in PDF only on Docsity!

CS100M Section Exercise 9

1 Reverse complement

In the DNA double helix, two strands twist together and “face” each other. The two strands are reverse- complementary, i.e., reading one strand in reverse order and exchanging each base with its complement gives the other strand. A and T are complementary; C and G are complementary.

For example, given the DNA sequence

AGTAGCAT

the reverse sequence is

TACGATGA

so the reverse complement is

ATGCTACT

Write a function rComplement(dna) to return the reverse complement of a DNA strand. Use a loop to reverse the strand—do not use vectorized code. Assume that dna contains only the letters ’A’, ’T’, ’C’, and ’G’.

2 Counting a DNA pattern

Write a function countPattern(dna,p) to find out (and return) how many times a pattern p occurs in dna. Assume both parameters to be strings that contain the letters ’A’, ’T’, ’C’, and ’G’ only. Note that if p is longer than dna, then p appears in dna zero times. Use the built-in function strcmp to compare two strings. Again, use a loop to solve this problem

3 Counting a DNA pattern—challenge edition!

Rewrite the function countPattern(dna,p) without using the strcmp function.