Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Week2/Codon Count/CodonCount.class
Binary file not shown.
3 changes: 0 additions & 3 deletions Week2/Codon Count/CodonCount.ctxt
Original file line number Diff line number Diff line change
Expand Up @@ -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
29 changes: 25 additions & 4 deletions Week2/Codon Count/CodonCount.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;

Expand Down
12 changes: 12 additions & 0 deletions Week2/Codon Count/README.TXT
Original file line number Diff line number Diff line change
@@ -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:
38 changes: 38 additions & 0 deletions Week2/Codon Count/package.bluej
Original file line number Diff line number Diff line change
@@ -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