diff --git a/Week2/Codon Count/CodonCount.class b/Week2/Codon Count/CodonCount.class index 6f84168..804d6e0 100644 Binary files a/Week2/Codon Count/CodonCount.class and b/Week2/Codon Count/CodonCount.class differ diff --git a/Week2/Codon Count/CodonCount.ctxt b/Week2/Codon Count/CodonCount.ctxt index 17007ba..d31cde4 100644 --- a/Week2/Codon Count/CodonCount.ctxt +++ b/Week2/Codon Count/CodonCount.ctxt @@ -4,13 +4,10 @@ comment1.params= comment1.target=CodonCount() comment2.params=start\ dna comment2.target=void\ buildCodonMap(int,\ java.lang.String) -comment2.text=\n\ This\ method\ will\ build\ a\ new\ map\ of\ codons\ mapped\ to\ their\ \n\ counts\ from\ the\ string\ dna\ with\ the\ reading\ frame\ with\ the\ position\ \n\ start(\ a\ value\ of\ 0,1\ or\ 2).You\ will\ call\ this\ method\ several\ times,\n\ so\ make\ sure\ your\ map\ is\ emptybefore\ building.\n comment3.params= comment3.target=java.lang.String\ getMostCommonCodon() -comment3.text=\n\ This\ method\ returns\ a\ String,\ the\ codon\ in\ a\ reading\ frame\ that\ \n\ has\ the\ largest\ count.\ If\ there\ are\ several\ such\ codons,return\n\ any\ one\ of\ them.This\ method\ assumes\ the\ HashMap\ of\ codons\ to\n\ counts\ has\ already\ been\ built.\n comment4.params=start\ end comment4.target=void\ printCodonCounts(int,\ int) -comment4.text=Write\ a\ void\ method\ named\ printCodonCounts\ that\ has\ two\ int\ parameters,\nstart\ and\ end.\ This\ method\ prints\ all\ the\ codons\ in\ the\ HashMap\ along\n\ with\ their\ count\ if\ their\ count\ is\ between\ start\ and\ end,\ inclusive\n comment5.params= comment5.target=void\ Test() numComments=6 diff --git a/Week2/Codon Count/CodonCount.java b/Week2/Codon Count/CodonCount.java index b06be73..cf6bab8 100644 --- a/Week2/Codon Count/CodonCount.java +++ b/Week2/Codon Count/CodonCount.java @@ -4,10 +4,14 @@ * Find out how many times each codon occurs in a stand of DNA based on * reading frames. * @author (Aymar N) - * @version (07.03.2019) + * @version (04.01.2023 V2) */ -import edu.duke.*; +//import edu.duke.*; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; +import java.io.FileNotFoundException; import java.util.HashMap; public class CodonCount { @@ -104,8 +108,25 @@ public void printCodonCounts(int start, int end) { public void Test() { //String dna = "CGTTCAAGTTCAA"; - FileResource DNA = new FileResource("dnaMystery1.txt"); - String dna = DNA.asString(); + String s = ""; + String dna = ""; + try(BufferedReader DNA = new BufferedReader(new FileReader("dnaMystery1.txt"));) + { + //FileResource DNA = new FileResource("dnaMystery1.txt"); + while((s = DNA.readLine())!= null){ + dna += s; + } + //String dna = DNA.asString(); + + } + catch(FileNotFoundException e){ + e.printStackTrace(); + } + catch(IOException e){ + e.printStackTrace(); + } + + int start = 1; int end = 5; diff --git a/Week2/Codon Count/README.TXT b/Week2/Codon Count/README.TXT new file mode 100644 index 0000000..7342ea5 --- /dev/null +++ b/Week2/Codon Count/README.TXT @@ -0,0 +1,12 @@ +------------------------------------------------------------------------ +This is the project README file. Here, you should describe your project. +Tell the reader (someone who does not know anything about this project) +all they need to know. The comments should usually include at least: +------------------------------------------------------------------------ + +PROJECT TITLE: +PURPOSE OF PROJECT: +VERSION or DATE: +HOW TO START THIS PROJECT: +AUTHORS: +USER INSTRUCTIONS: diff --git a/Week2/Codon Count/package.bluej b/Week2/Codon Count/package.bluej new file mode 100644 index 0000000..963e55b --- /dev/null +++ b/Week2/Codon Count/package.bluej @@ -0,0 +1,38 @@ +#BlueJ package file +editor.fx.0.height=744 +editor.fx.0.width=1382 +editor.fx.0.x=-8 +editor.fx.0.y=-8 +objectbench.height=93 +objectbench.width=760 +package.divider.horizontal=0.6 +package.divider.vertical=0.8 +package.editor.height=393 +package.editor.width=670 +package.editor.x=260 +package.editor.y=48 +package.frame.height=600 +package.frame.width=800 +package.numDependencies=0 +package.numTargets=2 +package.showExtends=true +package.showUses=true +project.charset=UTF-8 +readme.height=60 +readme.name=@README +readme.width=49 +readme.x=10 +readme.y=10 +target1.height=70 +target1.name=dnaMystery1.txt +target1.type=TextTarget +target1.width=120 +target1.x=10 +target1.y=90 +target2.height=70 +target2.name=CodonCount +target2.showInterface=false +target2.type=ClassTarget +target2.width=120 +target2.x=70 +target2.y=10