Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

GenesCount / Do not add any imports. / / ( You shouldn't need any, and you'll fail the autograder if you do . ) import

GenesCount
/ Do not add any imports.
//(You shouldn't need any, and you'll fail the autograder if you do.)
import input.InputGenerator;
import input.FileCharGenerator;
import input.AlternatingCharGenerator;
import ods.ArrayDeque;
import ods.ArrayQueue;
import ods.ArrayStack;
import ods.RootishArrayStack;
import ods.SLList;
import ods.DLList;
import ods.SEList;
import ods.SkiplistList;
import ods.SkiplistSSet;
import ods.BinaryTree;
import ods.BinarySearchTree;
import ods.Treap;
import ods.ScapegoatTree;
import ods.SSet;
import ods.RedBlackTree;
import ods.MultiplicativeHashSet;
import java.util.ListIterator;
import java.util.Iterator;
import java.util.AbstractSet;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Collections;
import java.util.Comparator;
import java.util.AbstractList;
import java.util.Map;
public class GenesCount {
public static AbstractList genesCount(InputGenerator gen, int k){
// TODO(student): Your code goes here
while( gen.hasNext()){// This loops through the entire input
Character c = gen.next();
}
return null;
}
// These are a few examples of how to use the InputGenerator to run local tests
// You should test more extensively than this.
public static void main(String[] args ){
System.out.println("Testing genesCount() via GenesCount.main...");
System.out.println("These are limited local tests; please add more tests of your own!");
System.out.println("You should also try testing via tests/GenesCountTest.java");
InputGenerator gen = new FileCharGenerator();
// The following tests genes using the chars in the
// file samples/genes-sample.txt, up to the first newline.
gen = new FileCharGenerator( "samples/genesCount-sample.txt");
System.out.println( "Expect \t[ACG, UAC, AUC, CCU, CGA, CUA, GAU, UCC]:
\t"+ genesCount(gen,3)); // Expect [ACG, AUC, CCU, CGA, CUA, GAU, UAC, UCC]
// If you want to test via the command-line, i.e. if you want to input a stream of
// characters of your own devising and then run genesCount once you hit 'Enter', then
// uncomment the next three lines.
//gen = new FileCharGenerator();
//System.out.println( "Enter a sequence of characters, then hit Enter to run genesCount(gen,3):");
//System.out.println( "Your result is: "+ genesCount(gen,3));
// The following tests use a generate that alternates between the characters listed in the
// options array. The second argument is the number of characters to generate.
char[] options ={'A','U','C','G'};
gen = new AlternatingCharGenerator(options,12); // Generates AUCGAUCGAUCG
System.out.println( "Expect [AUCG, CGAU, GAUC, UCGA]: "+ genesCount(gen,4)); // Expect [AUCG, CGAU, GAUC, UCGA]
gen = new AlternatingCharGenerator(options,10, true); // Generates AUCGAUCGAU -- uses true to store what was generated
System.out.println( "Expect [AUCGAUCGA, UCGAUCGAU]: "+ genesCount(gen,9)); // Expect [AUCGAUCGA, UCGAUCGAU]
gen = new AlternatingCharGenerator(options,11, true); // Generates AUCGAUCGAUC -- uses true to store what was generated
System.out.println( "Expect [AUC, CGA, GAU, UCG]: "+ genesCount(gen,3)); // Expect [AUC, CGA, GAU, UCG]
gen = new AlternatingCharGenerator(options,11, true); // Generates AUCGAUCGAUC -- uses true to store what was generated
System.out.println( "Expect [A, C, U, G]: "+ genesCount(gen,1)); // Expect [A, C, U, G]
gen = new AlternatingCharGenerator(options,11, true); // Generates AUCGAUCGAUC -- uses true to store what was generated
System.out.println( "Expect []: "+ genesCount(gen,12)); // Expect []
}
}
image text in transcribed

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

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago