adjust h1 code
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathH1Driver.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathH1Driver.java
index 2ddeb6b..a8e5f7c 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathH1Driver.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathH1Driver.java
@@ -131,7 +131,7 @@
dfs.rename(new Path(outputPath + "/" + complete), new Path(mergeResultPath + "/" + complete));
}
/*----------------------------------------*/
- conf = new JobConf(MergePathH1Driver.class);
+/* conf = new JobConf(MergePathH1Driver.class);
conf.setInt("sizeKmer", sizeKmer);
conf.setInt("iMerge", iMerge);
@@ -169,7 +169,7 @@
JobClient.runJob(conf);
dfs.delete(new Path(inputPath + "-step1"), true);
dfs.rename(new Path(outputPath + "/" + uncomplete), new Path(inputPath + "-step1"));
- dfs.rename(new Path(outputPath + "/" + complete), new Path(mergeResultPath + "/" + complete));
+ dfs.rename(new Path(outputPath + "/" + complete), new Path(mergeResultPath + "/" + complete));*/
}
public static void main(String[] args) throws Exception {
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathMultiSeqOutputFormat.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathMultiSeqOutputFormat.java
index 5ef8b4a..5e8f1d8 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathMultiSeqOutputFormat.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathMultiSeqOutputFormat.java
@@ -15,7 +15,6 @@
package edu.uci.ics.genomix.pathmergingh1;
import java.io.File;
-import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.mapred.lib.MultipleSequenceFileOutputFormat;
import edu.uci.ics.genomix.type.VKmerBytesWritable;
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathValueWritable.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathValueWritable.java
index 0d94227..f14e5f2 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathValueWritable.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/pathmergingh1/MergePathValueWritable.java
@@ -17,12 +17,9 @@
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
-
import org.apache.hadoop.io.BinaryComparable;
import org.apache.hadoop.io.WritableComparable;
-
import edu.uci.ics.genomix.type.GeneCode;
-import edu.uci.ics.genomix.type.KmerBytesWritable;
import edu.uci.ics.genomix.type.VKmerBytesWritable;
public class MergePathValueWritable extends BinaryComparable implements WritableComparable<BinaryComparable> {
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/gbresultschecking/ResultsCheckingTest.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/gbresultschecking/ResultsCheckingTest.java
index d29c160..acca4e7 100644
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/gbresultschecking/ResultsCheckingTest.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/gbresultschecking/ResultsCheckingTest.java
@@ -1,3 +1,17 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package edu.uci.ics.genomix.gbresultschecking;
import java.io.DataOutputStream;
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphbuilding/GraphBuildingTest.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphbuilding/GraphBuildingTest.java
index d329c6a..efd3619 100755
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphbuilding/GraphBuildingTest.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphbuilding/GraphBuildingTest.java
@@ -1,5 +1,3 @@
-package edu.uci.ics.genomix.graphbuilding;
-
/*
* Copyright 2009-2012 by The Regents of the University of California
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,13 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package edu.uci.ics.genomix.graphbuilding;
+
import java.io.BufferedWriter;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
-
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -31,7 +30,6 @@
import org.apache.hadoop.mapred.MiniMRCluster;
import org.apache.hadoop.util.ReflectionUtils;
import org.junit.Test;
-
import edu.uci.ics.genomix.graphbuilding.GenomixDriver;
import edu.uci.ics.genomix.type.GeneCode;
import edu.uci.ics.genomix.type.KmerBytesWritable;
@@ -47,14 +45,14 @@
private static final String COMPARE_DIR = "compare";
private JobConf conf = new JobConf();
private static final String HADOOP_CONF_PATH = ACTUAL_RESULT_DIR + File.separator + "conf.xml";
- private static final String DATA_PATH = "data/webmap/TreePath";
+ private static final String DATA_PATH = "data/webmap/Test.txt";
private static final String HDFS_PATH = "/webmap";
private static final String RESULT_PATH = "/result1";
private static final String EXPECTED_PATH = "expected/result1";
- private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH + "/comparesource.txt";
+ private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH;
private static final int COUNT_REDUCER = 4;
- private static final int SIZE_KMER = 5;
- private static final String GRAPHVIZ = "Graphviz/GenomixSource.txt";
+ private static final int SIZE_KMER = 3;
+ private static final String GRAPHVIZ = "Graphviz";
private MiniDFSCluster dfsCluster;
private MiniMRCluster mrCluster;
@@ -74,13 +72,16 @@
SequenceFile.Reader reader = null;
Path path = new Path(RESULT_PATH + "/part-00000");
reader = new SequenceFile.Reader(dfs, path, conf);
-// KmerBytesWritable key = (KmerBytesWritable) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
KmerBytesWritable key = new KmerBytesWritable(SIZE_KMER);
KmerCountValue value = (KmerCountValue) ReflectionUtils.newInstance(reader.getValueClass(), conf);
File filePathTo = new File(TEST_SOURCE_DIR);
- BufferedWriter bw = new BufferedWriter(new FileWriter(filePathTo));
+ FileUtils.forceMkdir(filePathTo);
+ FileUtils.cleanDirectory(filePathTo);
+ BufferedWriter bw = new BufferedWriter(new FileWriter(new File(TEST_SOURCE_DIR + "/comparesource.txt")));
File GraphViz = new File(GRAPHVIZ);
- BufferedWriter bw2 = new BufferedWriter(new FileWriter(GraphViz));
+ FileUtils.forceMkdir(GraphViz);
+ FileUtils.cleanDirectory(GraphViz);
+ BufferedWriter bw2 = new BufferedWriter(new FileWriter(new File(GRAPHVIZ + "/GenomixSource.txt")));
while (reader.next(key, value)) {
byte succeed = (byte) 0x0F;
@@ -108,7 +109,7 @@
bw.close();
dumpResult();
-// TestUtils.compareWithResult(new File(TEST_SOURCE_DIR), new File(EXPECTED_PATH));
+ TestUtils.compareWithResult(new File(TEST_SOURCE_DIR + "/comparesource.txt"), new File(EXPECTED_PATH));
cleanupHadoop();
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphcountfilter/CountFilterTest.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphcountfilter/CountFilterTest.java
index 6eaced2..bff0179 100644
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphcountfilter/CountFilterTest.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/graphcountfilter/CountFilterTest.java
@@ -1,3 +1,17 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package edu.uci.ics.genomix.graphcountfilter;
import java.io.BufferedWriter;
@@ -6,7 +20,6 @@
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
-
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -18,7 +31,6 @@
import org.apache.hadoop.mapred.MiniMRCluster;
import org.apache.hadoop.util.ReflectionUtils;
import org.junit.Test;
-
import edu.uci.ics.genomix.graphcountfilter.CountFilterDriver;
import edu.uci.ics.genomix.type.KmerBytesWritable;
import edu.uci.ics.genomix.utils.TestUtils;
@@ -34,9 +46,8 @@
private static final String HDFS_PATH = "/webmap";
private static final String RESULT_PATH = "/result2";
private static final String EXPECTED_PATH = "expected/result2";
- private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH + "/comparesource.txt";
+ private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH;
private static final int COUNT_REDUCER = 4;
- private static final int SIZE_KMER = 5;
private MiniDFSCluster dfsCluster;
private MiniMRCluster mrCluster;
private FileSystem dfs;
@@ -58,7 +69,9 @@
KmerBytesWritable key = (KmerBytesWritable) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
ByteWritable value = (ByteWritable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
File filePathTo = new File(TEST_SOURCE_DIR);
- BufferedWriter bw = new BufferedWriter(new FileWriter(filePathTo));
+ FileUtils.forceMkdir(filePathTo);
+ FileUtils.cleanDirectory(filePathTo);
+ BufferedWriter bw = new BufferedWriter(new FileWriter(new File(TEST_SOURCE_DIR + "/comparesource.txt")));
while (reader.next(key, value)) {
bw.write(key.toString() + "\t" + value.toString());
bw.newLine();
@@ -66,7 +79,7 @@
bw.close();
dumpResult();
- TestUtils.compareWithResult(new File(TEST_SOURCE_DIR), new File(EXPECTED_PATH));
+ TestUtils.compareWithResult(new File(TEST_SOURCE_DIR + "/comparesource.txt"), new File(EXPECTED_PATH));
cleanupHadoop();
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh1/MergePathTest.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh1/MergePathTest.java
index c7a1213..109db50 100644
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh1/MergePathTest.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh1/MergePathTest.java
@@ -1,3 +1,17 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package edu.uci.ics.genomix.pathmergingh1;
import java.io.BufferedWriter;
@@ -34,7 +48,7 @@
private static final String RESULT_PATH = "/result3";
private static final String EXPECTED_PATH = "expected/result3";
- private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH + "/comparesource.txt";
+ private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH;
private static final int COUNT_REDUCER = 1;
private static final int SIZE_KMER = 3;
@@ -50,24 +64,24 @@
startHadoop();
MergePathH1Driver tldriver = new MergePathH1Driver();
- tldriver.run(HDFS_PATH, RESULT_PATH, HDFA_PATH_DATA, COUNT_REDUCER, SIZE_KMER, 1, HADOOP_CONF_PATH);
+ tldriver.run(HDFS_PATH, RESULT_PATH, HDFA_PATH_DATA, COUNT_REDUCER, SIZE_KMER, 3, HADOOP_CONF_PATH);
-/* SequenceFile.Reader reader = null;
- Path path = new Path(RESULT_PATH + "/part-00000");
-// Path path = new Path(RESULT_PATH + "/uncomplete0" + "/uncomplete0-r-00000");
+ SequenceFile.Reader reader = null;
+ Path path = new Path(HDFA_PATH_DATA + "/complete2" + "/complete2-r-00000");
reader = new SequenceFile.Reader(dfs, path, conf);
VKmerBytesWritable key = (VKmerBytesWritable) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
MergePathValueWritable value = (MergePathValueWritable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
File filePathTo = new File(TEST_SOURCE_DIR);
- BufferedWriter bw = new BufferedWriter(new FileWriter(filePathTo));
+ FileUtils.forceMkdir(filePathTo);
+ FileUtils.cleanDirectory(filePathTo);
+ BufferedWriter bw = new BufferedWriter(new FileWriter(new File(TEST_SOURCE_DIR + "/comparesource.txt")));
while (reader.next(key, value)) {
bw.write(key.toString() + "\t" + value.getAdjBitMap() + "\t" + value.getFlag());
bw.newLine();
}
- bw.close();*/
- dumpResult();
+ bw.close();
-// TestUtils.compareWithResult(new File(TEST_SOURCE_DIR), new File(EXPECTED_PATH));
+ TestUtils.compareWithResult(new File(TEST_SOURCE_DIR + "/comparesource.txt"), new File(EXPECTED_PATH));
cleanupHadoop();
@@ -99,7 +113,6 @@
}
private void dumpResult() throws IOException {
-// Path src = new Path(HDFA_PATH_DATA + "/" + "complete2");
Path src = new Path(RESULT_PATH);
Path dest = new Path(ACTUAL_RESULT_DIR + "/");
dfs.copyToLocalFile(src, dest);
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh2/MergePathH2Test.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh2/MergePathH2Test.java
index e72c352..7f871bd 100644
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh2/MergePathH2Test.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/pathmergingh2/MergePathH2Test.java
@@ -1,3 +1,17 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package edu.uci.ics.genomix.pathmergingh2;
import java.io.BufferedWriter;
@@ -34,7 +48,7 @@
private static final String RESULT_PATH = "/result4";
private static final String EXPECTED_PATH = "expected/result4";
- private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH + "/comparesource.txt";
+ private static final String TEST_SOURCE_DIR = COMPARE_DIR + RESULT_PATH;
private static final int COUNT_REDUCER = 1;
private static final int SIZE_KMER = 3;
@@ -50,24 +64,24 @@
startHadoop();
MergePathH2Driver tldriver = new MergePathH2Driver();
- tldriver.run(HDFS_PATH, RESULT_PATH, HDFA_PATH_DATA, COUNT_REDUCER, SIZE_KMER, 1, HADOOP_CONF_PATH);
+ tldriver.run(HDFS_PATH, RESULT_PATH, HDFA_PATH_DATA, COUNT_REDUCER, SIZE_KMER, 3, HADOOP_CONF_PATH);
-/* SequenceFile.Reader reader = null;
-// Path path = new Path(RESULT_PATH + "/part-00000");
- Path path = new Path(RESULT_PATH + "/uncomplete0" + "/uncomplete0-r-00000");
+ SequenceFile.Reader reader = null;
+ Path path = new Path(HDFA_PATH_DATA + "/complete2" + "/complete2-r-00000");
reader = new SequenceFile.Reader(dfs, path, conf);
VKmerBytesWritable key = (VKmerBytesWritable) ReflectionUtils.newInstance(reader.getKeyClass(), conf);
MergePathValueWritable value = (MergePathValueWritable) ReflectionUtils.newInstance(reader.getValueClass(), conf);
File filePathTo = new File(TEST_SOURCE_DIR);
- BufferedWriter bw = new BufferedWriter(new FileWriter(filePathTo));
+ FileUtils.forceMkdir(filePathTo);
+ FileUtils.cleanDirectory(filePathTo);
+ BufferedWriter bw = new BufferedWriter(new FileWriter(new File(TEST_SOURCE_DIR + "/comparesource.txt")));
while (reader.next(key, value)) {
bw.write(key.toString() + "\t" + value.getAdjBitMap() + "\t" + value.getFlag());
bw.newLine();
}
- bw.close();*/
-// dumpResult();
+ bw.close();
-// TestUtils.compareWithResult(new File(TEST_SOURCE_DIR), new File(EXPECTED_PATH));
+ TestUtils.compareWithResult(new File(TEST_SOURCE_DIR + "/comparesource.txt"), new File(EXPECTED_PATH));
cleanupHadoop();
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/utils/TestUtils.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/utils/TestUtils.java
index 73a7254..1488907 100755
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/utils/TestUtils.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/utils/TestUtils.java
@@ -1,5 +1,3 @@
-package edu.uci.ics.genomix.utils;
-
/*
* Copyright 2009-2012 by The Regents of the University of California
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package edu.uci.ics.genomix.utils;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;