Try to add globe kmerSize but fail in testing
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/oldtype/IntermediateNodeWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/oldtype/IntermediateNodeWritable.java
index 82eb51c..3826f86 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/oldtype/IntermediateNodeWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/oldtype/IntermediateNodeWritable.java
@@ -48,14 +48,6 @@
this.reverseReverseList.set(RRList);
this.nodeId.set(uniqueKey);
}
-
- public void reset(int kmerSize) {
- forwardForwardList.reset();
- forwardReverseList.reset();
- reverseForwardList.reset();
- reverseReverseList.reset();
- nodeId.reset();
- }
public KmerListWritable getFFList() {
return forwardForwardList;
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerListWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerListWritable.java
index eb0bd59..09d353d 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerListWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/KmerListWritable.java
@@ -17,8 +17,8 @@
protected byte[] storage;
protected int offset;
protected int valueCount;
- public int kmerByteSize = 0;
- public int kmerlength = 0;
+ public int kmerByteSize = 2;
+ public int kmerlength = 5;
protected static final byte[] EMPTY = {};
protected KmerBytesWritable posIter = new KmerBytesWritable();
@@ -160,8 +160,8 @@
@Override
public void readFields(DataInput in) throws IOException {
this.valueCount = in.readInt();
- setSize(valueCount * kmerByteSize);
- in.readFully(storage, offset, valueCount * kmerByteSize);
+ setSize(valueCount * kmerByteSize);//kmerByteSize
+ in.readFully(storage, offset, valueCount * kmerByteSize);//kmerByteSize
}
@Override
diff --git a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java
index 4725e30..76a6171 100644
--- a/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java
+++ b/genomix/genomix-data/src/main/java/edu/uci/ics/genomix/type/NodeWritable.java
@@ -154,7 +154,7 @@
// out.writeByte(kmerMark);
// this.nodeIdList.write(out);
this.forwardForwardList.write(out);
- this.forwardReverseList.write(out);
+// this.forwardReverseList.write(out);
// this.reverseForwardList.write(out);
// this.reverseReverseList.write(out);
// if(kmerMark == KMER.EXIST)
@@ -166,7 +166,7 @@
// kmerMark = in.readByte();
// this.nodeIdList.readFields(in);
this.forwardForwardList.readFields(in);
- this.forwardReverseList.readFields(in);
+// this.forwardReverseList.readFields(in);
// this.reverseForwardList.readFields(in);
// this.reverseReverseList.readFields(in);
// if(kmerMark == KMER.EXIST)
diff --git a/genomix/genomix-data/src/test/java/edu/uci/ics/genomix/data/test/KmerListWritableTest.java b/genomix/genomix-data/src/test/java/edu/uci/ics/genomix/data/test/KmerListWritableTest.java
index 71246a1..1bbb771 100644
--- a/genomix/genomix-data/src/test/java/edu/uci/ics/genomix/data/test/KmerListWritableTest.java
+++ b/genomix/genomix-data/src/test/java/edu/uci/ics/genomix/data/test/KmerListWritableTest.java
@@ -30,7 +30,7 @@
Assert.assertEquals(1, kmerList.getCountOfPosition());
}
- kmerList.reset(kmer.getKmerLength());
+ kmerList.reset(0);
//add one more kmer each time and fix kmerSize
for (int i = 0; i < 200; i++) {
kmer = new KmerBytesWritable(5);
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GenomixReducer.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GenomixReducer.java
index 6472f05..e877504 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GenomixReducer.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GenomixReducer.java
@@ -3,6 +3,7 @@
import java.io.IOException;
import java.util.Iterator;
+import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reducer;
@@ -15,13 +16,22 @@
public class GenomixReducer extends MapReduceBase implements
Reducer<KmerBytesWritable, NodeWritable, KmerBytesWritable, NodeWritable>{
- private NodeWritable outputNode = new NodeWritable();
- private NodeWritable tmpNode = new NodeWritable();
+ public static int KMER_SIZE;
+ private NodeWritable outputNode;
+ private NodeWritable tmpNode;
+
+ @Override
+ public void configure(JobConf job) {
+ KMER_SIZE = GenomixMapper.KMER_SIZE;
+ outputNode = new NodeWritable(KMER_SIZE);
+ tmpNode = new NodeWritable(KMER_SIZE);
+ }
+
@Override
public void reduce(KmerBytesWritable key, Iterator<NodeWritable> values,
OutputCollector<KmerBytesWritable, NodeWritable> output,
Reporter reporter) throws IOException {
- outputNode.reset(0);
+ outputNode.reset(KMER_SIZE);
// //copy first item to outputNode
// if(values.hasNext()){
diff --git a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTest.java b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTest.java
index 4716072..797efb2 100644
--- a/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTest.java
+++ b/genomix/genomix-hadoop/src/test/java/edu/uci/ics/genomix/hadoop/contrailgraphbuilding/GraphBuildingTest.java
@@ -45,7 +45,7 @@
public void TestMapKmerToNode() throws Exception {
GenomixDriver driver = new GenomixDriver();
- driver.run(HDFS_PATH, RESULT_PATH, 0, SIZE_KMER, READ_LENGTH, true, HADOOP_CONF_PATH);
+ driver.run(HDFS_PATH, RESULT_PATH, 1, SIZE_KMER, READ_LENGTH, true, HADOOP_CONF_PATH);
dumpResult();
}
@@ -77,6 +77,6 @@
Path src = new Path(RESULT_PATH);
Path dest = new Path(ACTUAL_RESULT_DIR);
dfs.copyToLocalFile(src, dest);
- HadoopMiniClusterTest.copyResultsToLocal(RESULT_PATH, "test.txt", false, conf, true, dfs);
+ HadoopMiniClusterTest.copyResultsToLocal(RESULT_PATH, "actual/test.txt", false, conf, true, dfs);
}
}