diff ALFA/ALFA_wrapper.py @ 29:c8acc8808b52 draft

Uploaded
author charles-bernard
date Sat, 19 Nov 2016 04:25:42 -0500
parents 2496883e588b
children 1c9cea51dc24
line wrap: on
line diff
--- a/ALFA/ALFA_wrapper.py	Fri Nov 04 06:12:07 2016 -0400
+++ b/ALFA/ALFA_wrapper.py	Sat Nov 19 04:25:42 2016 -0500
@@ -48,8 +48,6 @@
     index='index'
     os.symlink(stranded_index, index + '.stranded.index')
     os.symlink(unstranded_index, index + '.unstranded.index')
-    #shutil.copy(stranded_index, index + '.stranded.index')
-    #shutil.copy(unstranded_index, index + '.unstranded.index')
     return index
 
 def get_input2_args(reads_list, format):
@@ -57,14 +55,14 @@
     if n%2 != 0:
         exit_and_explain('Problem with pairing reads filename and reads label')
     input2_args='-i'
-    k = 0
+    k = 1
     reads_filenames = [''] * (n/2)
     reads_labels = [''] * (n/2)
     for i in range(0, n, 2):
         reads_filenames[k] = reads_list[i].split('__fname__')[1]
         reads_labels[k] = reads_list[i+1].split('__label__')[1]
         if not reads_labels[k]:
-            reads_labels[k] = 'sample_%s' % str(k+1)
+            reads_labels[k] = 'sample_%s' % str(k)
         input2_args='%s %s %s' % (input2_args, reads_filenames[k], reads_labels[k])
         k += 1
     if format == 'bedgraph':
@@ -88,8 +86,7 @@
     merged_count_file = open('count_file.txt', 'wb')
     for i in range(0, len(reads_labels)):
         current_count_file = open(reads_labels[i] + '.categories_counts', 'r')
-        reads_label = reads_labels[i]
-        merged_count_file.write('##LABEL: %s\n\n' % reads_label)
+        merged_count_file.write('##LABEL: %s\n\n' % reads_label[i])
         merged_count_file.write(current_count_file.read())
         merged_count_file.write('__________________________________________________________________\n')
         current_count_file.close()
@@ -180,4 +177,4 @@
             shutil.move(args.bi_indexes[1] + '.unstranded.index', args.output_index[1])
 
     cleanup_before_exit(tmp_dir)
-main()
\ No newline at end of file
+main()