Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java file help Please use the Sequence class to design a subclass calledProtein, and override the validSeq() to validate a protein sequence instead of DNA

Java file help

Please use the Sequence class to design a subclass calledProtein, and override the validSeq() to validate a protein sequence instead of DNA sequence. Please reply with the implemented class Protein.class file, and write a test class to test the validSeq() method,

(Sequence.java) file import java.util.regex.Pattern; public class Sequence { //define properties of the sequence class //id -- sequence identifier //type -- type of sequence, DNA, RNA, or Protein //seq -- the sequence private String id; private String type; private String seq; public Sequence(){} public Sequence(String id, String seq){ this.id = id; this.seq = seq; } public Sequence(String id, String type, String seq){ this.id = id; this.type = type; this.seq = seq; } public void setID(String id){ this.id = id; } public String getID(){ return id; } public void setType(String type){ this.type = type; } public String getType(){ return type; } public void setSeq(String seq){ this.seq = seq; } public String getSeq(){ return seq; } public int getSize(){ return seq.length(); } // break a long sequence into chunks public String formatSeq(int len){ String formatedSeq = ""; while (seq.length()> len){ formatedSeq += seq.substring(0, len) + " "; seq = seq.substring(len); } // add the remaining part if (seq.length()>0){ formatedSeq += seq; } return formatedSeq; } public int baseCount(char b) { int count = 0; for (int i= 0; i%s|%s %s ", id, type, seq); } // method for DNA sequence validation public boolean validSeq(){ return Pattern.matches("[ATCG]+", seq); } } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions