Mercurial > repos > artbio > repenrich
comparison RepEnrich.py @ 2:15e3e29f310e draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/repenrich commit c89c33e5ea8fc63f3ea5c0f66ebc5fa822ac734b
| author | artbio |
|---|---|
| date | Tue, 19 Sep 2017 17:23:15 -0400 |
| parents | f6f0f1e5e940 |
| children | d1f7ab78f7b5 |
comparison
equal
deleted
inserted
replaced
| 1:51b4590a972d | 2:15e3e29f310e |
|---|---|
| 429 print('Writing final output and removing intermediate files...') | 429 print('Writing final output and removing intermediate files...') |
| 430 # print output to file of the categorized counts and total overlapping counts: | 430 # print output to file of the categorized counts and total overlapping counts: |
| 431 if allcountmethod == "TRUE": | 431 if allcountmethod == "TRUE": |
| 432 fout1 = open(outputfolder + os.path.sep + outputfile_prefix | 432 fout1 = open(outputfolder + os.path.sep + outputfile_prefix |
| 433 + '_total_counts.txt', 'w') | 433 + '_total_counts.txt', 'w') |
| 434 for key in reptotalcounts.keys(): | 434 for key in sorted(reptotalcounts.keys()): |
| 435 fout1.write(str(key) + '\t' + repeatclass[key] + '\t' + | 435 fout1.write(str(key) + '\t' + repeatclass[key] + '\t' + |
| 436 repeatfamily[key] + '\t' + str(reptotalcounts[key]) | 436 repeatfamily[key] + '\t' + str(reptotalcounts[key]) |
| 437 + '\n') | 437 + '\n') |
| 438 fout2 = open(outputfolder + os.path.sep + outputfile_prefix | 438 fout2 = open(outputfolder + os.path.sep + outputfile_prefix |
| 439 + '_class_total_counts.txt', 'w') | 439 + '_class_total_counts.txt', 'w') |
| 440 for key in classtotalcounts.keys(): | 440 for key in sorted(classtotalcounts.keys()): |
| 441 fout2.write(str(key) + '\t' + str(classtotalcounts[key]) + '\n') | 441 fout2.write(str(key) + '\t' + str(classtotalcounts[key]) + '\n') |
| 442 fout3 = open(outputfolder + os.path.sep + outputfile_prefix | 442 fout3 = open(outputfolder + os.path.sep + outputfile_prefix |
| 443 + '_family_total_counts.txt', 'w') | 443 + '_family_total_counts.txt', 'w') |
| 444 for key in familytotalcounts.keys(): | 444 for key in sorted(familytotalcounts.keys()): |
| 445 fout3.write(str(key) + '\t' + str(familytotalcounts[key]) + '\n') | 445 fout3.write(str(key) + '\t' + str(familytotalcounts[key]) + '\n') |
| 446 fout4 = open(outputfolder + os.path.sep + outputfile_prefix + | 446 fout4 = open(outputfolder + os.path.sep + outputfile_prefix + |
| 447 '_unique_counts.txt', 'w') | 447 '_unique_counts.txt', 'w') |
| 448 for key in repcounts2.keys(): | 448 for key in sorted(repcounts2.keys()): |
| 449 fout4.write(str(key) + '\t' + repeatclass[key] + '\t' + | 449 fout4.write(str(key) + '\t' + repeatclass[key] + '\t' + |
| 450 repeatfamily[key] + '\t' + str(repcounts2[key]) + '\n') | 450 repeatfamily[key] + '\t' + str(repcounts2[key]) + '\n') |
| 451 fout5 = open(outputfolder + os.path.sep + outputfile_prefix | 451 fout5 = open(outputfolder + os.path.sep + outputfile_prefix |
| 452 + '_class_fraction_counts.txt', 'w') | 452 + '_class_fraction_counts.txt', 'w') |
| 453 for key in classfractionalcounts.keys(): | 453 for key in sorted(classfractionalcounts.keys()): |
| 454 fout5.write(str(key) + '\t' + str(classfractionalcounts[key]) + '\n') | 454 fout5.write(str(key) + '\t' + str(classfractionalcounts[key]) + '\n') |
| 455 fout6 = open(outputfolder + os.path.sep + outputfile_prefix + | 455 fout6 = open(outputfolder + os.path.sep + outputfile_prefix + |
| 456 '_family_fraction_counts.txt', 'w') | 456 '_family_fraction_counts.txt', 'w') |
| 457 for key in familyfractionalcounts.keys(): | 457 for key in sorted(familyfractionalcounts.keys()): |
| 458 fout6.write(str(key) + '\t' + str(familyfractionalcounts[key]) + '\n') | 458 fout6.write(str(key) + '\t' + str(familyfractionalcounts[key]) + '\n') |
| 459 fout7 = open(outputfolder + os.path.sep + outputfile_prefix | 459 fout7 = open(outputfolder + os.path.sep + outputfile_prefix |
| 460 + '_fraction_counts.txt', 'w') | 460 + '_fraction_counts.txt', 'w') |
| 461 for key in fractionalcounts.keys(): | 461 for key in sorted(fractionalcounts.keys()): |
| 462 fout7.write(str(key) + '\t' + repeatclass[key] + '\t' + | 462 fout7.write(str(key) + '\t' + repeatclass[key] + '\t' + |
| 463 repeatfamily[key] + '\t' + str(int(fractionalcounts[key])) | 463 repeatfamily[key] + '\t' + str(int(fractionalcounts[key])) |
| 464 + '\n') | 464 + '\n') |
| 465 fout1.close() | 465 fout1.close() |
| 466 fout2.close() | 466 fout2.close() |
| 470 fout6.close() | 470 fout6.close() |
| 471 fout7.close() | 471 fout7.close() |
| 472 else: | 472 else: |
| 473 fout1 = open(outputfolder + os.path.sep + outputfile_prefix + | 473 fout1 = open(outputfolder + os.path.sep + outputfile_prefix + |
| 474 '_class_fraction_counts.txt', 'w') | 474 '_class_fraction_counts.txt', 'w') |
| 475 for key in classfractionalcounts.keys(): | 475 for key in sorted(classfractionalcounts.keys()): |
| 476 fout1.write(str(key) + '\t' + str(classfractionalcounts[key]) + '\n') | 476 fout1.write(str(key) + '\t' + str(classfractionalcounts[key]) + '\n') |
| 477 fout2 = open(outputfolder + os.path.sep + outputfile_prefix + | 477 fout2 = open(outputfolder + os.path.sep + outputfile_prefix + |
| 478 '_family_fraction_counts.txt', 'w') | 478 '_family_fraction_counts.txt', 'w') |
| 479 for key in familyfractionalcounts.keys(): | 479 for key in sorted(familyfractionalcounts.keys()): |
| 480 fout2.write(str(key) + '\t' + str(familyfractionalcounts[key]) + '\n') | 480 fout2.write(str(key) + '\t' + str(familyfractionalcounts[key]) + '\n') |
| 481 fout3 = open(outputfolder + os.path.sep + outputfile_prefix + | 481 fout3 = open(outputfolder + os.path.sep + outputfile_prefix + |
| 482 '_fraction_counts.txt', 'w') | 482 '_fraction_counts.txt', 'w') |
| 483 for key in fractionalcounts.keys(): | 483 for key in sorted(fractionalcounts.keys()): |
| 484 fout3.write(str(key) + '\t' + repeatclass[key] + '\t' + | 484 fout3.write(str(key) + '\t' + repeatclass[key] + '\t' + |
| 485 repeatfamily[key] + '\t' + str(int(fractionalcounts[key])) | 485 repeatfamily[key] + '\t' + str(int(fractionalcounts[key])) |
| 486 + '\n') | 486 + '\n') |
| 487 fout1.close() | 487 fout1.close() |
| 488 fout2.close() | 488 fout2.close() |
