Skip to content

Commit

Permalink
v1.7.1-meta-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinggerm committed Jul 27, 2020
1 parent 37023db commit 4742ef8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
10 changes: 6 additions & 4 deletions Utilities/disentangle_organelle_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def disentangle_circular_assembly(fastg_file, tab_file, prefix, weight_factor, t
if acyclic_allowed:
# still_complete = []
for go_res, copy_res in enumerate(copy_results):
go_res += 1
broken_graph = copy_res["graph"]
count_path = 0

Expand Down Expand Up @@ -237,11 +238,12 @@ def disentangle_circular_assembly(fastg_file, tab_file, prefix, weight_factor, t
# still_complete.append(True)
# else:
# still_complete.append(False)
open(prefix + ".graph" + str(go_res + 1) + other_tag + "." + str(count_path) +
open(prefix + ".graph" + str(go_res) + other_tag + "." + str(count_path) +
".path_sequence.fasta", "w").write("\n".join(all_contig_str))
broken_graph.write_to_gfa(prefix + ".graph" + str(go_res + 1) + ".selected_graph.gfa")
broken_graph.write_to_gfa(prefix + ".graph" + str(go_res) + ".selected_graph.gfa")
else:
for go_res, copy_res in enumerate(copy_results):
go_res += 1
idealized_graph = copy_res["graph"]
# should add making one-step-inversion pairs for paths,
# which would be used to identify existence of a certain isomer using mapping information
Expand All @@ -265,7 +267,7 @@ def disentangle_circular_assembly(fastg_file, tab_file, prefix, weight_factor, t
this_seq_obj = idealized_graph.export_path(this_path)
if DEGENERATE_BASES & set(this_seq_obj.seq):
degenerate_base_used = True
open(prefix + ".graph" + str(go_res + 1) + other_tag + "." + str(count_path) +
open(prefix + ".graph" + str(go_res) + other_tag + "." + str(count_path) +
".path_sequence.fasta", "w").write(this_seq_obj.fasta_str())
# print ir stat
if count_path == 1 and mode == "embplant_pt":
Expand All @@ -278,7 +280,7 @@ def disentangle_circular_assembly(fastg_file, tab_file, prefix, weight_factor, t
inner_logging.info(print_str)
else:
sys.stdout.write(print_str + "\n")
idealized_graph.write_to_gfa(prefix + ".graph" + str(go_res + 1) + ".selected_graph.gfa")
idealized_graph.write_to_gfa(prefix + ".graph" + str(go_res) + ".selected_graph.gfa")
if degenerate_base_used:
inner_logging.warning("Degenerate base(s) used!")
time_d = time.time()
Expand Down
10 changes: 5 additions & 5 deletions get_organelle_from_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def disentangle_inside(fastg_f, tab_f, o_p, w_f, log_in, type_f=3., mode_in="emb
contig_num = set()
still_complete = []
for go_res, res in enumerate(target_results):

go_res += 1
broken_graph = res["graph"]
count_path = 0

Expand Down Expand Up @@ -672,29 +672,29 @@ def disentangle_inside(fastg_f, tab_f, o_p, w_f, log_in, type_f=3., mode_in="emb
log_in.info(
"Writing PATH" + str(count_path) + " of nearly-complete " + mode_in + " to " + out_n)
else:
out_n = o_p + ".scaffolds.graph" + str(go_res + 1) + other_tag + "." + \
out_n = o_p + ".scaffolds.graph" + str(go_res) + other_tag + "." + \
str(count_path) + ".path_sequence.fasta"
log_in.info("Writing PATH" + str(count_path) + " of " + mode_in +
" scaffold(s) to " + out_n)
open(out_n, "w").write("\n".join(all_contig_str))
if set(still_complete[-len(these_paths):]) == {"complete"}:
this_out_base = o_p + ".complete.graph" + str(go_res + 1) + ".selected_graph."
this_out_base = o_p + ".complete.graph" + str(go_res) + ".selected_graph."
log_in.info("Writing GRAPH to " + this_out_base + "gfa")
broken_graph.write_to_gfa(this_out_base + "gfa")
image_produced = draw_assembly_graph_using_bandage(
input_graph_file=this_out_base + "gfa", output_image_file=this_out_base + "png",
assembly_graph_ob=broken_graph, log_handler=log_handler, verbose_log=verbose_in,
which_bandage=options.which_bandage)
elif set(still_complete[-len(these_paths):]) == {"nearly-complete"}:
this_out_base = o_p + ".nearly-complete.graph" + str(go_res + 1) + ".selected_graph."
this_out_base = o_p + ".nearly-complete.graph" + str(go_res) + ".selected_graph."
log_in.info("Writing GRAPH to " + this_out_base + "gfa")
broken_graph.write_to_gfa(this_out_base + "gfa")
image_produced = draw_assembly_graph_using_bandage(
input_graph_file=this_out_base + "gfa", output_image_file=this_out_base + "png",
assembly_graph_ob=broken_graph, log_handler=log_handler, verbose_log=verbose_in,
which_bandage=options.which_bandage)
else:
this_out_base = o_p + ".contigs.graph" + str(go_res + 1) + ".selected_graph."
this_out_base = o_p + ".contigs.graph" + str(go_res) + ".selected_graph."
log_in.info("Writing GRAPH to " + this_out_base + "gfa")
broken_graph.write_to_gfa(this_out_base + "gfa")
image_produced = draw_assembly_graph_using_bandage(
Expand Down
9 changes: 5 additions & 4 deletions get_organelle_from_reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -3361,6 +3361,7 @@ def disentangle_inside(fastg_f, tab_f, o_p, w_f, log_in, type_f=3., mode_in="emb
contig_num = set()
still_complete = []
for go_res, res in enumerate(target_results):
go_res += 1
broken_graph = res["graph"]
count_path = 0
these_paths = broken_graph.get_all_paths(mode=mode_in, log_handler=log_in)
Expand Down Expand Up @@ -3414,14 +3415,14 @@ def disentangle_inside(fastg_f, tab_f, o_p, w_f, log_in, type_f=3., mode_in="emb
log_in.info(
"Writing PATH" + str(count_path) + " of nearly-complete " + mode_in + " to " + out_n)
else:
out_n = o_p + ".scaffolds.graph" + str(go_res + 1) + other_tag + "." + \
out_n = o_p + ".scaffolds.graph" + str(go_res) + other_tag + "." + \
str(count_path) + ".path_sequence.fasta"
log_in.info(
"Writing PATH" + str(count_path) + " of " + mode_in + " scaffold(s) to " + out_n)
open(out_n, "w").write("\n".join(all_contig_str))

if set(still_complete[-len(these_paths):]) == {"complete"}:
this_out_base = o_p + ".complete.graph" + str(go_res + 1) + ".selected_graph."
this_out_base = o_p + ".complete.graph" + str(go_res) + ".selected_graph."
log_in.info("Writing GRAPH to " + this_out_base + "gfa")
broken_graph.write_to_gfa(this_out_base + "gfa")
image_produced = draw_assembly_graph_using_bandage(
Expand All @@ -3430,7 +3431,7 @@ def disentangle_inside(fastg_f, tab_f, o_p, w_f, log_in, type_f=3., mode_in="emb
assembly_graph_ob=broken_graph,
log_handler=log_handler, verbose_log=verbose_in, which_bandage=options.which_bandage)
elif set(still_complete[-len(these_paths):]) == {"nearly-complete"}:
this_out_base = o_p + ".nearly-complete.graph" + str(go_res + 1) + ".selected_graph."
this_out_base = o_p + ".nearly-complete.graph" + str(go_res) + ".selected_graph."
log_in.info("Writing GRAPH to " + this_out_base + "gfa")
broken_graph.write_to_gfa(this_out_base + "gfa")
image_produced = draw_assembly_graph_using_bandage(
Expand All @@ -3439,7 +3440,7 @@ def disentangle_inside(fastg_f, tab_f, o_p, w_f, log_in, type_f=3., mode_in="emb
assembly_graph_ob=broken_graph,
log_handler=log_handler, verbose_log=verbose_in, which_bandage=options.which_bandage)
else:
this_out_base = o_p + ".contigs.graph" + str(go_res + 1) + ".selected_graph."
this_out_base = o_p + ".contigs.graph" + str(go_res) + ".selected_graph."
log_in.info("Writing GRAPH to " + this_out_base + "gfa")
broken_graph.write_to_gfa(this_out_base + "gfa")
image_produced = draw_assembly_graph_using_bandage(
Expand Down

0 comments on commit 4742ef8

Please sign in to comment.