Skip to content

Commit

Permalink
Merge pull request #436 from hechth/networking_fix
Browse files Browse the repository at this point in the history
Update matchms molecular networking tool
  • Loading branch information
hechth authored Nov 19, 2023
2 parents 14d9015 + cb5477c commit 13f4f7a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
16 changes: 14 additions & 2 deletions tools/matchms/matchms_networking.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tool id="matchms_networking" name="matchms networking" version="@TOOL_VERSION@+galaxy0" profile="21.09">
<tool id="matchms_networking" name="matchms networking" version="@TOOL_VERSION@+galaxy1" profile="21.09">
<description>create similarity network graph from matchms similarity scores</description>

<macros>
Expand Down Expand Up @@ -28,7 +28,7 @@
<configfiles>
<configfile name="matchms_networking_cli">
python3 ${__tool_directory__}/matchms_networking_wrapper.py \
--score_name '${score_layer_name}_score' \
--score_name '${score_layer_name}' \
--graph_format '$graph_format' \
--identifier '$identifier_key' \
--top_n '$top_n' \
Expand Down Expand Up @@ -191,6 +191,18 @@
</assert_contents>
</output>
</test>
<test>
<param name="scores" value="networking/test9.json" ftype="json"/>
<param name="graph_format" value="graphml"/>
<param name="identifier_key" value="compound_name"/>
<param name="score_cutoff" value="0.4"/>
<param name="keep_unconnected_nodes" value="false"/>
<output name="similarity_network_file" ftype="graphml">
<assert_contents>
<is_valid_xml />
</assert_contents>
</output>
</test>
</tests>

<help>
Expand Down
5 changes: 4 additions & 1 deletion tools/matchms/matchms_networking_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ def main(argv):
score_cutoff=args.score_cutoff,
link_method=args.link_method,
keep_unconnected_nodes=args.keep_unconnected_nodes)
score_name = next((s for s in scores.score_names if args.score_name in s and "score" in s), None)
if score_name is None:
raise ValueError(f"Could not find any score name containing '{args.score_name}'.")

network.create_network(scores, args.score_name)
network.create_network(scores, score_name)
network.export_to_file(filename=args.output_filename, graph_format=args.graph_format)

return 0
Expand Down
Loading

0 comments on commit 13f4f7a

Please sign in to comment.