Mercurial > repos > mheinzl > hd
comparison hd.py @ 5:445442a6aeb0 draft
planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/hd commit dda3de3fc961976844f5f44b756fe03e39d3b0db
author | mheinzl |
---|---|
date | Tue, 15 May 2018 10:56:52 -0400 |
parents | ceb3a9b4bef5 |
children | e76e404c1719 |
comparison
equal
deleted
inserted
replaced
4:ceb3a9b4bef5 | 5:445442a6aeb0 |
---|---|
455 #ham2 = [] | 455 #ham2 = [] |
456 #min_valueList = [] | 456 #min_valueList = [] |
457 #min_tagsList = [] | 457 #min_tagsList = [] |
458 #diff11_zeros = [] | 458 #diff11_zeros = [] |
459 #min_tagsList_zeros = [] | 459 #min_tagsList_zeros = [] |
460 i = 0 # counter, only used to see how many HDs of tags were already calculated | 460 c = 0 # counter, only used to see how many HDs of tags were already calculated |
461 if mate_b is False: # HD calculation for all a's | 461 if mate_b is False: # HD calculation for all a's |
462 half1_mate1 = array1_half | 462 half1_mate1 = array1_half |
463 half2_mate1 = array1_half2 | 463 half2_mate1 = array1_half2 |
464 half1_mate2 = array2_half | 464 half1_mate2 = array2_half |
465 half2_mate2 = array2_half2 | 465 half2_mate2 = array2_half2 |
494 d = d_2 | 494 d = d_2 |
495 d2 = d_1 | 495 d2 = d_1 |
496 else: # half1, corrects the variable of the HD from both halfs if it is a or b | 496 else: # half1, corrects the variable of the HD from both halfs if it is a or b |
497 d = d_1 | 497 d = d_1 |
498 d2 = d_2 | 498 d2 = d_2 |
499 min_valueList[i] = d + d2 | 499 min_valueList[c] = d + d2 |
500 min_tagsList[i] = tag | 500 min_tagsList[c] = tag |
501 ham1.append[i] = d | 501 ham1.append[c] = d |
502 ham2.append[i] = d2 | 502 ham2.append[c] = d2 |
503 difference1 = abs(d - d2) | 503 difference1 = abs(d - d2) |
504 diff11[i] = difference1 | 504 diff11[c] = difference1 |
505 rel_difference = round(float(difference1) / (d + d2), 1) | 505 rel_difference = round(float(difference1) / (d + d2), 1) |
506 relativeDiffList[i] = rel_difference | 506 relativeDiffList[c] = rel_difference |
507 | 507 |
508 #### tags which have identical parts: | 508 #### tags which have identical parts: |
509 if d == 0 or d2 == 0: | 509 if d == 0 or d2 == 0: |
510 min_tagsList_zeros[i] = tag | 510 min_tagsList_zeros[c] = tag |
511 difference1_zeros = abs(d - d2) | 511 difference1_zeros = abs(d - d2) |
512 diff11_zeros[i] = difference1_zeros | 512 diff11_zeros[c] = difference1_zeros |
513 i += 1 | 513 c += 1 |
514 | 514 |
515 #print(i) | 515 #print(i) |
516 diff11 = [st for st in diff11 if st != 999] | 516 diff11 = [st for st in diff11 if st != 999] |
517 ham1 = [st for st in ham1 if st != 999] | 517 ham1 = [st for st in ham1 if st != 999] |
518 ham2 = [st for st in ham2 if st != 999] | 518 ham2 = [st for st in ham2 if st != 999] |
709 files = [file1] | 709 files = [file1] |
710 name1 = name1.split(".tabular")[0] | 710 name1 = name1.split(".tabular")[0] |
711 names = [name1] | 711 names = [name1] |
712 pdf_files = [title_savedFile_pdf] | 712 pdf_files = [title_savedFile_pdf] |
713 csv_files = [title_savedFile_csv] | 713 csv_files = [title_savedFile_csv] |
714 | |
715 print(type(onlyDuplicates)) | |
716 print(onlyDuplicates) | |
717 | 714 |
718 for f, name_file, pdf_f, csv_f in zip(files, names, pdf_files, csv_files): | 715 for f, name_file, pdf_f, csv_f in zip(files, names, pdf_files, csv_files): |
719 with open(csv_f, "w") as output_file, PdfPages(pdf_f) as pdf: | 716 with open(csv_f, "w") as output_file, PdfPages(pdf_f) as pdf: |
720 print("dataset: ", name_file) | 717 print("dataset: ", name_file) |
721 integers, data_array = readFileReferenceFree(f) | 718 integers, data_array = readFileReferenceFree(f) |