Part 1: Create a Matlab script hw7_1.m that prompts the user for two DNA sequenc
ID: 3599538 • Letter: P
Question
Part 1: Create a Matlab script hw7_1.m that prompts the user for two DNA sequence strings and scores an alignment. • Each A or T match contributes a value of +2 • Each C or G match contributes a value of +3 • Each mismatch or Gap contributes a score of -2 You can assume the input will be valid (only DNA bases) and the sequences will be at most 99 bases in length. For example, two sequences and their corresponding score would be:
Sequence 1: ATGCTGACTGCA
Sequence 2: CTTGAGACG---
A/T score = 2* 2= +4
G/C score = 2* 3= +6
Mismatches + GAPs = 8*-2= -16
Score = -6
Part 2: Create a Matlab script hw7_2.m (Copy and modify part 1). The second program will additionally access if each DNA sequence could be a coding strand for a protein (assume no introns). Scan each sequence (in both forward and reverse directions in all 3 reading frames) to determine if there is at least one start codon (i.e. the coding strand DNA must contain “ATG”, which is transcribed to the RNA start codon “AUG”) with an in frame stop codon (i.e. the coding strand DNA must contain “TAA”, “TAG” or “TGA”, which are transcribed to the RNA stop codons “UAA”, “UAG” or “UGA”, respectively). The output for each sequence should simply be a message that the sequence does or does not code for a protein. If the sequence does, report the number of amino acids in the translated protein.
Explanation / Answer
package com;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.JPanel;
public class Graph extends JPanel {
public Graph() {
setSize(500, 500);
}
@Override
public void paintComponent(Graphics g) {
Graphics2D gr = (Graphics2D) g; // This is if you want to use Graphics2D
// Now do the drawing here
ArrayList<Integer> scores = new ArrayList<Integer>(10);
Random r = new Random();
for (int i : scores) {
i = r.nextInt(20);
System.out.println(r);
}
int y1;
int y2;
for (int i = 0; i < scores.size() - 1; i++) {
y1 = (scores.get(i)) * 10;
y2 = (scores.get(i + 1)) * 10;
gr.drawLine(i * 10, y1, (i + 1) * 10, y2);
}
}
}