minimal_alleles = ht.prune_overshadowed_alleles(temp_pruned) if VERBOSE: print("\n", ht.now(), 'Keeping only the minimal number of required alleles', minimal_alleles.shape) binary = binary[minimal_alleles] if VERBOSE: print("\n", ht.now(), 'Creating compact model...') if is_paired and unpaired_weight > 0: if use_discordant: compact_mtx, compact_occ = ht.get_compact_model( binary_p[minimal_alleles], pd.concat([binary_un, binary_mis])[minimal_alleles], weight=unpaired_weight) else: compact_mtx, compact_occ = ht.get_compact_model( binary_p[minimal_alleles], binary_un[minimal_alleles], weight=unpaired_weight) else: compact_mtx, compact_occ = ht.get_compact_model(binary) allele_ids = binary.columns groups_4digit = defaultdict(list) for allele in allele_ids: type_4digit = get_4digit(allele) groups_4digit[type_4digit].append(allele)
temp_pruned = ht.prune_identical_reads(unique_col) if args.verbose: print "\n", ht.now(), 'Size of mtx with unique rows and columns:', temp_pruned.shape print ht.now(), 'determining minimal set of non-overshadowed alleles' minimal_alleles = ht.prune_overshadowed_alleles(temp_pruned) if args.verbose: print "\n", ht.now(), 'Keeping only the minimal number of required alleles', minimal_alleles.shape binary = binary[minimal_alleles] if args.verbose: print "\n", ht.now(), 'Creating compact model...' compact_mtx, compact_occ = ht.get_compact_model(binary) allele_ids = binary.columns groups_4digit = defaultdict(list) for allele in allele_ids: type_4digit = get_4digit(allele) groups_4digit[type_4digit].append(allele) sparse_dict = ht.mtx_to_sparse_dict(compact_mtx) if args.verbose: print "\n", ht.now(), 'Initializing OptiType model...' op = OptiType(sparse_dict, compact_occ, groups_4digit, table, args.beta, 2, config.get("OPTIMIZATION", "SOLVER"), config.get("OPTIMIZATION", "THREADS"), verbosity=verbosity)
if args.verbose: print "\n", ht.now( ), 'Size of mtx with unique rows and columns:', temp_pruned.shape print ht.now(), 'determining minimal set of non-overshadowed alleles' minimal_alleles = ht.prune_overshadowed_alleles(temp_pruned) if args.verbose: print "\n", ht.now( ), 'Keeping only the minimal number of required alleles', minimal_alleles.shape binary = binary[minimal_alleles] if args.verbose: print "\n", ht.now(), 'Creating compact model...' compact_mtx, compact_occ = ht.get_compact_model(binary) allele_ids = binary.columns groups_4digit = defaultdict(list) for allele in allele_ids: type_4digit = get_4digit(allele) groups_4digit[type_4digit].append(allele) sparse_dict = ht.mtx_to_sparse_dict(compact_mtx) if args.verbose: print "\n", ht.now(), 'Initializing OptiType model...' op = OptiType(sparse_dict, compact_occ,
print("\n", ht.now(), 'Size of mtx with unique rows and columns:', temp_pruned.shape) print(ht.now(), 'determining minimal set of non-overshadowed alleles') minimal_alleles = ht.prune_overshadowed_alleles(temp_pruned) if VERBOSE: print("\n", ht.now(), 'Keeping only the minimal number of required alleles', minimal_alleles.shape) binary = binary[minimal_alleles] if VERBOSE: print("\n", ht.now(), 'Creating compact model...') if is_paired and unpaired_weight > 0: if use_discordant: compact_mtx, compact_occ = ht.get_compact_model(binary_p[minimal_alleles], pd.concat([binary_un, binary_mis])[minimal_alleles], weight=unpaired_weight) else: compact_mtx, compact_occ = ht.get_compact_model(binary_p[minimal_alleles], binary_un[minimal_alleles], weight=unpaired_weight) else: compact_mtx, compact_occ = ht.get_compact_model(binary) allele_ids = binary.columns groups_4digit = defaultdict(list) for allele in allele_ids: type_4digit = get_4digit(allele) groups_4digit[type_4digit].append(allele) sparse_dict = ht.mtx_to_sparse_dict(compact_mtx) threads = get_num_threads(config.getint("ilp", "threads"))