start to change graph clean part to 'contrail-graph' structure
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 3349aaf..de27f30 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
@@ -98,6 +98,10 @@
}
}
+ public void reset() {
+ this.reset(0);
+ }
+
public void reset(int kmerSize) {
kmerlength = kmerSize;
kmerByteSize = KmerUtil.getByteNumFromK(kmerlength);
@@ -156,6 +160,26 @@
};
return it;
}
+
+ /*
+ * remove the first instance of @toRemove. Uses a linear scan. Throws an exception if not in this list.
+ */
+ public void remove(KmerBytesWritable toRemove, boolean ignoreMissing) {
+ Iterator<KmerBytesWritable> posIterator = this.iterator();
+ while (posIterator.hasNext()) {
+ if(toRemove.equals(posIterator.next())) {
+ posIterator.remove();
+ return;
+ }
+ }
+ if (!ignoreMissing) {
+ throw new ArrayIndexOutOfBoundsException("the KmerBytesWritable `" + toRemove.toString() + "` was not found in this list.");
+ }
+ }
+
+ public void remove(KmerBytesWritable toRemove) {
+ remove(toRemove, false);
+ }
@Override
public void readFields(DataInput in) throws IOException {
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexInputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexInputFormat.java
index 2f66bbc..396d5ec 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexInputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexInputFormat.java
@@ -13,8 +13,8 @@
import edu.uci.ics.pregelix.api.io.VertexInputFormat;
import edu.uci.ics.pregelix.api.io.VertexReader;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
+import edu.uci.ics.genomix.type.KmerBytesWritable;
public class BinaryDataCleanVertexInputFormat<I extends WritableComparable<?>, V extends Writable, E extends Writable, M extends Writable>
extends VertexInputFormat<I, V, E, M> {
@@ -38,7 +38,7 @@
public static abstract class BinaryDataCleanVertexReader<I extends WritableComparable<?>, V extends Writable, E extends Writable, M extends Writable>
implements VertexReader<I, V, E, M> {
/** Internal line record reader */
- private final RecordReader<PositionWritable, VertexValueWritable> lineRecordReader;
+ private final RecordReader<KmerBytesWritable, VertexValueWritable> lineRecordReader;
/** Context passed to initialize */
private TaskAttemptContext context;
@@ -48,7 +48,7 @@
* @param recordReader
* Line record reader from SequenceFileInputFormat
*/
- public BinaryDataCleanVertexReader(RecordReader<PositionWritable, VertexValueWritable> recordReader) {
+ public BinaryDataCleanVertexReader(RecordReader<KmerBytesWritable, VertexValueWritable> recordReader) {
this.lineRecordReader = recordReader;
}
@@ -74,7 +74,7 @@
*
* @return Record reader to be used for reading.
*/
- protected RecordReader<PositionWritable, VertexValueWritable> getRecordReader() {
+ protected RecordReader<KmerBytesWritable, VertexValueWritable> getRecordReader() {
return lineRecordReader;
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexOutputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexOutputFormat.java
index c23ceeb..c07d076 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexOutputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryDataCleanVertexOutputFormat.java
@@ -10,8 +10,8 @@
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
+import edu.uci.ics.genomix.type.KmerBytesWritable;
import edu.uci.ics.pregelix.api.io.VertexOutputFormat;
import edu.uci.ics.pregelix.api.io.VertexWriter;
@@ -49,7 +49,7 @@
/** Context passed to initialize */
private TaskAttemptContext context;
/** Internal line record writer */
- private final RecordWriter<PositionWritable, VertexValueWritable> lineRecordWriter;
+ private final RecordWriter<KmerBytesWritable, VertexValueWritable> lineRecordWriter;
/**
* Initialize with the LineRecordWriter.
@@ -57,7 +57,7 @@
* @param lineRecordWriter
* Line record writer from SequenceFileOutputFormat
*/
- public BinaryVertexWriter(RecordWriter<PositionWritable, VertexValueWritable> lineRecordWriter) {
+ public BinaryVertexWriter(RecordWriter<KmerBytesWritable, VertexValueWritable> lineRecordWriter) {
this.lineRecordWriter = lineRecordWriter;
}
@@ -76,7 +76,7 @@
*
* @return Record writer to be used for writing.
*/
- public RecordWriter<PositionWritable, VertexValueWritable> getRecordWriter() {
+ public RecordWriter<KmerBytesWritable, VertexValueWritable> getRecordWriter() {
return lineRecordWriter;
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryVertexOutputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryVertexOutputFormat.java
deleted file mode 100644
index a147e2f..0000000
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryVertexOutputFormat.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package edu.uci.ics.genomix.pregelix.api.io.binary;
-
-import java.io.IOException;
-
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.io.WritableComparable;
-import org.apache.hadoop.mapreduce.JobContext;
-import org.apache.hadoop.mapreduce.OutputCommitter;
-import org.apache.hadoop.mapreduce.RecordWriter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
-
-import edu.uci.ics.genomix.oldtype.NodeWritable;
-import edu.uci.ics.pregelix.api.io.VertexOutputFormat;
-import edu.uci.ics.pregelix.api.io.VertexWriter;
-
-/**
- * Abstract class that users should subclass to use their own text based vertex
- * output format.
- *
- * @param <I>
- * Vertex index value
- * @param <V>
- * Vertex value
- * @param <E>
- * Edge value
- */
-@SuppressWarnings("rawtypes")
-public abstract class BinaryVertexOutputFormat<I extends WritableComparable, V extends Writable, E extends Writable>
- extends VertexOutputFormat<I, V, E> {
- /** Uses the SequenceFileOutputFormat to do everything */
- protected SequenceFileOutputFormat binaryOutputFormat = new SequenceFileOutputFormat();
-
- /**
- * Abstract class to be implemented by the user based on their specific
- * vertex output. Easiest to ignore the key value separator and only use key
- * instead.
- *
- * @param <I>
- * Vertex index value
- * @param <V>
- * Vertex value
- * @param <E>
- * Edge value
- */
- public static abstract class BinaryVertexWriter<I extends WritableComparable, V extends Writable, E extends Writable>
- implements VertexWriter<I, V, E> {
- /** Context passed to initialize */
- private TaskAttemptContext context;
- /** Internal line record writer */
- private final RecordWriter<NodeWritable, NullWritable> lineRecordWriter;
-
- /**
- * Initialize with the LineRecordWriter.
- *
- * @param lineRecordWriter
- * Line record writer from SequenceFileOutputFormat
- */
- public BinaryVertexWriter(RecordWriter<NodeWritable, NullWritable> lineRecordWriter) {
- this.lineRecordWriter = lineRecordWriter;
- }
-
- @Override
- public void initialize(TaskAttemptContext context) throws IOException {
- this.context = context;
- }
-
- @Override
- public void close(TaskAttemptContext context) throws IOException, InterruptedException {
- lineRecordWriter.close(context);
- }
-
- /**
- * Get the line record writer.
- *
- * @return Record writer to be used for writing.
- */
- public RecordWriter<NodeWritable, NullWritable> getRecordWriter() {
- return lineRecordWriter;
- }
-
- /**
- * Get the context.
- *
- * @return Context passed to initialize.
- */
- public TaskAttemptContext getContext() {
- return context;
- }
- }
-
- @Override
- public void checkOutputSpecs(JobContext context) throws IOException, InterruptedException {
- binaryOutputFormat.checkOutputSpecs(context);
- }
-
- @Override
- public OutputCommitter getOutputCommitter(TaskAttemptContext context) throws IOException, InterruptedException {
- return binaryOutputFormat.getOutputCommitter(context);
- }
-}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryVertexInputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/InitialGraphCleanVertexInputFormat.java
similarity index 86%
rename from genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryVertexInputFormat.java
rename to genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/InitialGraphCleanVertexInputFormat.java
index f9a3068..d6be23b 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/BinaryVertexInputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/api/io/binary/InitialGraphCleanVertexInputFormat.java
@@ -3,7 +3,6 @@
import java.io.IOException;
import java.util.List;
-import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.mapreduce.InputSplit;
@@ -14,9 +13,10 @@
import edu.uci.ics.pregelix.api.io.VertexInputFormat;
import edu.uci.ics.pregelix.api.io.VertexReader;
-import edu.uci.ics.genomix.oldtype.NodeWritable;
+import edu.uci.ics.genomix.type.NodeWritable;
+import edu.uci.ics.genomix.type.KmerBytesWritable;
-public class BinaryVertexInputFormat<I extends WritableComparable<?>, V extends Writable, E extends Writable, M extends Writable>
+public class InitialGraphCleanVertexInputFormat<I extends WritableComparable<?>, V extends Writable, E extends Writable, M extends Writable>
extends VertexInputFormat<I, V, E, M> {
/** Uses the SequenceFileInputFormat to do everything */
@@ -38,7 +38,7 @@
public static abstract class BinaryVertexReader<I extends WritableComparable<?>, V extends Writable, E extends Writable, M extends Writable>
implements VertexReader<I, V, E, M> {
/** Internal line record reader */
- private final RecordReader<NodeWritable, NullWritable> lineRecordReader;
+ private final RecordReader<KmerBytesWritable, NodeWritable> lineRecordReader;
/** Context passed to initialize */
private TaskAttemptContext context;
@@ -48,7 +48,7 @@
* @param recordReader
* Line record reader from SequenceFileInputFormat
*/
- public BinaryVertexReader(RecordReader<NodeWritable, NullWritable> recordReader) {
+ public BinaryVertexReader(RecordReader<KmerBytesWritable, NodeWritable> recordReader) {
this.lineRecordReader = recordReader;
}
@@ -74,7 +74,7 @@
*
* @return Record reader to be used for reading.
*/
- protected RecordReader<NodeWritable, NullWritable> getRecordReader() {
+ protected RecordReader<KmerBytesWritable, NodeWritable> getRecordReader() {
return lineRecordReader;
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanInputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanInputFormat.java
index 23a53f9..1d7bf4b 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanInputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanInputFormat.java
@@ -10,20 +10,20 @@
import edu.uci.ics.pregelix.api.graph.Vertex;
import edu.uci.ics.pregelix.api.io.VertexReader;
import edu.uci.ics.pregelix.api.util.BspUtils;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
import edu.uci.ics.genomix.pregelix.io.MessageWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryDataCleanVertexInputFormat;
import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryDataCleanVertexInputFormat.BinaryDataCleanVertexReader;
+import edu.uci.ics.genomix.type.KmerBytesWritable;
public class DataCleanInputFormat extends
- BinaryDataCleanVertexInputFormat<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> {
+ BinaryDataCleanVertexInputFormat<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> {
/**
* Format INPUT
*/
@SuppressWarnings("unchecked")
@Override
- public VertexReader<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> createVertexReader(
+ public VertexReader<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> createVertexReader(
InputSplit split, TaskAttemptContext context) throws IOException {
return new BinaryDataCleanLoadGraphReader(binaryInputFormat.createRecordReader(split, context));
}
@@ -31,12 +31,12 @@
@SuppressWarnings("rawtypes")
class BinaryDataCleanLoadGraphReader extends
- BinaryDataCleanVertexReader<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> {
+ BinaryDataCleanVertexReader<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> {
private Vertex vertex;
- private PositionWritable vertexId = new PositionWritable();
+ private KmerBytesWritable vertexId = new KmerBytesWritable();
private VertexValueWritable vertexValue = new VertexValueWritable();
- public BinaryDataCleanLoadGraphReader(RecordReader<PositionWritable, VertexValueWritable> recordReader) {
+ public BinaryDataCleanLoadGraphReader(RecordReader<KmerBytesWritable, VertexValueWritable> recordReader) {
super(recordReader);
}
@@ -47,7 +47,7 @@
@SuppressWarnings("unchecked")
@Override
- public Vertex<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> getCurrentVertex()
+ public Vertex<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> getCurrentVertex()
throws IOException, InterruptedException {
if (vertex == null)
vertex = (Vertex) BspUtils.createVertex(getContext().getConfiguration());
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanOutputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanOutputFormat.java
index 11606db..cbbdd9a 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanOutputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/DataCleanOutputFormat.java
@@ -6,20 +6,20 @@
import org.apache.hadoop.mapreduce.RecordWriter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryDataCleanVertexOutputFormat;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
+import edu.uci.ics.genomix.type.KmerBytesWritable;
import edu.uci.ics.pregelix.api.graph.Vertex;
import edu.uci.ics.pregelix.api.io.VertexWriter;
public class DataCleanOutputFormat extends
- BinaryDataCleanVertexOutputFormat<PositionWritable, VertexValueWritable, NullWritable> {
+ BinaryDataCleanVertexOutputFormat<KmerBytesWritable, VertexValueWritable, NullWritable> {
@Override
- public VertexWriter<PositionWritable, VertexValueWritable, NullWritable> createVertexWriter(
+ public VertexWriter<KmerBytesWritable, VertexValueWritable, NullWritable> createVertexWriter(
TaskAttemptContext context) throws IOException, InterruptedException {
@SuppressWarnings("unchecked")
- RecordWriter<PositionWritable, VertexValueWritable> recordWriter = binaryOutputFormat.getRecordWriter(context);
+ RecordWriter<KmerBytesWritable, VertexValueWritable> recordWriter = binaryOutputFormat.getRecordWriter(context);
return new BinaryLoadGraphVertexWriter(recordWriter);
}
@@ -27,15 +27,14 @@
* Simple VertexWriter that supports {@link BinaryLoadGraphVertex}
*/
public static class BinaryLoadGraphVertexWriter extends
- BinaryVertexWriter<PositionWritable, VertexValueWritable, NullWritable> {
- public BinaryLoadGraphVertexWriter(RecordWriter<PositionWritable, VertexValueWritable> lineRecordWriter) {
+ BinaryVertexWriter<KmerBytesWritable, VertexValueWritable, NullWritable> {
+ public BinaryLoadGraphVertexWriter(RecordWriter<KmerBytesWritable, VertexValueWritable> lineRecordWriter) {
super(lineRecordWriter);
}
@Override
- public void writeVertex(Vertex<PositionWritable, VertexValueWritable, NullWritable, ?> vertex)
+ public void writeVertex(Vertex<KmerBytesWritable, VertexValueWritable, NullWritable, ?> vertex)
throws IOException, InterruptedException {
- //if(vertex.getVertexValue().getState() != MessageFlag.IS_OLDHEAD)
getRecordWriter().write(vertex.getVertexId(), vertex.getVertexValue());
}
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/NaiveAlgorithmForPathMergeInputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/InitialGraphCleanInputFormat.java
similarity index 64%
rename from genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/NaiveAlgorithmForPathMergeInputFormat.java
rename to genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/InitialGraphCleanInputFormat.java
index 93781a6..db751a5 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/NaiveAlgorithmForPathMergeInputFormat.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/InitialGraphCleanInputFormat.java
@@ -10,22 +10,22 @@
import edu.uci.ics.pregelix.api.graph.Vertex;
import edu.uci.ics.pregelix.api.io.VertexReader;
import edu.uci.ics.pregelix.api.util.BspUtils;
-import edu.uci.ics.genomix.oldtype.NodeWritable;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
+import edu.uci.ics.genomix.type.NodeWritable;
import edu.uci.ics.genomix.pregelix.io.MessageWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable.State;
-import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryVertexInputFormat;
-import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryVertexInputFormat.BinaryVertexReader;
+import edu.uci.ics.genomix.pregelix.api.io.binary.InitialGraphCleanVertexInputFormat;
+import edu.uci.ics.genomix.pregelix.api.io.binary.InitialGraphCleanVertexInputFormat.BinaryVertexReader;
+import edu.uci.ics.genomix.type.KmerBytesWritable;
-public class NaiveAlgorithmForPathMergeInputFormat extends
- BinaryVertexInputFormat<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> {
+public class InitialGraphCleanInputFormat extends
+ InitialGraphCleanVertexInputFormat<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> {
/**
* Format INPUT
*/
@SuppressWarnings("unchecked")
@Override
- public VertexReader<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> createVertexReader(
+ public VertexReader<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> createVertexReader(
InputSplit split, TaskAttemptContext context) throws IOException {
return new BinaryLoadGraphReader(binaryInputFormat.createRecordReader(split, context));
}
@@ -33,13 +33,14 @@
@SuppressWarnings("rawtypes")
class BinaryLoadGraphReader extends
- BinaryVertexReader<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> {
+ BinaryVertexReader<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> {
+
private Vertex vertex;
+ private KmerBytesWritable vertexId = new KmerBytesWritable();
private NodeWritable node = new NodeWritable();
- private PositionWritable vertexId = new PositionWritable();
private VertexValueWritable vertexValue = new VertexValueWritable();
- public BinaryLoadGraphReader(RecordReader<NodeWritable, NullWritable> recordReader) {
+ public BinaryLoadGraphReader(RecordReader<KmerBytesWritable, NodeWritable> recordReader) {
super(recordReader);
}
@@ -50,34 +51,35 @@
@SuppressWarnings("unchecked")
@Override
- public Vertex<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> getCurrentVertex()
+ public Vertex<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> getCurrentVertex()
throws IOException, InterruptedException {
if (vertex == null)
vertex = (Vertex) BspUtils.createVertex(getContext().getConfiguration());
-
+
vertex.getMsgList().clear();
vertex.getEdges().clear();
-
+
vertex.reset();
if (getRecordReader() != null) {
/**
* set the src vertex id
*/
- node = getRecordReader().getCurrentKey();
- vertexId.set(node.getNodeID());
+ vertexId.set(getRecordReader().getCurrentKey());
vertex.setVertexId(vertexId);
/**
* set the vertex value
*/
+ node.set(getRecordReader().getCurrentValue());
+ vertexValue.setNodeIdList(node.getNodeIdList());
vertexValue.setFFList(node.getFFList());
vertexValue.setFRList(node.getFRList());
vertexValue.setRFList(node.getRFList());
vertexValue.setRRList(node.getRRList());
- vertexValue.setKmer(node.getKmer());
+ vertexValue.setKmer(getRecordReader().getCurrentKey());
vertexValue.setState(State.IS_NON);
vertex.setVertexValue(vertexValue);
}
-
+
return vertex;
}
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForPathMergeInputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForPathMergeInputFormat.java
deleted file mode 100644
index 25c884b..0000000
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForPathMergeInputFormat.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package edu.uci.ics.genomix.pregelix.format;
-
-import java.io.IOException;
-
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.mapreduce.InputSplit;
-import org.apache.hadoop.mapreduce.RecordReader;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-import edu.uci.ics.genomix.oldtype.NodeWritable;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
-import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryVertexInputFormat;
-import edu.uci.ics.genomix.pregelix.io.MessageWritable;
-import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
-import edu.uci.ics.genomix.pregelix.io.VertexValueWritable.State;
-import edu.uci.ics.pregelix.api.graph.Vertex;
-import edu.uci.ics.pregelix.api.io.VertexReader;
-import edu.uci.ics.pregelix.api.util.BspUtils;
-
-public class LogAlgorithmForPathMergeInputFormat extends
- BinaryVertexInputFormat<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> {
- /**
- * Format INPUT
- */
- @SuppressWarnings("unchecked")
- @Override
- public VertexReader<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> createVertexReader(
- InputSplit split, TaskAttemptContext context) throws IOException {
- return new BinaryLoadGraphReader(binaryInputFormat.createRecordReader(split, context));
- }
-
- @SuppressWarnings("rawtypes")
- class BinaryLoadGraphReader extends
- BinaryVertexReader<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> {
- private Vertex vertex = null;
- private NodeWritable node = new NodeWritable();
- private PositionWritable vertexId = new PositionWritable();
- private VertexValueWritable vertexValue = new VertexValueWritable();
-
- public BinaryLoadGraphReader(RecordReader<NodeWritable, NullWritable> recordReader) {
- super(recordReader);
- }
-
- @Override
- public boolean nextVertex() throws IOException, InterruptedException {
- return getRecordReader().nextKeyValue();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Vertex<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> getCurrentVertex()
- throws IOException, InterruptedException {
- if (vertex == null)
- vertex = (Vertex) BspUtils.createVertex(getContext().getConfiguration());
-
- vertex.getMsgList().clear();
- vertex.getEdges().clear();
-
- if (getRecordReader() != null) {
- /**
- * set the src vertex id
- */
- node = getRecordReader().getCurrentKey();
- vertexId.set(node.getNodeID());
- vertex.setVertexId(vertexId);
- /**
- * set the vertex value
- */
- vertexValue.setFFList(node.getFFList());
- vertexValue.setFRList(node.getFRList());
- vertexValue.setRFList(node.getRFList());
- vertexValue.setRRList(node.getRRList());
- vertexValue.setKmer(node.getKmer());
- vertexValue.setState(State.IS_NON);
- vertex.setVertexValue(vertexValue);
- }
-
- return vertex;
- }
- }
-
-}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForPathMergeOutputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForPathMergeOutputFormat.java
deleted file mode 100644
index 20a4587..0000000
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/LogAlgorithmForPathMergeOutputFormat.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package edu.uci.ics.genomix.pregelix.format;
-
-import java.io.IOException;
-
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.mapreduce.RecordWriter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-import edu.uci.ics.genomix.oldtype.NodeWritable;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
-import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryVertexOutputFormat;
-import edu.uci.ics.pregelix.api.graph.Vertex;
-import edu.uci.ics.pregelix.api.io.VertexWriter;
-import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
-
-public class LogAlgorithmForPathMergeOutputFormat extends
- BinaryVertexOutputFormat<PositionWritable, VertexValueWritable, NullWritable> {
-
- @Override
- public VertexWriter<PositionWritable, VertexValueWritable, NullWritable> createVertexWriter(
- TaskAttemptContext context) throws IOException, InterruptedException {
- @SuppressWarnings("unchecked")
- RecordWriter<NodeWritable, NullWritable> recordWriter = binaryOutputFormat.getRecordWriter(context);
- return new BinaryLoadGraphVertexWriter(recordWriter);
- }
-
- /**
- * Simple VertexWriter that supports {@link BinaryLoadGraphVertex}
- */
- public static class BinaryLoadGraphVertexWriter extends
- BinaryVertexWriter<PositionWritable, VertexValueWritable, NullWritable> {
- private NodeWritable node = new NodeWritable();
- private NullWritable nul = NullWritable.get();
-
- public BinaryLoadGraphVertexWriter(RecordWriter<NodeWritable, NullWritable> lineRecordWriter) {
- super(lineRecordWriter);
- }
-
- @Override
- public void writeVertex(Vertex<PositionWritable, VertexValueWritable, NullWritable, ?> vertex)
- throws IOException, InterruptedException {
- node.set(vertex.getVertexId(), vertex.getVertexValue().getFFList(),
- vertex.getVertexValue().getFRList(), vertex.getVertexValue().getRFList(),
- vertex.getVertexValue().getRRList(), vertex.getVertexValue().getKmer());
- getRecordWriter().write(node, nul);
- }
- }
-}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/NaiveAlgorithmForPathMergeOutputFormat.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/NaiveAlgorithmForPathMergeOutputFormat.java
deleted file mode 100644
index 77a893a..0000000
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/format/NaiveAlgorithmForPathMergeOutputFormat.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package edu.uci.ics.genomix.pregelix.format;
-
-import java.io.IOException;
-
-import org.apache.hadoop.io.NullWritable;
-import org.apache.hadoop.mapreduce.RecordWriter;
-import org.apache.hadoop.mapreduce.TaskAttemptContext;
-
-import edu.uci.ics.genomix.oldtype.NodeWritable;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
-import edu.uci.ics.genomix.pregelix.api.io.binary.BinaryVertexOutputFormat;
-import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
-import edu.uci.ics.pregelix.api.graph.Vertex;
-import edu.uci.ics.pregelix.api.io.VertexWriter;
-
-public class NaiveAlgorithmForPathMergeOutputFormat extends
- BinaryVertexOutputFormat<PositionWritable, VertexValueWritable, NullWritable> {
-
- @Override
- public VertexWriter<PositionWritable, VertexValueWritable, NullWritable> createVertexWriter(
- TaskAttemptContext context) throws IOException, InterruptedException {
- @SuppressWarnings("unchecked")
- RecordWriter<NodeWritable, NullWritable> recordWriter = binaryOutputFormat.getRecordWriter(context);
- return new BinaryLoadGraphVertexWriter(recordWriter);
- }
-
- /**
- * Simple VertexWriter that supports {@link BinaryLoadGraphVertex}
- */
- public static class BinaryLoadGraphVertexWriter extends
- BinaryVertexWriter<PositionWritable, VertexValueWritable, NullWritable> {
- private NodeWritable node = new NodeWritable();
- private NullWritable nullWritable = NullWritable.get();
-
- public BinaryLoadGraphVertexWriter(RecordWriter<NodeWritable, NullWritable> lineRecordWriter) {
- super(lineRecordWriter);
- }
-
- @Override
- public void writeVertex(Vertex<PositionWritable, VertexValueWritable, NullWritable, ?> vertex)
- throws IOException, InterruptedException {
- node.set(vertex.getVertexId(), vertex.getVertexValue().getFFList(),
- vertex.getVertexValue().getFRList(), vertex.getVertexValue().getRFList(),
- vertex.getVertexValue().getRRList(), vertex.getVertexValue().getKmer());
- getRecordWriter().write(node, nullWritable);
- }
- }
-}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/AdjacencyListWritable.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/AdjacencyListWritable.java
index 4aeffa0..b23edaf 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/AdjacencyListWritable.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/AdjacencyListWritable.java
@@ -7,14 +7,15 @@
import org.apache.hadoop.io.WritableComparable;
import edu.uci.ics.genomix.oldtype.PositionListWritable;
+import edu.uci.ics.genomix.type.KmerListWritable;
public class AdjacencyListWritable implements WritableComparable<AdjacencyListWritable>{
- private PositionListWritable forwardList;
- private PositionListWritable reverseList;
+ private KmerListWritable forwardList;
+ private KmerListWritable reverseList;
public AdjacencyListWritable(){
- forwardList = new PositionListWritable();
- reverseList = new PositionListWritable();
+ forwardList = new KmerListWritable();
+ reverseList = new KmerListWritable();
}
public void set(AdjacencyListWritable adjacencyList){
@@ -30,20 +31,20 @@
public int getCountOfPosition(){
return forwardList.getCountOfPosition() + reverseList.getCountOfPosition();
}
-
- public PositionListWritable getForwardList() {
+
+ public KmerListWritable getForwardList() {
return forwardList;
}
- public void setForwardList(PositionListWritable forwardList) {
+ public void setForwardList(KmerListWritable forwardList) {
this.forwardList = forwardList;
}
- public PositionListWritable getReverseList() {
+ public KmerListWritable getReverseList() {
return reverseList;
}
- public void setReverseList(PositionListWritable reverseList) {
+ public void setReverseList(KmerListWritable reverseList) {
this.reverseList = reverseList;
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/MessageWritable.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/MessageWritable.java
index e1e9a3e..adb1aac 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/MessageWritable.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/MessageWritable.java
@@ -6,7 +6,6 @@
import org.apache.hadoop.io.WritableComparable;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
import edu.uci.ics.genomix.pregelix.type.CheckMessage;
import edu.uci.ics.genomix.pregelix.type.Message;
import edu.uci.ics.genomix.type.KmerBytesWritable;
@@ -17,7 +16,7 @@
* stores neighber vertexValue when pathVertex sends the message
* file stores the point to the file that stores the chains of connected DNA
*/
- private PositionWritable sourceVertexId;
+ private KmerBytesWritable sourceVertexId;
private KmerBytesWritable kmer;
private AdjacencyListWritable neighberNode; //incoming or outgoing
private byte flag;
@@ -26,7 +25,7 @@
private byte checkMessage;
public MessageWritable() {
- sourceVertexId = new PositionWritable();
+ sourceVertexId = new KmerBytesWritable();
kmer = new KmerBytesWritable(0);
neighberNode = new AdjacencyListWritable();
flag = Message.NON;
@@ -52,11 +51,11 @@
this.flag = msg.getFlag();
}
- public void set(PositionWritable sourceVertexId, KmerBytesWritable chainVertexId, AdjacencyListWritable neighberNode, byte message) {
+ public void set(KmerBytesWritable sourceVertexId, KmerBytesWritable chainVertexId, AdjacencyListWritable neighberNode, byte message) {
checkMessage = 0;
if (sourceVertexId != null) {
checkMessage |= CheckMessage.SOURCE;
- this.sourceVertexId.set(sourceVertexId.getReadID(),sourceVertexId.getPosInRead());
+ this.sourceVertexId.set(sourceVertexId);
}
if (chainVertexId != null) {
checkMessage |= CheckMessage.CHAIN;
@@ -76,14 +75,14 @@
flag = Message.NON;
}
- public PositionWritable getSourceVertexId() {
+ public KmerBytesWritable getSourceVertexId() {
return sourceVertexId;
}
- public void setSourceVertexId(PositionWritable sourceVertexId) {
+ public void setSourceVertexId(KmerBytesWritable sourceVertexId) {
if (sourceVertexId != null) {
checkMessage |= CheckMessage.SOURCE;
- this.sourceVertexId.set(sourceVertexId.getReadID(),sourceVertexId.getPosInRead());
+ this.sourceVertexId.set(sourceVertexId);
}
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java
index 56cc86b..f2a90d0 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/io/VertexValueWritable.java
@@ -4,10 +4,10 @@
import org.apache.hadoop.io.WritableComparable;
-import edu.uci.ics.genomix.oldtype.PositionListWritable;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
+import edu.uci.ics.genomix.type.PositionListWritable;
import edu.uci.ics.genomix.pregelix.type.MessageFlag;
import edu.uci.ics.genomix.type.KmerBytesWritable;
+import edu.uci.ics.genomix.type.KmerListWritable;
public class VertexValueWritable implements WritableComparable<VertexValueWritable> {
@@ -35,30 +35,32 @@
public static final byte SHOULD_MERGE_CLEAR = 0b1110011;
}
+ private PositionListWritable nodeIdList;
private AdjacencyListWritable incomingList;
private AdjacencyListWritable outgoingList;
private byte state;
private KmerBytesWritable kmer;
- private PositionWritable mergeDest;
+ private KmerBytesWritable mergeDest;
public VertexValueWritable() {
+ nodeIdList = new PositionListWritable();
incomingList = new AdjacencyListWritable();
outgoingList = new AdjacencyListWritable();
state = State.IS_NON;
kmer = new KmerBytesWritable(0);
- mergeDest = new PositionWritable();
+ mergeDest = new KmerBytesWritable(0);
}
- public VertexValueWritable(PositionListWritable forwardForwardList, PositionListWritable forwardReverseList,
- PositionListWritable reverseForwardList, PositionListWritable reverseReverseList,
+ public VertexValueWritable(PositionListWritable nodeIdList, KmerListWritable forwardForwardList, KmerListWritable forwardReverseList,
+ KmerListWritable reverseForwardList, KmerListWritable reverseReverseList,
byte state, KmerBytesWritable kmer) {
- set(forwardForwardList, forwardReverseList,
+ set(nodeIdList, forwardForwardList, forwardReverseList,
reverseForwardList, reverseReverseList,
state, kmer);
}
- public void set(PositionListWritable forwardForwardList, PositionListWritable forwardReverseList,
- PositionListWritable reverseForwardList, PositionListWritable reverseReverseList,
+ public void set(PositionListWritable nodeIdList, KmerListWritable forwardForwardList, KmerListWritable forwardReverseList,
+ KmerListWritable reverseForwardList, KmerListWritable reverseReverseList,
byte state, KmerBytesWritable kmer) {
this.incomingList.setForwardList(reverseForwardList);
this.incomingList.setReverseList(reverseReverseList);
@@ -69,39 +71,48 @@
}
public void set(VertexValueWritable value) {
- set(value.getFFList(),value.getFRList(),value.getRFList(),value.getRRList(),value.getState(),
+ set(value.getNodeIdList(), value.getFFList(),value.getFRList(),value.getRFList(),value.getRRList(),value.getState(),
value.getKmer());
}
- public PositionListWritable getFFList() {
+
+ public PositionListWritable getNodeIdList() {
+ return nodeIdList;
+ }
+
+ public void setNodeIdList(PositionListWritable nodeIdList) {
+ this.nodeIdList.set(nodeIdList);
+ }
+
+ public KmerListWritable getFFList() {
return outgoingList.getForwardList();
}
- public PositionListWritable getFRList() {
+ public KmerListWritable getFRList() {
return outgoingList.getReverseList();
}
- public PositionListWritable getRFList() {
+ public KmerListWritable getRFList() {
return incomingList.getForwardList();
}
- public PositionListWritable getRRList() {
+ public KmerListWritable getRRList() {
return incomingList.getReverseList();
}
- public void setFFList(PositionListWritable forwardForwardList){
+ public void setFFList(KmerListWritable forwardForwardList){
outgoingList.setForwardList(forwardForwardList);
}
- public void setFRList(PositionListWritable forwardReverseList){
+ public void setFRList(KmerListWritable forwardReverseList){
outgoingList.setReverseList(forwardReverseList);
}
- public void setRFList(PositionListWritable reverseForwardList){
+ public void setRFList(KmerListWritable reverseForwardList){
incomingList.setForwardList(reverseForwardList);
}
- public void setRRList(PositionListWritable reverseReverseList){
+ public void setRRList(KmerListWritable reverseReverseList){
incomingList.setReverseList(reverseReverseList);
}
@@ -141,16 +152,17 @@
this.kmer.set(kmer);
}
- public PositionWritable getMergeDest() {
+ public KmerBytesWritable getMergeDest() {
return mergeDest;
}
- public void setMergeDest(PositionWritable mergeDest) {
+ public void setMergeDest(KmerBytesWritable mergeDest) {
this.mergeDest = mergeDest;
}
@Override
public void readFields(DataInput in) throws IOException {
+ nodeIdList.readFields(in);
incomingList.readFields(in);
outgoingList.readFields(in);
state = in.readByte();
@@ -160,6 +172,7 @@
@Override
public void write(DataOutput out) throws IOException {
+ nodeIdList.write(out);
incomingList.write(out);
outgoingList.write(out);
out.writeByte(state);
@@ -175,12 +188,13 @@
@Override
public String toString() {
StringBuilder sbuilder = new StringBuilder();
- sbuilder.append('(');
+ sbuilder.append('{');
+ sbuilder.append(nodeIdList.toString()).append('\t');
sbuilder.append(outgoingList.getForwardList().toString()).append('\t');
sbuilder.append(outgoingList.getReverseList().toString()).append('\t');
sbuilder.append(incomingList.getForwardList().toString()).append('\t');
sbuilder.append(incomingList.getReverseList().toString()).append('\t');
- sbuilder.append(kmer.toString()).append(')');
+ sbuilder.append(kmer.toString()).append('}');
return sbuilder.toString();
}
@@ -195,8 +209,8 @@
/*
* Process any changes to value. This is for edge updates
*/
- public void processUpdates(byte neighborToDeleteDir, PositionWritable nodeToDelete,
- byte neighborToMergeDir, PositionWritable nodeToAdd){
+ public void processUpdates(byte neighborToDeleteDir, KmerBytesWritable nodeToDelete,
+ byte neighborToMergeDir, KmerBytesWritable nodeToAdd){
// TODO
// this.getListFromDir(neighborToDeleteDir).remove(nodeToDelete);
// this.getListFromDir(neighborToMergeDir).append(nodeToDelete);
@@ -234,8 +248,8 @@
/*
* Process any changes to value. This is for merging
*/
- public void processMerges(byte neighborToDeleteDir, PositionWritable nodeToDelete,
- byte neighborToMergeDir, PositionWritable nodeToAdd,
+ public void processMerges(byte neighborToDeleteDir, KmerBytesWritable nodeToDelete,
+ byte neighborToMergeDir, KmerBytesWritable nodeToAdd,
int kmerSize, KmerBytesWritable kmer){
switch (neighborToDeleteDir & MessageFlag.DIR_MASK) {
case MessageFlag.DIR_FF:
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java
index 1a793cd..6b5562a 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/BasicPathMergeVertex.java
@@ -7,19 +7,19 @@
import edu.uci.ics.pregelix.api.graph.Vertex;
-import edu.uci.ics.genomix.oldtype.PositionWritable;
import edu.uci.ics.genomix.pregelix.io.MessageWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable.State;
import edu.uci.ics.genomix.pregelix.type.AdjMessage;
import edu.uci.ics.genomix.pregelix.type.MessageFlag;
import edu.uci.ics.genomix.pregelix.util.VertexUtil;
+import edu.uci.ics.genomix.type.KmerBytesWritable;
/**
* Naive Algorithm for path merge graph
*/
public class BasicPathMergeVertex extends
- Vertex<PositionWritable, VertexValueWritable, NullWritable, MessageWritable> {
+ Vertex<KmerBytesWritable, VertexValueWritable, NullWritable, MessageWritable> {
public static final String KMER_SIZE = "BasicPathMergeVertex.kmerSize";
public static final String ITERATIONS = "BasicPathMergeVertex.iteration";
public static int kmerSize = -1;
@@ -27,9 +27,9 @@
protected MessageWritable incomingMsg = new MessageWritable();
protected MessageWritable outgoingMsg = new MessageWritable();
- protected PositionWritable destVertexId = new PositionWritable();
- protected Iterator<PositionWritable> posIterator;
- private PositionWritable pos = new PositionWritable();
+ protected KmerBytesWritable destVertexId = new KmerBytesWritable();
+ protected Iterator<KmerBytesWritable> posIterator;
+ private KmerBytesWritable kmer = new KmerBytesWritable();
byte headFlag;
protected byte outFlag;
protected byte inFlag;
@@ -66,7 +66,7 @@
/**
* get destination vertex
*/
- public PositionWritable getNextDestVertexId(VertexValueWritable value) {
+ public KmerBytesWritable getNextDestVertexId(VertexValueWritable value) {
if (value.getFFList().getCountOfPosition() > 0){ // #FFList() > 0
posIterator = value.getFFList().iterator();
return posIterator.next();
@@ -78,7 +78,7 @@
}
}
- public PositionWritable getPreDestVertexId(VertexValueWritable value) {
+ public KmerBytesWritable getPreDestVertexId(VertexValueWritable value) {
if (value.getRFList().getCountOfPosition() > 0){ // #RFList() > 0
posIterator = value.getRFList().iterator();
return posIterator.next();
@@ -93,7 +93,7 @@
/**
* get destination vertex
*/
- public PositionWritable getNextDestVertexIdAndSetFlag(VertexValueWritable value) {
+ public KmerBytesWritable getNextDestVertexIdAndSetFlag(VertexValueWritable value) {
if (value.getFFList().getCountOfPosition() > 0){ // #FFList() > 0
posIterator = value.getFFList().iterator();
outFlag |= MessageFlag.DIR_FF;
@@ -108,7 +108,7 @@
}
- public PositionWritable getPreDestVertexIdAndSetFlag(VertexValueWritable value) {
+ public KmerBytesWritable getPreDestVertexIdAndSetFlag(VertexValueWritable value) {
if (value.getRFList().getCountOfPosition() > 0){ // #RFList() > 0
posIterator = value.getRFList().iterator();
outFlag |= MessageFlag.DIR_RF;
@@ -618,8 +618,8 @@
//remove incomingMsg.getSourceId from RR positionList
posIterator = getVertexValue().getRRList().iterator();
while(posIterator.hasNext()){
- pos = posIterator.next();
- if(pos.equals(incomingMsg.getSourceVertexId())){
+ kmer = posIterator.next();
+ if(kmer.equals(incomingMsg.getSourceVertexId())){
posIterator.remove();
break;
}
@@ -628,8 +628,8 @@
//remove incomingMsg.getSourceId from FR positionList
posIterator = getVertexValue().getFRList().iterator();
while(posIterator.hasNext()){
- pos = posIterator.next();
- if(pos.equals(incomingMsg.getSourceVertexId())){
+ kmer = posIterator.next();
+ if(kmer.equals(incomingMsg.getSourceVertexId())){
posIterator.remove();
break;
}
@@ -638,8 +638,8 @@
//remove incomingMsg.getSourceId from RF positionList
posIterator = getVertexValue().getRFList().iterator();
while(posIterator.hasNext()){
- pos = posIterator.next();
- if(pos.equals(incomingMsg.getSourceVertexId())){
+ kmer = posIterator.next();
+ if(kmer.equals(incomingMsg.getSourceVertexId())){
posIterator.remove();
break;
}
@@ -648,8 +648,8 @@
//remove incomingMsg.getSourceId from FF positionList
posIterator = getVertexValue().getFFList().iterator();
while(posIterator.hasNext()){
- pos = posIterator.next();
- if(pos.equals(incomingMsg.getSourceVertexId())){
+ kmer = posIterator.next();
+ if(kmer.equals(incomingMsg.getSourceVertexId())){
posIterator.remove();
break;
}
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java
index 05a4700..01fd71f 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/operator/pathmerge/P4ForPathMergeVertex.java
@@ -7,8 +7,6 @@
import edu.uci.ics.pregelix.api.job.PregelixJob;
import edu.uci.ics.genomix.oldtype.PositionWritable;
import edu.uci.ics.genomix.pregelix.client.Client;
-import edu.uci.ics.genomix.pregelix.format.NaiveAlgorithmForPathMergeInputFormat;
-import edu.uci.ics.genomix.pregelix.format.NaiveAlgorithmForPathMergeOutputFormat;
import edu.uci.ics.genomix.pregelix.io.MessageWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable;
import edu.uci.ics.genomix.pregelix.io.VertexValueWritable.State;
diff --git a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/util/VertexUtil.java b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/util/VertexUtil.java
index 7b0dfec..b7f6a4f 100644
--- a/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/util/VertexUtil.java
+++ b/genomix/genomix-pregelix/src/main/java/edu/uci/ics/genomix/pregelix/util/VertexUtil.java
@@ -117,7 +117,7 @@
/**
* get nodeId from Ad
*/
- public static PositionWritable getNodeIdFromAdjacencyList(AdjacencyListWritable adj){
+ public static KmerBytesWritable getNodeIdFromAdjacencyList(AdjacencyListWritable adj){
if(adj.getForwardList().getCountOfPosition() > 0)
return adj.getForwardList().getPosition(0);
else if(adj.getReverseList().getCountOfPosition() > 0)