Merge branch 'fullstack_genomix' of https://code.google.com/p/hyracks into fullstack_genomix
diff --git a/genomix/genomix-hadoop/actual3/complete2/.complete2-r-00000.crc b/genomix/genomix-hadoop/actual3/complete2/.complete2-r-00000.crc
index b0b2753..bccc1b3 100644
--- a/genomix/genomix-hadoop/actual3/complete2/.complete2-r-00000.crc
+++ b/genomix/genomix-hadoop/actual3/complete2/.complete2-r-00000.crc
Binary files differ
diff --git a/genomix/genomix-hadoop/actual3/complete2/complete2-r-00000 b/genomix/genomix-hadoop/actual3/complete2/complete2-r-00000
index d3d3667..2704be9 100755
--- a/genomix/genomix-hadoop/actual3/complete2/complete2-r-00000
+++ b/genomix/genomix-hadoop/actual3/complete2/complete2-r-00000
Binary files differ
diff --git a/genomix/genomix-hadoop/actual3/conf.xml b/genomix/genomix-hadoop/actual3/conf.xml
index 16a0edc..f662215 100644
--- a/genomix/genomix-hadoop/actual3/conf.xml
+++ b/genomix/genomix-hadoop/actual3/conf.xml
@@ -12,7 +12,7 @@
 <property><name>dfs.namenode.logging.level</name><value>info</value></property>
 <property><name>dfs.datanode.address</name><value>127.0.0.1:0</value></property>
 <property><name>io.skip.checksum.errors</name><value>false</value></property>
-<property><name>fs.default.name</name><value>hdfs://localhost:62106</value></property>
+<property><name>fs.default.name</name><value>hdfs://localhost:50310</value></property>
 <property><name>mapred.child.tmp</name><value>./tmp</value></property>
 <property><name>fs.har.impl.disable.cache</name><value>true</value></property>
 <property><name>dfs.safemode.threshold.pct</name><value>0.999f</value></property>
@@ -125,7 +125,7 @@
 <property><name>mapred.map.output.compression.codec</name><value>org.apache.hadoop.io.compress.DefaultCodec</value></property>
 <property><name>mapred.tasktracker.dns.interface</name><value>default</value></property>
 <property><name>dfs.namenode.decommission.interval</name><value>3</value></property>
-<property><name>dfs.http.address</name><value>localhost:62107</value></property>
+<property><name>dfs.http.address</name><value>localhost:50311</value></property>
 <property><name>dfs.heartbeat.interval</name><value>3</value></property>
 <property><name>mapred.job.tracker</name><value>local</value></property>
 <property><name>io.seqfile.sorter.recordlimit</name><value>1000000</value></property>
diff --git a/genomix/genomix-hadoop/data/webmap/text.txt b/genomix/genomix-hadoop/data/webmap/text.txt
deleted file mode 100755
index c6cd7fe..0000000
--- a/genomix/genomix-hadoop/data/webmap/text.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-@625E1AAXX100810:1:100:10000:10271/1

-AATAGAAGATCGAT

-+

-EDBDB?BEEEDGGEGGGDGGGA>DG@GGD;GD@DG@F?<B<BFFD?

diff --git a/genomix/genomix-hadoop/pom.xml b/genomix/genomix-hadoop/pom.xml
index f791f5b..ff6a7ee 100755
--- a/genomix/genomix-hadoop/pom.xml
+++ b/genomix/genomix-hadoop/pom.xml
@@ -22,8 +22,9 @@
 				<artifactId>maven-compiler-plugin</artifactId>
 				<version>2.0.2</version>
 				<configuration>
-					<source>1.6</source>
-					<target>1.6</target>
+					<source>1.7</source>
+					<target>1.7</target>
+					<fork>true</fork>
 				</configuration>
 			</plugin>
 			<plugin>
