import java.io.EOFException; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.BufferedReader; import java.io.PrintStream; import java.io.File; import java.util.Vector; public class Unique { byte[][] count; int[] nucNum; // table for converting nucleotide to number int[] compNum; // table for converting complement nucleotide to number int[] primeNumbers; int max; int window = 20; // must be 20 int trial; // number of prime numbers; int type; long magic; int maxSize; int[] binomial; long index; long reverseIndex; Vector inputFile; Vector outputFile; public static void main(String[] args) throws IOException{ long millis = System.currentTimeMillis(); Unique unique = new Unique(); boolean succeed = unique.setFileNames(args); if( !succeed ){ unique.Usage(); System.exit(0); } System.out.print("Prime: "); System.out.println(unique.primeNumbers[0]); // 1st path ... counting occurrences for(int i=0;i(); outputFile = new Vector(); trial = 1; // number of prime numbers max = 322122539; // the largest prime number we can use primeNumbers = new int[trial]; primeNumbers[0]=max;// default; } public void resetIndex(){ index = reverseIndex = 0; // initialize } public void put(String seq) throws NullPointerException{ // put sequence and count unique words //check the data if ( seq==null ) throw new NullPointerException(); // no data if ( seq.length()==0 ) return; // no data if ( seq.charAt(0)=='>') return ; // title //work int tag = 0; // for calculation for(int i=0;i') ) { return seq; // title } //work StringBuffer result = new StringBuffer(); int tag=0; for(int i=0;i1) multiple++; // count hash collision //reverse tag = (int) (reverse % primeNumbers[k]); // residue if(count[k][tag]>1) multiple++; // count hash collision } binomial[multiple]++; } // if(isUnique) System.out.print(Character.toUpperCase(c)); // else System.out.print(Character.toLowerCase(c)); if(isUnique) result.append(Character.toUpperCase(c)); else result.append(Character.toLowerCase(c)); } // System.out.println(); return result.toString(); } public long index(char c){ index *= type; // shift index += nucNum[c]; index %= magic; return index; } public long reverseIndex(char c){ reverseIndex += magic * compNum[c]; reverseIndex /= type; return reverseIndex; } public boolean setFileNames(String[] args){ boolean success = false; if(args.length==0) return false; // no data int input = 1; int inputDir = 2; int outputDir = 3; int maxNumber = 4; int primeNumber = 5; int argState = input; //default String inputPath = System.getProperty("user.dir"); // current dir String outputPath = "output"; Vector fileList = new Vector(); for(int i=0;i2;i--){ if(c[i]==0) { // prime number if(n