Skip to content

Commit

Permalink
Adds python bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Horsfield committed Jan 21, 2025
1 parent 12e8ca0 commit ccbecca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ggCaller/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,25 +408,30 @@ def main():
# ensure trailing slash present
Path_dir = os.path.join(Path_dir, "")

# determine if graph is being updated
update = False

# if build graph specified, build graph and then call ORFs
if (options.graph is not None) and (options.colours is not None) and (options.query is None):
graph_tuple = graph.read(options.graph, options.colours, stop_codons_for, stop_codons_rev,
start_codons_for, start_codons_rev, options.threads, is_ref, ref_set, Path_dir)
# if graph specified with prev_run and no query, will be updating the graph
elif (options.graph is not None) and (options.colours is not None) and (options.query is None) and \
(options.prev_run is not None) and (options.refs is not None or options.reads is not None):

update = True
# references only
if (options.refs is not None and options.reads is None):
graph_tuple = graph.update(options.graph, options.colours, stop_codons_for, stop_codons_rev,
start_codons_for, start_codons_rev, options.threads, is_ref, ref_set, Path_dir)
graph_tuple = graph.update(options.graph, options.colours, options.refs, "NA", stop_codons_for, stop_codons_rev,
start_codons_for, start_codons_rev, options.threads, is_ref, ref_set, Path_dir, options.no_write_graph)
# reads only
elif (options.refs is None and options.reads is not None):
graph_tuple = graph.update(options.graph, options.colours, stop_codons_for, stop_codons_rev,
start_codons_for, start_codons_rev, options.threads, is_ref, ref_set, Path_dir)
graph_tuple = graph.update(options.graph, options.colours, options.reads, "NA", stop_codons_for, stop_codons_rev,
start_codons_for, start_codons_rev, options.threads, is_ref, ref_set, Path_dir, options.no_write_graph)
# refs and reads
elif (options.refs is not None and options.reads is not None):
graph_tuple = graph.update(options.graph, options.colours, stop_codons_for, stop_codons_rev,
start_codons_for, start_codons_rev, options.threads, is_ref, ref_set, Path_dir)
graph_tuple = graph.update(options.graph, options.colours, options.refs, options.reads, stop_codons_for, stop_codons_rev,
start_codons_for, start_codons_rev, options.threads, is_ref, ref_set, Path_dir, options.no_write_graph)
# query unitigs in previous saved ggc graph
elif (options.graph is not None) and (options.colours is not None) and (options.refs is None) and \
(options.query is not None):
Expand Down Expand Up @@ -545,7 +550,7 @@ def main():
TIS_model_file, options.min_orf_score, options.min_path_score,
options.max_orf_orf_distance, not options.no_clustering,
options.identity_cutoff, options.len_diff_cutoff, options.threads, cluster_file,
options.score_tolerance, ORFMap_dir, Path_dir)
options.score_tolerance, ORFMap_dir, Path_dir, update)

ORF_file_paths, Edge_file_paths = file_tuple

Expand Down
1 change: 1 addition & 0 deletions src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ PYBIND11_MODULE(ggCaller_cpp, m)
.def(py::init<>())
.def("read", &Graph::read)
.def("build", &Graph::build)
.def("update", &Graph::update)
.def("data_in", &Graph::in)
.def("data_out", &Graph::out)
.def("findGenes", &Graph::findGenes)
Expand Down

0 comments on commit ccbecca

Please sign in to comment.