#!usr/bin/env python

import sys 

file_open = open(sys.argv[1],'r').readlines() 
file_out = open(sys.argv[2],'w') 

switch = 0 
for lines in file_open:
    if '>' in lines:
        if switch == 0:
            file_out.write(lines.strip() + "\t")
            seq_length = 0
            switch = 1
        elif switch == 1:
            file_out.write(str(seq_length) + "\n" + lines.strip() + "\t")
            seq_length = 0
    else:
        seq_length+=len(lines.strip())
file_out.write(str(seq_length))

@@ -1,10 +1,11 @@
 #!
+/
 usr/bin/
@@ -20,232 +20,337 @@
 on%0A%0A
-import sys %0A%0Afile_open = open(sys.argv%5B1%5D,'r').readlines() %0Afile_out = open(sys.argv%5B2%5D,'w') %0A%0Aswitch = 0 %0Afor lines in file_open:%0A    if '%3E' in lines:%0A        if switch == 0:%0A            file_out.write(lines.strip() + %22%5Ct
+#USAGE: python merge_counts.py dry/ dry.counts%0A%0Aimport os%0Aimport sys%0Afrom os import path%0Aimport pandas as pd%0A%0A%0A# get txp names as index%0Alistofsamples = os.listdir(sys.argv%5B1%5D)%0Aquants = %7B%7D%0Adata = None%0Afor sample in listofsamples:%0A    if os.path.isdir(sys.argv%5B1%5D+sample):%0A        if os.path.isfile(sys.argv%5B1%5D+sample+%22/quant.sf
 %22)
+:
 %0A   
@@ -362,144 +362,110 @@
     
-seq_length = 0%0A            switch = 1%0A        elif switch == 1:%0A            file_out.write(str(seq_length) + %22%5Cn%22 + lines.strip() + %22%5Ct%22
+quant_file = sys.argv%5B1%5D+sample+%22/quant.sf%22%0A            data=pd.DataFrame.from_csv(quant_file,sep='%5Ct'
 )%0A  
@@ -478,100 +478,180 @@
     
-seq_length = 0%0A    else:%0A        seq_length+=len(lines.strip())%0Afile_out.write(str(seq_length)
+numreads = data%5B'NumReads'%5D%0A            quants%5Bsample%5D = numreads%0A%0Acounts = pd.DataFrame.from_dict(quants)%0Acounts.set_index(data.index,inplace=True)%0Acounts.to_csv(sys.argv%5B2%5D
 )%0A

add usage and take input from sys_argv