Mercurial > repos > earlhaminst > replace_chromosome_names
comparison replace_chromosome_names.py @ 1:6c0373cc070f draft default tip
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/replace_chromosome_names/ commit c8418d1d7657dacae7f81fe4aa0aba051873d4ad
author | earlhaminst |
---|---|
date | Tue, 13 Jun 2017 14:43:07 -0400 |
parents | 97c11d04cd4c |
children |
comparison
equal
deleted
inserted
replaced
0:97c11d04cd4c | 1:6c0373cc070f |
---|---|
30 print(line, file=args.output) | 30 print(line, file=args.output) |
31 else: | 31 else: |
32 line_cols = line.split('\t') | 32 line_cols = line.split('\t') |
33 for col_to_map in cols_to_map: | 33 for col_to_map in cols_to_map: |
34 old_value = line_cols[col_to_map] | 34 old_value = line_cols[col_to_map] |
35 line_cols[col_to_map] = map_dict.get(old_value, old_value) | 35 new_value = map_dict.get(old_value, '') |
36 mapped_line = '\t'.join(line_cols) | 36 if not new_value: |
37 print(mapped_line, file=args.output) | 37 print('%s has no valid mapping, skipping line: %s' % (old_value, line), file=sys.stderr) |
38 break | |
39 line_cols[col_to_map] = new_value | |
40 else: | |
41 mapped_line = '\t'.join(line_cols) | |
42 print(mapped_line, file=args.output) | |
38 | 43 |
39 | 44 |
40 if __name__ == "__main__": | 45 if __name__ == "__main__": |
41 main() | 46 main() |