Mercurial > repos > recetox > matchms_formatter
comparison formatter.py @ 11:ae45992f969e draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/matchms commit b1cc1aebf796f170d93e3dd46ffcdefdc7b8018a
author | recetox |
---|---|
date | Thu, 12 Oct 2023 13:29:16 +0000 |
parents | 1b09315a3f87 |
children |
comparison
equal
deleted
inserted
replaced
10:1b09315a3f87 | 11:ae45992f969e |
---|---|
11 | 11 |
12 Returns: | 12 Returns: |
13 DataFrame: Scores | 13 DataFrame: Scores |
14 DataFrame: Matches | 14 DataFrame: Matches |
15 """ | 15 """ |
16 dataframe = DataFrame(columns=['query', 'reference', *scores.scores.score_names]) | 16 data = [] |
17 | 17 |
18 for i, (row, col) in enumerate(zip(scores.scores.row, scores.scores.col)): | 18 for i, (row, col) in enumerate(zip(scores.scores.row, scores.scores.col)): |
19 dataframe.loc[i] = [scores.queries[col].metadata['compound_name'], scores.references[row].metadata['compound_name'], *scores.scores.data[i]] | 19 data.append([scores.queries[col].metadata['compound_name'], scores.references[row].metadata['compound_name'], *scores.scores.data[i]]) |
20 | |
21 dataframe = DataFrame(data, columns=['query', 'reference', *scores.scores.score_names]) | |
20 | 22 |
21 return dataframe | 23 return dataframe |
22 | 24 |
23 | 25 |
24 def load_data(scores_filename: str) -> DataFrame: | 26 def load_data(scores_filename: str) -> DataFrame: |