changeset 31:7df7bee710ad draft

Uploaded
author charles-bernard
date Sun, 18 Dec 2016 09:50:39 -0500
parents 1c9cea51dc24
children b26aec436ab5
files ALFA/ALFA_wrapper.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ALFA/ALFA_wrapper.py	Sun Dec 18 09:33:46 2016 -0500
+++ b/ALFA/ALFA_wrapper.py	Sun Dec 18 09:50:39 2016 -0500
@@ -60,10 +60,11 @@
     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]
+        cur_label = reads_list[i+1].split('__label__')[1]
+        reads_labels[k] = re.sub(r' ', '_', cur_label)
         if not reads_labels[k]:
             reads_labels[k] = 'sample_%s' % str(k)
-        input2_args='%s %s %s' % (input2_args, reads_filenames[k], reads_labels[k])
+        input2_args='%s "%s" "%s"' % (input2_args, reads_filenames[k], reads_labels[k])
         k += 1
     if format == 'bedgraph':
         input2_args = input2_args + ' --bedgraph'
@@ -85,7 +86,7 @@
 def merge_count_files(reads_labels):
     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')
+        current_count_file = open('%s.categories_counts' % reads_labels[i], 'r')
         merged_count_file.write('##LABEL: %s\n\n' % reads_labels[i])
         merged_count_file.write(current_count_file.read())
         merged_count_file.write('__________________________________________________________________\n')
@@ -106,11 +107,11 @@
     if args.indexes:
         # The indexes submitted by the user must exhibit the suffix '.(un)stranded.index' and will be called by alfa by their prefix
         index = symlink_user_indexes(args.indexes[0], args.indexes[1])
-        input1_args = '-g %s' % index
+        input1_args = '-g "%s"' % index
     elif args.bi_indexes:
-        input1_args = '-g %s' % args.bi_indexes[0]
+        input1_args = '-g "%s"' % args.bi_indexes[0]
     elif args.annotation_file:
-        input1_args = '-a %s' % args.annotation_file[0]
+        input1_args = '-a "%s"' % args.annotation_file[0]
     else:
         exit_and_explain('No annotation file submitted !')