comparison matchms_similarity_wrapper.py @ 3:9f8532c99845 draft

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit 38a5028a7abe99794086e9b1374ab4bb8bfa68de
author recetox
date Wed, 21 Sep 2022 15:28:55 +0000
parents 67ed0d4f3724
children ba5e9bd05d5b
comparison
equal deleted inserted replaced
2:67ed0d4f3724 3:9f8532c99845
45 queries_spectra = list(load_from_mgf(args.queries_filename)) 45 queries_spectra = list(load_from_mgf(args.queries_filename))
46 else: 46 else:
47 raise ValueError(f'File format {args.queries_format} not supported for query spectra.') 47 raise ValueError(f'File format {args.queries_format} not supported for query spectra.')
48 48
49 if args.symmetric: 49 if args.symmetric:
50 reference_spectra = [] 50 reference_spectra = queries_spectra.copy()
51 else: 51 else:
52 if args.references_format == 'msp': 52 if args.references_format == 'msp':
53 reference_spectra = list(load_from_msp(args.references_filename)) 53 reference_spectra = list(load_from_msp(args.references_filename))
54 elif args.references_format == 'mgf': 54 elif args.references_format == 'mgf':
55 reference_spectra = list(load_from_mgf(args.references_filename)) 55 reference_spectra = list(load_from_mgf(args.references_filename))
71 else: 71 else:
72 return -1 72 return -1
73 73
74 print("Calculating scores...") 74 print("Calculating scores...")
75 scores = calculate_scores( 75 scores = calculate_scores(
76 references=queries_spectra if args.symmetric else reference_spectra, 76 references=reference_spectra,
77 queries=queries_spectra, 77 queries=queries_spectra,
78 similarity_function=similarity_metric, 78 similarity_function=similarity_metric,
79 is_symmetric=args.symmetric 79 is_symmetric=args.symmetric
80 ) 80 )
81 81