diff matchms_similarity_wrapper.py @ 1:f680068b7863 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit ca44513d50b29a4706e2a2db96c23ef6688b7c2d
author recetox
date Fri, 22 Jul 2022 16:48:21 +0000
parents 30e680e555d4
children 67ed0d4f3724
line wrap: on
line diff
--- a/matchms_similarity_wrapper.py	Tue Mar 22 16:07:32 2022 +0000
+++ b/matchms_similarity_wrapper.py	Fri Jul 22 16:48:21 2022 +0000
@@ -4,7 +4,7 @@
 import numpy as np
 from matchms import calculate_scores
 from matchms.importing import load_from_mgf, load_from_msp
-from matchms.similarity import CosineGreedy, CosineHungarian, MetadataMatch, ModifiedCosine
+from matchms.similarity import CosineGreedy, CosineHungarian, MetadataMatch, ModifiedCosine, NeutralLossesCosine
 from pandas import DataFrame
 
 
@@ -64,6 +64,10 @@
         similarity_metric = ModifiedCosine(args.tolerance, args.mz_power, args.intensity_power)
         reference_spectra = list(map(convert_precursor_mz, reference_spectra))
         queries_spectra = list(map(convert_precursor_mz, queries_spectra))
+    elif args.similarity_metric == 'NeutralLossesCosine':
+        similarity_metric = NeutralLossesCosine(args.tolerance, args.mz_power, args.intensity_power)
+        reference_spectra = list(map(convert_precursor_mz, reference_spectra))
+        queries_spectra = list(map(convert_precursor_mz, queries_spectra))
     else:
         return -1