annotate metfrag-vis.py @ 0:3dbe79671820 draft default tip

"planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
author computational-metabolomics
date Tue, 14 Jul 2020 07:42:34 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
1 #!/usr/bin/env python
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
2
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
3 # Load modules
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
4 import argparse
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
5 import base64
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
6 import csv
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
7 import os
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
8 import re
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
9 import time
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
10 import urllib.parse
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
11
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
12 import matplotlib.pyplot as plt
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
13
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
14 import pubchempy
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
15
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
16 import requests
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
17
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
18 # Parse arguments
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
19 parser = argparse.ArgumentParser(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
20 description='Visualise MetFrag results in html.')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
21 parser.add_argument('-v', '--version', action='version',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
22 version='MetFrag-vis Version 0.9',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
23 help='show version')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
24 parser.add_argument('-i', '--input', metavar='metfrag_results.tsv',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
25 dest="input_tsv", required=True,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
26 help='MetFrag results as input')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
27 parser.add_argument('-o', '--output', metavar='metfrag_results.html',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
28 dest="output_html", required=True,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
29 help='Write MetFrag results into this output file')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
30 parser.add_argument('-m', '--max-candidates', metavar='10',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
31 dest="max_candidates", default=10, type=int,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
32 required=False,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
33 help='Maximum number of candidates per compound [1-1000]')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
34 parser.add_argument('-s', '--synonyms', dest='synonyms', action='store_true',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
35 required=False,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
36 help='Fetch synonyms from PubChem [disabled by default]')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
37 parser.add_argument('-c', '--classyfire', dest='classyfire',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
38 action='store_true', required=False,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
39 help='Fetch compound classes from ClassyFire'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
40 ' [disabled by default]')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
41
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
42 args = parser.parse_args()
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
43
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
44 # Input CSV with MetFrag results
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
45 input_tsv = args.input_tsv
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
46
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
47 # Output html of MetFrag results
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
48 output_html = args.output_html
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
49
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
50 # Max number of candidates per compound
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
51 max_candidates = args.max_candidates
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
52
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
53 # PubChem synonyms
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
54 pubchem_synonyms_enabled = args.synonyms
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
55
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
56 # ClassyFire classes
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
57 classyfire_classes_enabled = args.classyfire
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
58
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
59
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
60 # ---------- cdk_inchi_to_svg ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
61 def cdk_inchi_to_svg(inchi):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
62 if "cdk-inchi-to-svg" in os.environ:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
63 JAVA_CMD = 'cdk-inchi-to-svg' + ' ' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
64 '\'' + inchi + '\'') + ' ' + 'cdk-inchi-to-svg-output.svg'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
65 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
66 JAVA_BINARY = '/usr/local/bin/java'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
67 CDK_INCHI_TO_SVG_JAR = '/usr/local/bin/' \
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
68 'cdk-inchi-to-svg-0.0.1-' \
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
69 'SNAPSHOT-jar-with-dependencies.jar'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
70 JAVA_CMD = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
71 JAVA_BINARY + ' ' + '-jar' + ' ' + CDK_INCHI_TO_SVG_JAR + ' '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
72 + str('\'' + inchi + '\'') + ' ' + 'cdk-inchi-to-svg-output.svg')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
73
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
74 # Exec cdk-inchi-to-svg JAVA binary
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
75 exitcode = os.system(JAVA_CMD)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
76
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
77 # Check whether binary has successfully been run
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
78 if (exitcode == 0):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
79 with open("cdk-inchi-to-svg-output.svg", "r") as svg_file:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
80 svg_string = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
81 for line in svg_file:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
82 if not ('<?xml' in line) and not ('<!DOCTYPE' in line):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
83 if (' fill=\'#FFFFFF\'' in line):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
84 line = re.sub(' fill=\'#FFFFFF\'',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
85 ' fill=\'#FFFFFF\' fill-opacity=\'0.0\'',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
86 line)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
87 svg_string.append(line)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
88 svg_file.close()
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
89 os.remove("cdk-inchi-to-svg-output.svg")
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
90 return (str(''.join(svg_string)))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
91 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
92 return ('&nbsp;')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
93
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
94
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
95 # ---------- pubchem_link ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
96 def pubchem_link(compound_name):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
97 return (str('https://pubchem.ncbi.nlm.nih.gov/#query=' + compound_name))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
98
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
99
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
100 # ---------- kegg_link ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
101 def kegg_link(compound_name):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
102 return (str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
103 'https://www.genome.jp/dbget-bin/'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
104 'www_bfind_sub?mode=bfind&max_hit=1000&dbkey=kegg&keywords=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
105 compound_name))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
106
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
107
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
108 # ---------- biocyc_link ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
109 def biocyc_link(compound_name):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
110 biocyc_url = urllib.parse.urlparse(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
111 str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
112 'https://www.biocyc.org/'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
113 'substring-search?type=NIL&object=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
114 compound_name + '&quickSearch=Quick+Search'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
115 return (biocyc_url.geturl())
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
116
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
117
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
118 # ---------- hmdb_link ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
119 def hmdb_link(compound_name):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
120 hmdb_url = urllib.parse.urlparse(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
121 str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
122 'https://hmdb.ca/unearth/q?utf8=\xe2&query=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
123 compound_name + '&searcher=metabolites&button='))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
124 return (hmdb_url.geturl())
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
125
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
126
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
127 # ---------- hmdb_link ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
128 def chebi_link(inchi):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
129 return (str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
130 'https://www.ebi.ac.uk/chebi/advancedSearchFT.do?searchString='
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
131 + inchi))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
132
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
133
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
134 # ---------- PubChem Synonyms ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
135 def fetch_pubchem_synonyms(inchi):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
136 if not ('InChI=' in inchi):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
137 return ('&nbsp;')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
138
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
139 # Fetch CID from InChI
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
140 print('Retrieving PubChem CID from InChI...')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
141 compound = pubchempy.get_compounds(identifier=inchi, namespace='inchi')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
142 compound_cid = re.sub(r'\).*', '', re.sub(r'.*\(', '', str(compound)))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
143 if len(compound_cid) <= 1:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
144 print(str('Warning. No match for InChI \"' + str(inchi) + '\".'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
145 return ('&nbsp;')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
146
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
147 # Retrieve compound
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
148 print('Retrieving PubChem compound information...')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
149 compound = pubchempy.Compound.from_cid(compound_cid)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
150 if ('synonyms' in dir(compound)):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
151 return ('; '.join(compound.synonyms))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
152 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
153 print(str('Warning. No synonyms found for CID \"' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
154 compound_cid) + '\".'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
155 return ('&nbsp;')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
156
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
157
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
158 # ---------- ClassyFire ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
159 def fetch_classyfire_classes(inchi):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
160 if not ('InChI=' in inchi):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
161 return ('&nbsp;')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
162
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
163 # Send POST request to ClassyFire
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
164 print('Sending request to ClassyFire...')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
165 classyfire_url = 'http://classyfire.wishartlab.com/queries.json'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
166 classyfire_post = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
167 '{\"label\":\"metfrag\",\"query_input\":\"' + inchi +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
168 '\",\"query_type\":\"STRUCTURE\"}')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
169 classyfire_headers = {'Content-Type': 'application/json'}
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
170 classyfire_request = requests.post(classyfire_url, data=classyfire_post,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
171 headers=classyfire_headers)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
172
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
173 # Only continue when request has been successfully sent
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
174 if (classyfire_request.status_code != 201):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
175 print('Error! Could not send request to ClassyFire. \"',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
176 str(classyfire_request.status_code) + ': ' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
177 classyfire_request.reason), '\". Skipping entry.')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
178 return ('&nbsp;')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
179
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
180 # Get ClassyFire Query ID
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
181 classyfire_request.json()
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
182 classyfire_query_id = classyfire_request.json()['id']
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
183
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
184 # Query ClassyFire in max. 20 attempts
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
185 classyfire_request_loop = 0
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
186 while (classyfire_request_loop < 20):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
187 print(str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
188 'Sending query ' + str(classyfire_query_id) + ' to ClassyFire...'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
189 time.sleep(10)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
190 classyfire_query = requests.get(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
191 str('http://classyfire.wishartlab.com/queries/' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
192 classyfire_query_id) + '.json'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
193
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
194 if (classyfire_query.status_code == 200) and (
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
195 classyfire_query.json()['classification_status'] == 'Done'):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
196 classyfire_request_loop = 999
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
197 break
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
198 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
199 classyfire_request_loop += 1
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
200
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
201 if classyfire_request_loop == 999:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
202 # Direct parent
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
203 direct_parent_name = classyfire_query.json()[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
204 'entities'][0]['direct_parent']['name']
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
205 direct_parent_url = classyfire_query.json()[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
206 'entities'][0]['direct_parent']['url']
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
207 direct_parent = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
208 '<a target="_blank" href="' + direct_parent_url + '">' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
209 direct_parent_name + '</a>')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
210
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
211 # Alternative parents
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
212 alt_parents = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
213 for i in range(0, len(classyfire_query.json()['entities'][0][
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
214 'alternative_parents'])):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
215 alt_parent_name = classyfire_query.json()[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
216 'entities'][0]['alternative_parents'][i]['name']
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
217 alt_parent_url = classyfire_query.json()[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
218 'entities'][0]['alternative_parents'][i]['url']
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
219 alt_parent = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
220 '<a target="_blank" href="' + alt_parent_url + '">' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
221 alt_parent_name + '</a>')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
222 alt_parents.append(alt_parent)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
223
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
224 # Concat classes
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
225 classes = str('<b>' + direct_parent + '</b>, <br>' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
226 ', <br>'.join(alt_parents)))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
227 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
228 print('Warning. Timout sending query to ClassyFire. Skipping entry.')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
229 classes = '&nbsp;'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
230
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
231 return (classes)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
232
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
233
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
234 # ---------- Plot Spectrum ----------
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
235 def plot_spectrum(spectrum, spectrum_explained, spectrum_explained_formulas):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
236 # Plot
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
237 plt.figure(figsize=[5.5, 4.4])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
238 plt.xlabel('m/z')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
239 plt.ylabel('intensity')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
240
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
241 # Plot spectrum
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
242 x = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
243 y = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
244 for i in spectrum.split(';'):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
245 t = i.split('_')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
246 x.append(t[0])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
247 y.append(t[1])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
248
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
249 for i in range(0, len(x)):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
250 plt.plot([float(x[i]), float(x[i])], [0, float(y[i])], linewidth=1,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
251 color='black')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
252 plt.plot(float(x[i]), float(y[i]), 'o', color='black', markersize=4)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
253
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
254 if not (spectrum_explained == 'NA') and not (
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
255 spectrum_explained_formulas == 'NA'):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
256 # Plot explained peaks
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
257 ex = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
258 ey = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
259 for i in spectrum_explained.split(';'):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
260 t = i.split('_')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
261 ex.append(t[0])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
262 ey.append(y[x.index(t[0])])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
263
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
264 for i in range(0, len(ex)):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
265 plt.plot([float(ex[i]), float(ex[i])], [0, float(ey[i])],
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
266 linewidth=3, color='#2b8126')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
267 plt.plot(float(ex[i]), float(ey[i]), 'o', color='#2b8126',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
268 markersize=8)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
269
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
270 # Plot formulas on explained peaks
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
271 ex = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
272 ey = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
273 ez = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
274 for i in spectrum_explained_formulas.split(';'):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
275 t = i.split(':')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
276 ex.append(t[0])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
277 ey.append(y[x.index(t[0])])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
278 ez.append(t[1])
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
279
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
280 for i in range(0, len(ex)):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
281 plt.text(float(ex[i]), float(ey[i]) + 1000, ez[i], color='#2b8126',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
282 fontsize=8,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
283 horizontalalignment='center', verticalalignment='bottom')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
284
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
285 # Save SVG
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
286 plt.savefig("metfrag-vis-spectrum.svg", format="svg", transparent=True)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
287 plt.close()
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
288
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
289 # Import SVG
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
290 with open("metfrag-vis-spectrum.svg", "r") as svg_file:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
291 svg_string = []
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
292 for line in svg_file:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
293 if not ('<?xml' in line) and not ('<!DOCTYPE' in line) and not (
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
294 ' "http://www.w3.org/Graphics' in line):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
295 svg_string.append(line)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
296 svg_file.close()
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
297 os.remove("metfrag-vis-spectrum.svg")
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
298 return (str(''.join(svg_string)))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
299
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
300
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
301 # #################### MAIN ####################
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
302 if pubchem_synonyms_enabled:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
303 print('Fetching of PubChem Synonyms enabled.')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
304 if classyfire_classes_enabled:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
305 print('Fetching of ClassyFire Classes enabled.')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
306
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
307 # Open output html file
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
308 try:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
309 metfrag_html = open(output_html, "w")
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
310 except Exception as e:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
311 print("Error writing output file. {}".format(e))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
312 exit(1)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
313
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
314 # Write html header
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
315 metfrag_html.write('<!DOCTYPE html>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
316 metfrag_html.write('<html>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
317 metfrag_html.write('<head>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
318 metfrag_html.write('<title>' + 'msPurity MetFrag results' + '</title>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
319 metfrag_html.write('<style type="text/css">\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
320 metfrag_html.write('svg { width: 200px; height: 100%; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
321 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
322 'body { font-family: Lucida, Verdana, Arial, Helvetica, sans-serif; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
323 'font-size: 13px; text-align: left; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
324 'color: #000000; margin: 8px 8px 8px 8px; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
325 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
326 'A { color: #2b8126; text-decoration: none; background: transparent; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
327 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
328 'A:visited { '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
329 'color: #19681a; text-decoration: none; background: transparent; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
330 '}\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
331 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
332 'A:hover { '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
333 'color: #8fc180; text-decoration: underline; background: transparent; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
334 '}\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
335 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
336 'h1 { font-size: 32px; font-weight: bold; text-align: center; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
337 'padding: 0px 0px 4px 0px; margin: 26px 0px 0px 0px; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
338 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
339 'h2 { font-size: 24px; font-weight: bold; text-align: left; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
340 'padding: 0px 0px 4px 0px; margin: 26px 0px 0px 0px; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
341 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
342 'table { font-family: Lucida, Verdana, Arial, Helvetica, sans-serif; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
343 'font-size: 10px; text-align: left; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
344 'line-height: 10px; border: 1px solid #e3efdf; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
345 'background-color: #ecf5ea; margin-bottom: 8px; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
346 'min-width: 1600px; max-width: 2400px; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
347 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
348 '#tablediv { width: 100%; min-width: 20px; max-width: 200px; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
349 metfrag_html.write('.tdmax { min-width: 200px; max-width: 200px; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
350 metfrag_html.write('.tdvar { min-width: 200px; max-width: 600px; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
351 metfrag_html.write('tr:nth-child(even) { background-color: #f6faf5; }\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
352 metfrag_html.write('</style>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
353 metfrag_html.write('</head>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
354 metfrag_html.write('<body>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
355
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
356 # Read input csv file
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
357 with open(input_tsv, "r") as metfrag_file:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
358 metfrag_results = csv.DictReader(metfrag_file, delimiter='\t')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
359 # Parse each line
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
360 line_count = 0
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
361 compound = ""
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
362 candidates = 0
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
363 for row in metfrag_results:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
364
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
365 # Start new document
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
366 if (line_count == 0):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
367 if os.path.join(os.path.dirname(os.path.abspath(__file__)),
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
368 'metfrag_logo.png'):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
369 logo_pth = os.path.join(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
370 os.path.dirname(os.path.abspath(__file__)),
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
371 'metfrag_logo.png')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
372 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
373 logo_pth = '/usr/local/share/metfrag/metfrag_logo.png'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
374
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
375 with open(logo_pth, "rb") as png_file:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
376 png_encoded = base64.b64encode(png_file.read())
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
377 metfrag_html.write(str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
378 '\n<h1><img style="vertical-align:bottom" '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
379 'src="data:image/png;base64,' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
380 png_encoded.decode('utf-8') +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
381 '" alt="metfrag-logo" width="150"></img><text '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
382 'style="line-height:2.0">&nbsp;&nbsp;results</text></h1>\n'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
383 ))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
384 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
385 # Parameter list at beginning of document
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
386 if (line_count == 1):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
387 metfrag_html.write('\n<h2>Parameter list</h2>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
388 metfrag_html.write(str('MetFragDatabaseType=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
389 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
390 re.sub('.*MetFragDatabaseType=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
391 '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
392 row[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
393 "MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
394 + '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
395 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
396 metfrag_html.write(str('PrecursorIonMode=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
397 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
398 re.sub('.*PrecursorIonMode=', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
399 row[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
400 "MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
401 + '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
402 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
403 metfrag_html.write(str('DatabaseSearchRelativeMassDeviation=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
404 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
405 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
406 '.*DatabaseSearchRelative'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
407 'MassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
408 '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
409 row[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
410 "MetFragCLIString"])) +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
411 '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
412 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
413 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
414 str('FragmentPeakMatchAbsoluteMassDeviation=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
415 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
416 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
417 '.*FragmentPeakMatchAbsoluteMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
418 '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
419 row["MetFragCLIString"])) + '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
420 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
421 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
422 str('FragmentPeakMatchRelativeMassDeviation=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
423 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
424 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
425 '.*FragmentPeakMatchRelativeMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
426 '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
427 row["MetFragCLIString"])) + '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
428 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
429 metfrag_html.write(str('FilterExcludedElements=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
430 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
431 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
432 '.*FilterExcludedElements=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
433 '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
434 row[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
435 "MetFragCLIString"])) +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
436 '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
437 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
438 metfrag_html.write(str('FilterIncludedElements=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
439 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
440 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
441 '.*FilterIncludedElements=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
442 '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
443 row[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
444 "MetFragCLIString"])) +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
445 '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
446 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
447 metfrag_html.write(str('MetFragScoreTypes=' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
448 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
449 re.sub('.*MetFragScoreTypes=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
450 '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
451 row[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
452 "MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
453 + '<br>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
454 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
455 # New compound in list
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
456 if (row["name"] != compound):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
457 compound = row["name"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
458 candidates = 0
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
459 identifier = row["name"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
460 monoisotopic_mass = row["MonoisotopicMass"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
461 precursor_mz = row["precursor_mz"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
462
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
463 if "retention_time" in row:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
464 precursor_rt = row["retention_time"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
465 try:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
466 precursor_rt = round(float(precursor_rt), 4)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
467 except ValueError:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
468 continue
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
469 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
470 precursor_rt = ''
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
471
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
472 if "precursor_type" in row:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
473 precursor_type = row["precursor_type"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
474 elif "adduct" in row:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
475 precursor_type = row["adduct"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
476 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
477 precursor_type = ''
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
478
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
479 if line_count > 1:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
480 metfrag_html.write(str('</table>\n'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
481
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
482 metfrag_html.write(str('\n' + '<h2>' + identifier + '</h2>\n'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
483 metfrag_html.write(str('<p><b>Precursor Type:</b> ' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
484 precursor_type) + '<br>'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
485 metfrag_html.write(str('<b>Precursor Mass:</b> ' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
486 round(float(precursor_mz), 4)) + '<br>'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
487 metfrag_html.write(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
488 str('<b>Precursor Retention Time:</b> ' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
489 precursor_mz) + '<br></p>'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
490 metfrag_html.write(str('\n' + '<table>\n'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
491 metfrag_html.write(str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
492 '<tr style="vertical-align:bottom; '
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
493 'background-color:#e3efdf;">'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
494 + '<td class="tdmax">' + '<b>Spectrum</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
495 + '<td class="tdmax">' + '<b>Structure</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
496 + '<td>' + '<b>Monoisotopic Mass</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
497 + '<td>' + '<b>Molecular Formula</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
498 + '<td>' + '<b>Compound Name</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
499 + '<td class="tdvar">' + '<b>PubChem Synonyms</b>'+'</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
500 + '<td>' + '<b>Compound Classes</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
501 + '<td>' + '<b>MetFrag Score</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
502 + '<td>' + '<b>MetFusion Score</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
503 + '<td>' + '<b>Fragmenter Score</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
504 + '<td>' + '<b>Suspectlist Score</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
505 + '<td>' + '<b>Explained Peaks</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
506 + '<td>' + '<b>MetFrag Web</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
507 + '<td>' + '<b>External Links</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
508 + '<td class="tdmax">' + '<b>InChI</b>' + '</td>'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
509 + '</tr>\n'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
510
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
511 # Compound candidate
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
512 if (candidates < max_candidates):
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
513 # Column variables
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
514 inchi = row["InChI"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
515 smiles = row["SMILES"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
516 mol_formula = row["MolecularFormula"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
517 compound_name = row["IUPACName"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
518 frag_score = row["FragmenterScore"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
519 metfusion_score = row["OfflineMetFusionScore"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
520 score = row["Score"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
521 if "SuspectListScore" in row:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
522 suspectlist_score = row["SuspectListScore"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
523 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
524 suspectlist_score = 0
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
525 peaks_explained = row["NoExplPeaks"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
526 peaks_used = row["NumberPeaksUsed"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
527 spectrum_explained = row["ExplPeaks"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
528 spectrum_explained_formulas = row["FormulasOfExplPeaks"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
529 identifier = row["Identifier"]
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
530
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
531 # PubChem Synonyms
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
532 if pubchem_synonyms_enabled:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
533 pubchem_synonyms = fetch_pubchem_synonyms(inchi)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
534 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
535 pubchem_synonyms = '&nbsp;'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
536
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
537 # Compound Classes
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
538 if classyfire_classes_enabled:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
539 compound_classes = fetch_classyfire_classes(inchi)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
540 else:
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
541 compound_classes = '&nbsp;'
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
542
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
543 # Draw Spectrum
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
544 spectrum = re.sub(' .*', '', re.sub('.*PeakListString=', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
545 row["MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
546 spectrum_string = plot_spectrum(spectrum, spectrum_explained,
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
547 spectrum_explained_formulas)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
548
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
549 # Draw SVG
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
550 svg_string = cdk_inchi_to_svg(str(inchi))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
551
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
552 # External links
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
553 external_links = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
554 '<a target="_blank" href="' + pubchem_link(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
555 compound_name) + '">PubChem</a>' + ', ' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
556 '<a target="_blank" href="' + kegg_link(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
557 compound_name) + '">KEGG</a>' + ', ' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
558 '<a target="_blank" href="' + hmdb_link(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
559 compound_name) + '">HMDB</a>' + ', ' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
560 '<a target="_blank" href="' + biocyc_link(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
561 compound_name) + '">BioCyc</a>' + ', ' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
562 '<a target="_blank" href="' + chebi_link(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
563 inchi) + '">ChEBI</a>')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
564
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
565 # MetFragWeb
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
566 FragmentPeakMatchAbsoluteMassDeviation = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
567 '' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
568 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
569 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
570 '.*FragmentPeakMatchAbsoluteMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
571 'FragmentPeakMatchAbsoluteMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
572 row["MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
573 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
574 FragmentPeakMatchRelativeMassDeviation = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
575 '' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
576 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
577 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
578 '.*FragmentPeakMatchRelativeMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
579 'FragmentPeakMatchRelativeMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
580 row["MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
581 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
582 DatabaseSearchRelativeMassDeviation = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
583 '' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
584 re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
585 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
586 '.*DatabaseSearchRelativeMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
587 'DatabaseSearchRelativeMassDeviation=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
588 row["MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
589 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
590 IonizedPrecursorMass = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
591 'IonizedPrecursorMass=' + str(row["precursor_mz"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
592 NeutralPrecursorMass = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
593 '' + re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
594 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
595 '.*NeutralPrecursorMass=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
596 'NeutralPrecursorMass=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
597 row[
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
598 "MetFragCLIString"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
599 )
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
600 NeutralPrecursorMolecularFormula = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
601 'NeutralPrecursorMolecularFormula=' + str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
602 row["MolecularFormula"]))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
603 PrecursorIonMode = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
604 '' + re.sub(' .*', '', re.sub('.*PrecursorIonMode=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
605 'PrecursorIonMode=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
606 row["MetFragCLIString"])))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
607 PeakList = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
608 '' + re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
609 re.sub('.*PeakListString=', 'PeakList=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
610 row["MetFragCLIString"])))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
611 MetFragDatabaseType = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
612 '' + re.sub(' .*', '',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
613 re.sub(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
614 '.*MetFragDatabaseType=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
615 'MetFragDatabaseType=',
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
616 row["MetFragCLIString"])))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
617
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
618 metfrag_web = str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
619 'https://msbi.ipb-halle.de/MetFrag/landing.xhtml?' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
620 FragmentPeakMatchAbsoluteMassDeviation + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
621 FragmentPeakMatchRelativeMassDeviation + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
622 DatabaseSearchRelativeMassDeviation + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
623 IonizedPrecursorMass + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
624 NeutralPrecursorMass + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
625 # NeutralPrecursorMolecularFormula + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
626 PrecursorIonMode + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
627 PeakList + '&' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
628 MetFragDatabaseType)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
629
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
630 # Write html code
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
631 metfrag_html.write(str('<tr style="vertical-align:center">' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
632 '<td class="tdmax">' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
633 spectrum_string +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
634 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
635 '<td class="tdmax">' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
636 svg_string +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
637 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
638 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
639 monoisotopic_mass +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
640 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
641 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
642 mol_formula +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
643 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
644 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
645 compound_name +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
646 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
647 '<td class="tdvar">' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
648 pubchem_synonyms +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
649 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
650 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
651 compound_classes + '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
652 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
653 str(round(float(score), 3)) +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
654 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
655 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
656 str(round(float(metfusion_score), 3)) +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
657 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
658 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
659 str(round(float(frag_score), 3)) +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
660 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
661 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
662 str(
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
663 round(float(suspectlist_score), 3)
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
664 ) +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
665 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
666 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
667 peaks_explained +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
668 ' / ' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
669 peaks_used +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
670 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
671 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
672 '<a target="_blank" href="' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
673 metfrag_web +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
674 '">MetFragWeb</a>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
675 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
676 '<td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
677 external_links +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
678 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
679 '<td class="tdmax">' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
680 inchi +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
681 '</td>' +
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
682 '</tr>\n'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
683
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
684 line_count += 1
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
685 candidates += 1
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
686
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
687 # Finish candidate list
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
688 metfrag_html.write(str('</table>\n'))
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
689
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
690 # Write html footer
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
691 metfrag_html.write('\n</body>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
692 metfrag_html.write('</html>\n')
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
693
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
694 # Close output html file
3dbe79671820 "planemo upload for repository https://github.com/computational-metabolomics/metfrag-galaxy commit b337c6296968848e3214f4b51df3d86776f84b6a"
computational-metabolomics
parents:
diff changeset
695 metfrag_html.close()