Skip to content

Commit

Permalink
Merge pull request #253 from mwang87/glycopost-support2
Browse files Browse the repository at this point in the history
Glycopost Integration
  • Loading branch information
mwang87 authored Aug 22, 2021
2 parents ca716e2 + a48217a commit 4c1f762
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion download.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,14 @@ def _resolve_mtbls_usi(usi):

return remote_link

def _resolve_glycopost_usi(usi):
usi_splits = usi.split(':')

dataset_accession = usi_splits[1] + ".0"
filename = usi_splits[2]
remote_link = "https://glycopost.glycosmos.org/data/{}/{}".format(dataset_accession, urllib.parse.quote(filename))

return remote_link

def _resolve_pxd_usi(usi):
usi_splits = usi.split(':')
Expand Down Expand Up @@ -150,6 +157,8 @@ def _resolve_usi_remotelink(usi):
remote_link = _resolve_gnps_usi(usi)
elif "MTBLS" in usi_splits[1]:
remote_link = _resolve_mtbls_usi(usi)
elif "GPST" in usi_splits[1]:
remote_link = _resolve_glycopost_usi(usi)
elif "ST" in usi_splits[1]:
remote_link = _resolve_metabolomicsworkbench_usi(usi)
elif "PXD" in usi_splits[1]:
Expand Down Expand Up @@ -275,7 +284,7 @@ def _resolve_usi(usi, temp_folder="temp", cleanup=True):
filename, file_extension = os.path.splitext(local_filename)

temp_filename = os.path.join(temp_folder, str(uuid.uuid4()) + file_extension)
wget_cmd = "wget '{}' -O {} 2> /dev/null".format(remote_link, temp_filename)
wget_cmd = "wget '{}' --referer '{}' -O {} 2> /dev/null".format(remote_link, remote_link, temp_filename)
os.system(wget_cmd)
os.rename(temp_filename, local_filename)

Expand Down
2 changes: 2 additions & 0 deletions layout_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
html.Br(),
html.A("Thermo LCMS from GNPS Analysis Classical Molecular Networking Task", href="/?usi=mzspec:GNPS:TASK-5ecfcf81cb3c471698995b194d8246a0-f.MSV000085444/ccms_peak/peak/Hui_N1_fe.mzML#%7B%7D"),
html.Br(),
html.A("LCMS from Glycopost", href="/?usi=mzspec:GPST000082:VV_PGM_200204.raw"),
html.Br(),
html.Br(),

html.H5("Basic Examples - GC/MS Metabolomics"),
Expand Down

0 comments on commit 4c1f762

Please sign in to comment.