Mercurial > repos > iuc > checkm_qa
comparison format_taxon_list.py @ 0:5c0493cdced9 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/checkm commit 2a3b068a98bf0e913dc03e0d5c2182cfd102cf27
| author | iuc | 
|---|---|
| date | Fri, 29 Jul 2022 20:34:59 +0000 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| -1:000000000000 | 0:5c0493cdced9 | 
|---|---|
| 1 from pathlib import Path | |
| 2 | |
| 3 from checkm.taxonParser import TaxonParser | |
| 4 from checkm.util.taxonomyUtils import taxonomicRanks | |
| 5 | |
| 6 if __name__ == '__main__': | |
| 7 tool_data_dp = Path('tool-data') | |
| 8 | |
| 9 # get all available marker sets | |
| 10 taxonParser = TaxonParser() | |
| 11 taxonMarkerSets = taxonParser.readMarkerSets() | |
| 12 | |
| 13 # create a table per rank | |
| 14 for rank in taxonomicRanks: | |
| 15 rank_fp = tool_data_dp / Path("%s.loc.sample" % rank) | |
| 16 with rank_fp.open('w') as rank_f: | |
| 17 rank_f.write('# File generated by format_taxon_list.py script\n') | |
| 18 rank_f.write('# taxon\tdescription\n') | |
| 19 for taxon in sorted(taxonMarkerSets[rank]): | |
| 20 markerSet = taxonMarkerSets[rank][taxon] | |
| 21 numMarkers, numMarkerSets = markerSet.size() | |
| 22 rank_f.write('{taxon}\t{taxon} ({markerSet.numGenomes} genomes, {numMarkers} marker genes, {numMarkerSets} marker sets)\n') | 