diff --git a/genomix/genomix-hadoop/src/.DS_Store b/genomix/genomix-hadoop/src/.DS_Store
new file mode 100644
index 0000000..1cf57ac
--- /dev/null
+++ b/genomix/genomix-hadoop/src/.DS_Store
Binary files differ
diff --git a/genomix/genomix-hadoop/src/main/.DS_Store b/genomix/genomix-hadoop/src/main/.DS_Store
new file mode 100644
index 0000000..f2a5476
--- /dev/null
+++ b/genomix/genomix-hadoop/src/main/.DS_Store
Binary files differ
diff --git a/genomix/genomix-hadoop/src/main/java/.DS_Store b/genomix/genomix-hadoop/src/main/java/.DS_Store
new file mode 100644
index 0000000..7806fed
--- /dev/null
+++ b/genomix/genomix-hadoop/src/main/java/.DS_Store
Binary files differ
diff --git a/genomix/genomix-hadoop/src/main/java/edu/.DS_Store b/genomix/genomix-hadoop/src/main/java/edu/.DS_Store
new file mode 100644
index 0000000..bc05a64
--- /dev/null
+++ b/genomix/genomix-hadoop/src/main/java/edu/.DS_Store
Binary files differ
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/.DS_Store b/genomix/genomix-hadoop/src/main/java/edu/uci/.DS_Store
new file mode 100644
index 0000000..ec6ffce
--- /dev/null
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/.DS_Store
Binary files differ
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/.DS_Store b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/.DS_Store
new file mode 100644
index 0000000..22fef5d
--- /dev/null
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/.DS_Store
Binary files differ
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathDriver.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathDriver.java
index cfdf8d5..99eec46 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathDriver.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathDriver.java
@@ -23,8 +23,10 @@
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.SequenceFileInputFormat;
 import org.apache.hadoop.mapred.SequenceFileOutputFormat;
+import org.apache.hadoop.mapred.TextOutputFormat;
 import org.apache.hadoop.mapred.lib.MultipleOutputs;
 import org.apache.hadoop.mapred.lib.MultipleSequenceFileOutputFormat;
+import org.apache.hadoop.mapred.lib.MultipleTextOutputFormat;
 import org.kohsuke.args4j.CmdLineParser;
 import org.kohsuke.args4j.Option;
 
@@ -83,8 +85,9 @@
         FileSystem dfs = FileSystem.get(conf);
         dfs.delete(new Path(inputPath + "-step1"), true);
         JobClient.runJob(conf);
+        int iMerge = 0;
 /*----------------------------------------------------------------------*/
