comparison ALFA/ALFA_wrapper.py @ 30:1c9cea51dc24 draft

Uploaded
author charles-bernard
date Sun, 18 Dec 2016 09:33:46 -0500
parents c8acc8808b52
children 7df7bee710ad
comparison
equal deleted inserted replaced
29:c8acc8808b52 30:1c9cea51dc24
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 input2_args='-i' 57 input2_args='-i'
58 k = 1 58 k = 0
59 reads_filenames = [''] * (n/2) 59 reads_filenames = [''] * (n/2)
60 reads_labels = [''] * (n/2) 60 reads_labels = [''] * (n/2)
61 for i in range(0, n, 2): 61 for i in range(0, n, 2):
62 reads_filenames[k] = reads_list[i].split('__fname__')[1] 62 reads_filenames[k] = reads_list[i].split('__fname__')[1]
63 reads_labels[k] = reads_list[i+1].split('__label__')[1] 63 reads_labels[k] = reads_list[i+1].split('__label__')[1]
84 84
85 def merge_count_files(reads_labels): 85 def merge_count_files(reads_labels):
86 merged_count_file = open('count_file.txt', 'wb') 86 merged_count_file = open('count_file.txt', 'wb')
87 for i in range(0, len(reads_labels)): 87 for i in range(0, len(reads_labels)):
88 current_count_file = open(reads_labels[i] + '.categories_counts', 'r') 88 current_count_file = open(reads_labels[i] + '.categories_counts', 'r')
89 merged_count_file.write('##LABEL: %s\n\n' % reads_label[i]) 89 merged_count_file.write('##LABEL: %s\n\n' % reads_labels[i])
90 merged_count_file.write(current_count_file.read()) 90 merged_count_file.write(current_count_file.read())
91 merged_count_file.write('__________________________________________________________________\n') 91 merged_count_file.write('__________________________________________________________________\n')
92 current_count_file.close() 92 current_count_file.close()
93 merged_count_file.close() 93 merged_count_file.close()
94 return 'count_file.txt' 94 return 'count_file.txt'