From 4511eb73c5de533fd00c8917b5fada6096138305 Mon Sep 17 00:00:00 2001 From: AymarN Date: Sat, 25 Mar 2023 22:20:13 -0400 Subject: [PATCH] Change the fileResource Object --- Week2/Codon Count/CodonCount.class | Bin 3483 -> 4267 bytes Week2/Codon Count/CodonCount.ctxt | 3 --- Week2/Codon Count/CodonCount.java | 29 +++++++++++++++++++--- Week2/Codon Count/README.TXT | 12 +++++++++ Week2/Codon Count/package.bluej | 38 +++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 Week2/Codon Count/README.TXT create mode 100644 Week2/Codon Count/package.bluej diff --git a/Week2/Codon Count/CodonCount.class b/Week2/Codon Count/CodonCount.class index 6f84168d7d7abae714930a1a420581dbb468da3a..804d6e01281ffd92c9f573ece5777eddede017eb 100644 GIT binary patch literal 4267 zcmbVPTXa-c8UA+WOwMFD5E#g<5He6oLkI-0+!7L7(gwyRp(YUsP|3;6N#>BrIbr5Z zAk>!H(i`@owX|5TEo#(yf!YowSc;6f7^RL_;}(5fSveb7!5eAqc@Bq94^6T9Feo5VMK6D4)@FD7sD`cT+aIBVCv|X zl(<|Z7Qw>6B76>ma!Bg1OK<{15z2SN7{SR9(mFCayb!WsRAMxY3Y?O|=?DbQ$k_ur zz7$3c9@Ozr7;A7=$HQUVinC#w^ku2%kqC!#a`{*U0Xz|bhNtB6d;~$9i=Y_ibUdTu zS%H$fJMTIkce9Qsu)O_*Ichd!Jv-H~-^?UC%#kLZ=(YzP)61qUfyTKf_V}cf=?pe> zduiJlY$~9{9M2lG(oHQCRJ_M_Y_CNiP`lxvfY$0JD6+KOcC60qaKDxAG5b@bMB3fB znL22uZMn`9H7{vr1dMiaxlXGzm?9VVXYEu%k!Y+yd2OsfdEOkUOpj;NX-k5P%sn6w z%y?#+n<7T*5{}8)5NA$ym^!*WGd@J|Q|1j?UWc3UTHWDcX$j2{SW&xSUb(iDuufBb z%1jSh8EROZpZPx5@tnZY5qgc{rf?Bvur?NxW(O=MK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2/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