# -*- coding: utf-8 -*-
"""
Created on Mon Jan 25 16:07:28 2016

@author: Miya
"""

"""
This script is important. It fix the index problems of the step2 result.
requires argument:
1. original input
2. step2 output
"""

import sys

if len(sys.argv) < 1 + 2:
    sys.stderr.write("argument: 1. original input; 2. step2 output. output is at stdout")
    sys.stderr.write("\n")
    sys.exit(1)
    
fstep2 = sys.argv[1];
foutput = sys.argv[2];


index = [];
with open(fstep2, 'r') as f:
    for line in f:
        spl = line.strip().split("\t");
        index.append(spl[0]);

value = [];
with open(foutput, 'r') as f:
    for line in f:
        spl = line.strip().split("\t");
        value.append(spl[1]);
        
for p in zip(index, value):
    print(p[0] + "\t" + p[1])


