Mercurial > repos > bebatut > convert_extract_sequence_file
comparison convert_extract_sequence_file.py @ 1:d7747e6f329f draft default tip
planemo upload commit 0a1bbb0870f6b776175151d4bc818c5546731ca8-dirty
| author | bebatut |
|---|---|
| date | Thu, 28 Apr 2016 08:34:50 -0400 |
| parents | b4cf778be846 |
| children |
comparison
equal
deleted
inserted
replaced
| 0:b4cf778be846 | 1:d7747e6f329f |
|---|---|
| 40 id_line = get_new_line(input_file, generate_error = False) | 40 id_line = get_new_line(input_file, generate_error = False) |
| 41 if id_line == None: | 41 if id_line == None: |
| 42 return None | 42 return None |
| 43 split_line = id_line[1:].split(' ') | 43 split_line = id_line[1:].split(' ') |
| 44 seq_id = split_line[0] | 44 seq_id = split_line[0] |
| 45 description = ' '.join(split_line[1:]) | 45 description = id_line[1:] |
| 46 new_line = get_new_line(input_file, generate_error = False) | 46 new_line = get_new_line(input_file, generate_error = False) |
| 47 seq = '' | 47 seq = '' |
| 48 while new_line != None: | 48 while new_line != None: |
| 49 if new_line[0] != '>': | 49 if new_line[0] != '>': |
| 50 seq += new_line | 50 seq += new_line |
| 263 # Other functions | 263 # Other functions |
| 264 def save_conserved_records(self,args): | 264 def save_conserved_records(self,args): |
| 265 if args.custom_extraction_type == 'True': | 265 if args.custom_extraction_type == 'True': |
| 266 to_extract = args.to_extract[1:-1].split(',') | 266 to_extract = args.to_extract[1:-1].split(',') |
| 267 with open(args.output_information, 'w') as output_information_file: | 267 with open(args.output_information, 'w') as output_information_file: |
| 268 output_information_file.write('\t'.join(to_extract) + '\n') | 268 #output_information_file.write('\t'.join(to_extract) + '\n') |
| 269 for record in self.conserved_records: | 269 for record in self.conserved_records: |
| 270 extracted_info = record.extract_information(to_extract) | 270 extracted_info = record.extract_information(to_extract) |
| 271 string_info = [str(info) for info in extracted_info] | 271 string_info = [str(info) for info in extracted_info] |
| 272 string = '\t'.join(string_info) | 272 string = '\t'.join(string_info) |
| 273 output_information_file.write(string + '\n') | 273 output_information_file.write(string + '\n') |
