Skip to content

Commit

Permalink
Merge pull request #281 from Kinggerm/intermediate_graph
Browse files Browse the repository at this point in the history
1.8.0 major update
  • Loading branch information
JianjunJin authored Oct 29, 2024
2 parents 7754749 + 7bd3d2e commit 118de7d
Show file tree
Hide file tree
Showing 13 changed files with 5,503 additions and 1,331 deletions.
4,667 changes: 3,699 additions & 968 deletions GetOrganelleLib/assembly_parser.py

Large diffs are not rendered by default.

48 changes: 47 additions & 1 deletion GetOrganelleLib/pipe_control_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def __init__(self, sample_out_dir, prefix=""):
if "circular genome" in detail_record:
this_circular = "yes"
elif " - WARNING: " in line and line[:4].isdigit():
if "Degenerate base(s) used!" in line:
if "Ambiguous base(s) used!" in line:
this_degenerate = "yes"
if "circular" in this_record:
this_record["circular"] += " & " + this_circular
Expand Down Expand Up @@ -984,6 +984,52 @@ def get_static_html_context(remote_url, try_times=5, timeout=10, verbose=False,
return {"status": False, "info": "unknown", "content": ""}


def log_target_res(final_res_combinations_inside,
log_handler=None,
read_len_for_log=None,
kmer_for_log=None,
universal_overlap=False,
mode="",):
echo_graph_id = int(bool(len(final_res_combinations_inside) - 1))
for go_res, final_res_one in enumerate(final_res_combinations_inside):
this_graph = final_res_one["graph"]
this_k_cov = round(final_res_one["cov"], 3)
if read_len_for_log and kmer_for_log:
this_b_cov = round(this_k_cov * read_len_for_log / (read_len_for_log - kmer_for_log + 1), 3)
else:
this_b_cov = None
if log_handler:
if echo_graph_id:
log_handler.info("Graph " + str(go_res + 1))
for vertex_set in sorted(this_graph.vertex_clusters):
copies_in_a_set = {this_graph.vertex_to_copy[v_name] for v_name in vertex_set}
if copies_in_a_set != {1}:
for in_vertex_name in sorted(vertex_set):
log_handler.info("Vertex_" + in_vertex_name + " #copy = " +
str(this_graph.vertex_to_copy.get(in_vertex_name, 1)))
cov_str = " kmer-coverage" if universal_overlap else " coverage"
log_handler.info("Average " + mode + cov_str +
("(" + str(go_res + 1) + ")") * echo_graph_id + " = " + "%.1f" % this_k_cov)
if this_b_cov:
log_handler.info("Average " + mode + " base-coverage" +
("(" + str(go_res + 1) + ")") * echo_graph_id + " = " + "%.1f" % this_b_cov)
else:
if echo_graph_id:
sys.stdout.write("Graph " + str(go_res + 1) + "\n")
for vertex_set in sorted(this_graph.vertex_clusters):
copies_in_a_set = {this_graph.vertex_to_copy[v_name] for v_name in vertex_set}
if copies_in_a_set != {1}:
for in_vertex_name in sorted(vertex_set):
sys.stdout.write("Vertex_" + in_vertex_name + " #copy = " +
str(this_graph.vertex_to_copy.get(in_vertex_name, 1)) + "\n")
cov_str = " kmer-coverage" if universal_overlap else " coverage"
sys.stdout.write("Average " + mode + cov_str +
("(" + str(go_res + 1) + ")") * echo_graph_id + " = " + "%.1f" % this_k_cov + "\n")
if this_b_cov:
sys.stdout.write("Average " + mode + " base-coverage" + ("(" + str(go_res + 1) + ")") *
echo_graph_id + " = " + "%.1f" % this_b_cov + "\n")


def download_file_with_progress(remote_url, output_file, log_handler=None, allow_empty=False,
sha256_v=None, try_times=5, timeout=100000, alternative_url_list=None, verbose=False):
time_0 = time.time()
Expand Down
Loading

0 comments on commit 118de7d

Please sign in to comment.