Mercurial > repos > bebatut > format_metaphlan2_output
annotate format_metaphlan2_output.py @ 0:2bfa9b200600 draft
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
author | bebatut |
---|---|
date | Wed, 20 Apr 2016 07:52:41 -0400 |
parents | |
children | 1e74cb2c8e67 |
rev | line source |
---|---|
0
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
1 #!/usr/bin/env python |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
3 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
4 import sys |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
5 import os |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
6 import argparse |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
7 import re |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
8 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
9 taxo_level_correspondance = {} |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
10 taxo_level_correspondance['k'] = 'kingdom' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
11 taxo_level_correspondance['p'] = 'phylum' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
12 taxo_level_correspondance['c'] = 'class' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
13 taxo_level_correspondance['o'] = 'order' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
14 taxo_level_correspondance['f'] = 'family' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
15 taxo_level_correspondance['g'] = 'genus' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
16 taxo_level_correspondance['s'] = 'species' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
17 taxo_level_correspondance['t'] = 'strains' |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
18 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
19 def write_taxo_abundance(output_files, level, taxo, abundance): |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
20 if not taxo_level_correspondance.has_key(level): |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
21 raise ValueError(level + ' is not a know taxonomic level') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
22 output_files[taxo_level_correspondance[level]].write(taxo + '\t') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
23 output_files[taxo_level_correspondance[level]].write(abundance + '\n') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
24 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
25 def format_metaphlan2_output(args): |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
26 taxo_levels_abundance_files = {} |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
27 taxo_levels_abundance_files['kingdom'] = open(args.kingdom_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
28 taxo_levels_abundance_files['phylum'] = open(args.phylum_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
29 taxo_levels_abundance_files['class'] = open(args.class_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
30 taxo_levels_abundance_files['order'] = open(args.order_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
31 taxo_levels_abundance_files['family'] = open(args.family_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
32 taxo_levels_abundance_files['genus'] = open(args.genus_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
33 taxo_levels_abundance_files['species'] = open(args.species_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
34 taxo_levels_abundance_files['strains'] = open(args.strains_abundance_file, 'w') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
35 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
36 for taxo_level_file in taxo_levels_abundance_files: |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
37 taxo_levels_abundance_files[taxo_level_file].write(taxo_level_file + '\t') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
38 taxo_levels_abundance_files[taxo_level_file].write('abundance\n') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
39 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
40 with open(args.metaphlan2_output, 'r') as input_file: |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
41 with open(args.all_taxo_level_abundance_file, 'w') as output_file: |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
42 output_file.write("kingdom\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
43 output_file.write("phylum\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
44 output_file.write("class\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
45 output_file.write("order\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
46 output_file.write("family\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
47 output_file.write("genus\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
48 output_file.write("species\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
49 output_file.write("strains\t") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
50 output_file.write("abundance\n") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
51 levels_number = 8 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
52 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
53 for line in input_file.readlines(): |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
54 if line.startswith("#"): |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
55 continue |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
56 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
57 split_line = line[:-1].split('\t') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
58 all_taxo = split_line[0] |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
59 abundance = split_line[1] |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
60 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
61 split_taxo = all_taxo.split('|') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
62 for level in split_taxo: |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
63 taxo = level.split('__')[1] |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
64 taxo = taxo.replace("_"," ") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
65 output_file.write(taxo + '\t') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
66 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
67 for i in range(len(split_taxo), levels_number): |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
68 output_file.write('\t') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
69 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
70 output_file.write(abundance + "\n") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
71 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
72 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
73 last_taxo_level = split_taxo[-1].split('__') |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
74 taxo = last_taxo_level[1].replace("_"," ") |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
75 level = last_taxo_level[0] |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
76 write_taxo_abundance(taxo_levels_abundance_files, level, taxo, |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
77 abundance) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
78 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
79 for taxo_level_file in taxo_levels_abundance_files: |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
80 taxo_levels_abundance_files[taxo_level_file].close() |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
81 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
82 if __name__ == '__main__': |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
83 parser = argparse.ArgumentParser() |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
84 parser.add_argument('--metaphlan2_output', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
85 parser.add_argument('--all_taxo_level_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
86 parser.add_argument('--kingdom_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
87 parser.add_argument('--phylum_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
88 parser.add_argument('--class_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
89 parser.add_argument('--order_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
90 parser.add_argument('--family_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
91 parser.add_argument('--genus_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
92 parser.add_argument('--species_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
93 parser.add_argument('--strains_abundance_file', required=True) |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
94 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
95 args = parser.parse_args() |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
96 |
2bfa9b200600
planemo upload for repository https://github.com/ASaiM/galaxytools/tree/master/tools/format_metaphlan2_output/ commit 36388cac89e4ffa55fe317d10cbf97346ab00a71-dirty
bebatut
parents:
diff
changeset
|
97 format_metaphlan2_output(args) |