-        for(int iMerge = 0; iMerge < mergeRound; iMerge ++){
+        for(iMerge = 0; iMerge < mergeRound; iMerge ++){
         
             conf = new JobConf(MergePathDriver.class);
             conf.setInt("sizeKmer", sizeKmer);
@@ -102,7 +105,6 @@
             conf.setMapOutputValueClass(MergePathValueWritable.class);
             
             conf.setInputFormat(SequenceFileInputFormat.class);
-            conf.setOutputFormat(MultipleSequenceFileOutputFormat.class);
             
             String uncomplete = "uncomplete" + iMerge;
             String complete = "complete" + iMerge;
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathMapper.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathMapper.java
index c3255f2..ff4c2ce 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathMapper.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathMapper.java
@@ -28,24 +28,24 @@
 
 @SuppressWarnings("deprecation")
 public class MergePathMapper extends MapReduceBase implements
-        Mapper<KmerBytesWritable, MergePathValueWritable, KmerBytesWritable, MergePathValueWritable> {
+        Mapper<VKmerBytesWritable, MergePathValueWritable, VKmerBytesWritable, MergePathValueWritable> {
     private int KMER_SIZE;
     private VKmerBytesWritableFactory outputKmerFactory;
-    private MergePathValueWritable outputAdjList; 
+    private MergePathValueWritable outputValue; 
     private VKmerBytesWritable tmpKmer;
     private VKmerBytesWritable outputKmer;
 
     public void configure(JobConf job) {
         KMER_SIZE = job.getInt("sizeKmer", 0);
         outputKmerFactory = new VKmerBytesWritableFactory(KMER_SIZE);
-        outputAdjList = new MergePathValueWritable();
+        outputValue = new MergePathValueWritable();
         tmpKmer = new VKmerBytesWritable(KMER_SIZE);
         outputKmer = new VKmerBytesWritable(KMER_SIZE);
     }
 
     @Override
-    public void map(KmerBytesWritable key, MergePathValueWritable value,
-            OutputCollector<KmerBytesWritable, MergePathValueWritable> output, Reporter reporter) throws IOException {
+    public void map(VKmerBytesWritable key, MergePathValueWritable value,
+            OutputCollector<VKmerBytesWritable, MergePathValueWritable> output, Reporter reporter) throws IOException {
 
         byte precursor = (byte) 0xF0;
         byte succeed = (byte) 0x0F;
@@ -59,14 +59,14 @@
             byte succeedCode = GeneCode.getGeneCodeFromBitMap(succeed);
             tmpKmer.set(outputKmerFactory.getLastKmerFromChain(KMER_SIZE, key));
             outputKmer.set(outputKmerFactory.shiftKmerWithNextCode(tmpKmer, succeedCode));
-
-            KmerBytesWritable mergedKmer = outputKmerFactory.getFirstKmerFromChain(value.getKmerSize()
-                    - (KMER_SIZE - 1), value.getKmer());
-            outputAdjList.set(mergedKmer, adjBitMap, bitFlag);
-            output.collect(outputKmer, outputAdjList);
+            
+            tmpKmer.set(outputKmerFactory.getFirstKmerFromChain(key.getKmerLength() - (KMER_SIZE - 1), key));
+            outputValue.set(tmpKmer, adjBitMap, bitFlag);
+            output.collect(outputKmer, outputValue);
         } else {
-            outputAdjList.set(value);
-            output.collect(key, outputAdjList);
+            outputKmer.set(key);
+            outputValue.set(value);
+            output.collect(key, outputValue);
         }
     }
 }
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathReducer.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathReducer.java
index cead0e8..44f7e8e 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathReducer.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/MergePathReducer.java
@@ -29,12 +29,14 @@
 
 @SuppressWarnings("deprecation")
 public class MergePathReducer extends MapReduceBase implements
-        Reducer<KmerBytesWritable, MergePathValueWritable, KmerBytesWritable, MergePathValueWritable> {
+        Reducer<VKmerBytesWritable, MergePathValueWritable, VKmerBytesWritable, MergePathValueWritable> {
     private VKmerBytesWritableFactory kmerFactory;
     private VKmerBytesWritable outputKmer;
     private VKmerBytesWritable tmpKmer;
     private int KMER_SIZE;
-    private MergePathValueWritable outputAdjList;
+    private MergePathValueWritable outputValue;
+    private MergePathValueWritable tmpOutputValue;
+    
     MultipleOutputs mos = null;
     private int I_MERGE;
 
@@ -42,7 +44,7 @@
         mos = new MultipleOutputs(job);
         I_MERGE = Integer.parseInt(job.get("iMerge"));
         KMER_SIZE = job.getInt("sizeKmer", 0);
-        outputAdjList = new MergePathValueWritable();
+        outputValue = new MergePathValueWritable();
         kmerFactory = new VKmerBytesWritableFactory(KMER_SIZE);
         outputKmer = new VKmerBytesWritable(KMER_SIZE);
         tmpKmer = new VKmerBytesWritable(KMER_SIZE);
@@ -50,58 +52,72 @@
 
     @SuppressWarnings("unchecked")
     @Override
-    public void reduce(KmerBytesWritable key, Iterator<MergePathValueWritable> values,
-            OutputCollector<KmerBytesWritable, MergePathValueWritable> output, Reporter reporter) throws IOException {
-        outputAdjList = values.next();
-
-        
+    public void reduce(VKmerBytesWritable key, Iterator<MergePathValueWritable> values,
+            OutputCollector<VKmerBytesWritable, MergePathValueWritable> output, Reporter reporter) throws IOException {
+        outputValue = values.next();
         if (values.hasNext() == true) {
-
-            if (outputAdjList.getFlag() == 1) {
-                byte adjBitMap = outputAdjList.getAdjBitMap();
-                byte bitFlag = outputAdjList.getFlag();
-                outputKmer.set(kmerFactory.mergeTwoKmer(outputAdjList.getKmer(), key));
-                
-                outputAdjList = values.next();
-                byte nextAdj = outputAdjList.getAdjBitMap();
+            if(outputValue.getFlag() != 1){
+                byte nextAdj = outputValue.getAdjBitMap();
                 byte succeed = (byte) 0x0F;
                 succeed = (byte) (succeed & nextAdj);
-                adjBitMap = (byte) (adjBitMap & 0xF0);
-                adjBitMap = (byte) (adjBitMap | succeed);
-                outputAdjList.set(null, 0, 0, adjBitMap, bitFlag, KMER_SIZE + outputAdjList.getKmerSize());
-
-                mos.getCollector("uncomplete" + I_MERGE, reporter).collect(outputKmer, outputAdjList);
-            } else {
-                byte nextAdj = outputAdjList.getAdjBitMap();
-                byte succeed = (byte) 0x0F;
-                succeed = (byte) (succeed & nextAdj);
-                outputAdjList = values.next();
-                byte adjBitMap = outputAdjList.getAdjBitMap();
-                byte flag = outputAdjList.getFlag();
-                int kmerSize = outputAdjList.getKmerSize();
                 
-                outputKmer.set(kmerFactory.mergeTwoKmer(outputAdjList.getKmer(), key));
+                outputValue = values.next();
+                byte adjBitMap = outputValue.getAdjBitMap();
+                byte flag = outputValue.getFlag();                
+                outputKmer.set(kmerFactory.mergeTwoKmer(outputValue.getKmer(), key));
+
                 adjBitMap = (byte) (adjBitMap & 0xF0);
                 adjBitMap = (byte) (adjBitMap | succeed);
-                outputAdjList.set(null, 0, 0, adjBitMap, flag, KMER_SIZE + kmerSize);
-
-                mos.getCollector("uncomplete" + I_MERGE, reporter).collect(outputKmer, outputAdjList);
+                outputValue.set(null, 0, 0, adjBitMap, flag, 0);
+                mos.getCollector("uncomplete" + I_MERGE, reporter).collect(outputKmer, outputValue);
+            }
+            else{
+                tmpOutputValue.set(outputValue);
+                byte tmpAdjMap = tmpOutputValue.getAdjBitMap();
+                
+                outputValue = values.next();
+                if(outputValue.getFlag() != 1) {
+                    outputKmer.set(kmerFactory.mergeTwoKmer(tmpOutputValue.getKmer(), key));
+                    
+                    byte nextAdj = outputValue.getAdjBitMap();
+                    byte succeed = (byte) 0x0F;
+                    succeed = (byte) (succeed & nextAdj);
+                    tmpAdjMap = (byte) (tmpAdjMap & 0xF0);
+                    tmpAdjMap = (byte) (tmpAdjMap | succeed);
+                    outputValue.set(null, 0, 0, tmpAdjMap, tmpOutputValue.getFlag(), 0);
+                    mos.getCollector("uncomplete" + I_MERGE, reporter).collect(outputKmer, outputValue);
+                }
+                else{
+                    
+                    tmpKmer.set(kmerFactory.getFirstKmerFromChain(KMER_SIZE-1, key));
+                    outputKmer.set(kmerFactory.mergeTwoKmer(tmpOutputValue.getKmer(), tmpKmer));
+                    tmpOutputValue.set(null, 0, 0, tmpAdjMap, tmpOutputValue.getFlag(), 0);
+                    mos.getCollector("complete" + I_MERGE, reporter).collect(outputKmer, tmpOutputValue);
+                    
+                    tmpKmer.set(kmerFactory.getFirstKmerFromChain(KMER_SIZE-1, key));
+                    outputKmer.set(kmerFactory.mergeTwoKmer(outputValue.getKmer(), tmpKmer));                    
+                    outputValue.set(null, 0, 0, outputValue.getAdjBitMap(), outputValue.getFlag(), 0);
+                    mos.getCollector("complete" + I_MERGE, reporter).collect(outputKmer, outputValue);
+                                        
+                    while(values.hasNext()) {
+                        outputValue = values.next();
+                        tmpKmer.set(kmerFactory.getFirstKmerFromChain(KMER_SIZE-1, key));
+                        outputKmer.set(kmerFactory.mergeTwoKmer(outputValue.getKmer(), tmpKmer));                    
+                        outputValue.set(null, 0, 0, outputValue.getAdjBitMap(), outputValue.getFlag(), 0);
+                        mos.getCollector("complete" + I_MERGE, reporter).collect(outputKmer, outputValue);
+                    }
+                }
             }
         } else {
-            if (outputAdjList.getFlag() != 0) {
-                byte adjBitMap = outputAdjList.getAdjBitMap();
-                byte flag = outputAdjList.getFlag();
-                int kmerSize = outputAdjList.getKmerSize();
-                
-                tmpKmer.set(kmerFactory.getFirstKmerFromChain(KMER_SIZE - 1, key));
-                outputKmer.set(kmerFactory.mergeTwoKmer(outputAdjList.getKmer(), tmpKmer));
-                outputAdjList.set(null, 0, 0, adjBitMap, flag, KMER_SIZE + kmerSize);
-                mos.getCollector("complete" + I_MERGE, reporter).collect(outputKmer, outputAdjList);
+            if (outputValue.getFlag() != 0) {
+                tmpKmer.set(kmerFactory.getFirstKmerFromChain(KMER_SIZE-1, key));
+                outputKmer.set(kmerFactory.mergeTwoKmer(outputValue.getKmer(), tmpKmer));                    
+                outputValue.set(null, 0, 0, outputValue.getAdjBitMap(), outputValue.getFlag(), 0);
+                mos.getCollector("complete" + I_MERGE, reporter).collect(outputKmer, outputValue);
             } else
-                mos.getCollector("uncomplete" + I_MERGE, reporter).collect(key, outputAdjList);
+                mos.getCollector("uncomplete" + I_MERGE, reporter).collect(key, outputValue);
         }
     }
-
     public void close() throws IOException {
         // TODO Auto-generated method stub
         mos.close();
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialMapper.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialMapper.java
index ae824e7..5c4bdbe 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialMapper.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialMapper.java
@@ -22,8 +22,8 @@
 import org.apache.hadoop.mapred.Mapper;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.hadoop.mapred.Reporter;
-
 import edu.uci.ics.genomix.type.KmerBytesWritable;
+import edu.uci.ics.genomix.type.GeneCode;
 
 @SuppressWarnings("deprecation")
 public class SNodeInitialMapper extends MapReduceBase implements
@@ -101,39 +101,34 @@
         byte precursor = (byte) 0xF0;
         byte succeed = (byte) 0x0F;
         byte adjBitMap = value.get();
-        byte flag = (byte) 0;
+        byte bitFlag = (byte) 0;
         precursor = (byte) (precursor & adjBitMap);
         precursor = (byte) ((precursor & 0xff) >> 4);
         succeed = (byte) (succeed & adjBitMap);
         boolean inDegree = measureDegree(precursor);
         boolean outDegree = measureDegree(succeed);
-        byte initial = 0;
-        if (inDegree == true && outDegree == false) {
-            flag = (byte) 2;
-            switch (succeed) {
-                case 1:
-                    initial = (byte) 0x00;
-                    break;
-                case 2:
-                    initial = (byte) 0x01;
-                    break;
-                case 4:
-                    initial = (byte) 0x02;
-                    break;
-                case 8:
-                    initial = (byte) 0x03;
-                    break;
-            }
-            outputKmer.set(key);
-            outputKmer.shiftKmerWithNextCode(initial);
-            adjBitMap = (byte) (adjBitMap & 0xF0);
-            outputAdjList.set(null, 0, 0, adjBitMap, flag, KMER_SIZE);
-            output.collect(outputKmer, outputAdjList);
-        }
+
         if (inDegree == false && outDegree == false) {
             outputKmer.set(key);
-            outputAdjList.set(null, 0, 0, adjBitMap, flag, KMER_SIZE);
+            bitFlag = (byte) 2;
+            outputAdjList.set(null, 0, 0, adjBitMap, bitFlag, KMER_SIZE);
             output.collect(outputKmer, outputAdjList);
         }
+        else{
+            for(int i = 0 ; i < 4; i ++){
+                byte temp = 0x01;
+                byte shiftedCode = 0;
+                temp  = (byte)(temp << i);
+                temp = (byte) (succeed & temp);
+                if(temp != 0 ){
+                    byte succeedCode = GeneCode.getGeneCodeFromBitMap(temp);
+                    shiftedCode = key.shiftKmerWithNextCode(succeedCode);
+                    outputKmer.set(key);
+                    outputAdjList.set(null, 0, 0, (byte)0, bitFlag, KMER_SIZE);
+                    output.collect(outputKmer, outputAdjList);
+                    key.shiftKmerWithPreCode(shiftedCode);
+                }
+            }
+        }
     }
 }
diff --git a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialReducer.java b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialReducer.java
index 734abd6..42badf5 100644
--- a/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialReducer.java
+++ b/genomix/genomix-hadoop/src/main/java/edu/uci/ics/pathmerging/SNodeInitialReducer.java
@@ -16,50 +16,50 @@
 
 import java.io.IOException;
 import java.util.Iterator;
-
 import org.apache.hadoop.mapred.MapReduceBase;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.hadoop.mapred.Reducer;
 import org.apache.hadoop.mapred.Reporter;
-
 import edu.uci.ics.genomix.type.KmerBytesWritable;
+import edu.uci.ics.genomix.type.VKmerBytesWritable;
 
 @SuppressWarnings("deprecation")
 public class SNodeInitialReducer extends MapReduceBase implements
-        Reducer<KmerBytesWritable, MergePathValueWritable, KmerBytesWritable, MergePathValueWritable> {
-    private MergePathValueWritable outputAdjList = new MergePathValueWritable();
+        Reducer<KmerBytesWritable, MergePathValueWritable, VKmerBytesWritable, MergePathValueWritable> {
+    private VKmerBytesWritable outputKmer = new VKmerBytesWritable();
+    private MergePathValueWritable outputValue = new MergePathValueWritable();
 
     @Override
     public void reduce(KmerBytesWritable key, Iterator<MergePathValueWritable> values,
-            OutputCollector<KmerBytesWritable, MergePathValueWritable> output, Reporter reporter) throws IOException {
-        outputAdjList = values.next();
+            OutputCollector<VKmerBytesWritable, MergePathValueWritable> output, Reporter reporter) throws IOException {
+        outputKmer.set(key);
+        outputValue = values.next();
         if (values.hasNext() == true) {
-            if (outputAdjList.getFlag() != 2) {
-                byte adjBitMap = outputAdjList.getAdjBitMap();
-                int kmerSize = outputAdjList.getKmerSize();
+            if (outputValue.getFlag() == 2) {
                 byte bitFlag = 1;
-                outputAdjList.set(null, 0, 0, adjBitMap, bitFlag, kmerSize);
-                output.collect(key, outputAdjList);
-
+                outputValue.set(null, 0, 0, outputValue.getAdjBitMap(), bitFlag, outputValue.getKmerLength());
+                output.collect(outputKmer, outputValue);
             } else {
                 boolean flag = false;
                 while (values.hasNext()) {
-                    outputAdjList = values.next();
-                    if (outputAdjList.getFlag() != 2) {
+                    outputValue = values.next();
+                    if (outputValue.getFlag() == 2) {
                         flag = true;
                         break;
                     }
                 }
                 if (flag == true) {
-                    byte adjBitMap = outputAdjList.getAdjBitMap();
-                    int kmerSize = outputAdjList.getKmerSize();
                     byte bitFlag = 1;
-                    outputAdjList.set(null, 0, 0, adjBitMap, bitFlag, kmerSize);
-                    output.collect(key, outputAdjList);
+                    outputValue.set(null, 0, 0, outputValue.getAdjBitMap(), bitFlag, outputValue.getKmerLength());
+                    output.collect(outputKmer, outputValue);
                 }
             }
         } else {
-            output.collect(key, outputAdjList);
+            if (outputValue.getFlag() == 2) {
+                byte bitFlag = 0;
+                outputValue.set(null, 0, 0, outputValue.getAdjBitMap(), bitFlag, outputValue.getKmerLength());
+                output.collect(outputKmer, outputValue);
+            }
         }
     }
 }
diff --git a/genomix/genomix-hadoop/testactual/source.txt b/genomix/genomix-hadoop/testactual/source.txt
deleted file mode 100644
index aa7a107..0000000
--- a/genomix/genomix-hadoop/testactual/source.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-ATAGAAGATCGA	A|T	1
-AATAGAAGATCG	|A	1
-TAGAAGATCGAT	A|	1