comparison ALFA/ALFA_wrapper.py @ 32:b26aec436ab5 draft

Uploaded
author charles-bernard
date Thu, 21 Dec 2017 09:29:26 -0500
parents 7df7bee710ad
children
comparison
equal deleted inserted replaced
31:7df7bee710ad 32:b26aec436ab5
52 52
53 def get_input2_args(reads_list, format): 53 def get_input2_args(reads_list, format):
54 n = len(reads_list) 54 n = len(reads_list)
55 if n%2 != 0: 55 if n%2 != 0:
56 exit_and_explain('Problem with pairing reads filename and reads label') 56 exit_and_explain('Problem with pairing reads filename and reads label')
57 if format == 'bam':
58 input2_args = '--bam'
59 elif format == 'begraph':
60 input2_args = '--bedgraph'
57 input2_args='-i' 61 input2_args='-i'
58 k = 0 62 k = 0
59 reads_filenames = [''] * (n/2) 63 reads_filenames = [''] * (n/2)
60 reads_labels = [''] * (n/2) 64 reads_labels = [''] * (n/2)
61 for i in range(0, n, 2): 65 for i in range(0, n, 2):
64 reads_labels[k] = re.sub(r' ', '_', cur_label) 68 reads_labels[k] = re.sub(r' ', '_', cur_label)
65 if not reads_labels[k]: 69 if not reads_labels[k]:
66 reads_labels[k] = 'sample_%s' % str(k) 70 reads_labels[k] = 'sample_%s' % str(k)
67 input2_args='%s "%s" "%s"' % (input2_args, reads_filenames[k], reads_labels[k]) 71 input2_args='%s "%s" "%s"' % (input2_args, reads_filenames[k], reads_labels[k])
68 k += 1 72 k += 1
69 if format == 'bedgraph':
70 input2_args = input2_args + ' --bedgraph'
71 return input2_args, reads_filenames, reads_labels 73 return input2_args, reads_filenames, reads_labels
72 74
73 def redirect_errors(alfa_out, alfa_err): 75 def redirect_errors(alfa_out, alfa_err):
74 # When the option --n is enabled, alfa prints '### End of the program' in stderr even if the process worked- 76 # When the option --n is enabled, alfa prints '### End of the program' in stderr even if the process worked-
75 # The following lines to avoid the tool from crashing in this case 77 # The following lines to avoid the tool from crashing in this case