Skip to content

Commit

Permalink
Merge branch 'release_23.2' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Feb 20, 2024
2 parents 0d380c4 + ea9e2fb commit 2a9c8d0
Show file tree
Hide file tree
Showing 15 changed files with 743 additions and 424 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ The following individuals have contributed code to Galaxy:
* Ben Fulton <[email protected]>
* Carrie Ganote <[email protected]>
* Ryan Golhar <[email protected]>
* Jeremy Goecks <[email protected]>
* Jeremy Goecks <[email protected]>
* Nuwan Goonasekera <[email protected]>
* Björn Grüning <[email protected]> <[email protected]>
* Aysam Guerler <[email protected]>
* Simon Guest <[email protected]>
* Nalin Gupta <[email protected]>
* Jianbin He <[email protected]>
* Peter van Heusden <[email protected]>
* Morita Hideyuki <[email protected]>
Expand Down
6 changes: 1 addition & 5 deletions lib/galaxy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,7 @@
from galaxy.visualization.data_providers.registry import DataProviderRegistry
from galaxy.visualization.genomes import Genomes
from galaxy.visualization.plugins.registry import VisualizationsRegistry
from galaxy.web import (
legacy_url_for,
url_for,
)
from galaxy.web import url_for
from galaxy.web.framework.base import server_starttime
from galaxy.web.proxy import ProxyManager
from galaxy.web_stack import (
Expand Down Expand Up @@ -795,7 +792,6 @@ def __init__(self, **kwargs) -> None:
# Inject url_for for components to more easily optionally depend
# on url_for.
self.url_for = url_for
self.legacy_url_for = legacy_url_for

self.server_starttime = server_starttime # used for cachebusting
# Limit lifetime of tool shed repository cache to app startup
Expand Down
16 changes: 9 additions & 7 deletions lib/galaxy/config/sample/datatypes_conf.xml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -779,10 +779,11 @@
</datatype>
<datatype extension="pdbqt" type="galaxy.datatypes.molecules:PDBQT" display_in_upload="true"/>
<datatype extension="pqr" type="galaxy.datatypes.molecules:PQR" display_in_upload="true" />
<datatype extension="cell" type="galaxy.datatypes.molecules:Cell" display_in_upload="true"/>
<datatype extension="cif" type="galaxy.datatypes.molecules:CIF" display_in_upload="true"/>
<datatype extension="xyz" type="galaxy.datatypes.molecules:XYZ" display_in_upload="true"/>
<datatype extension="extxyz" type="galaxy.datatypes.molecules:ExtendedXYZ" display_in_upload="true"/>
<datatype extension="cell" type="galaxy.datatypes.molecules:Cell" display_in_upload="true" description="The .cell file contains geometry information, including cell parameters, atomic coordinates, and k-point coordinates and weights. The file consists of lines containing keywords and data blocks, and associated values" description_url="https://www.tcm.phy.cam.ac.uk/castep/documentation/WebHelp/content/modules/castep/expcastepfilecell.htm"/>
<datatype extension="cif" type="galaxy.datatypes.molecules:CIF" display_in_upload="true" description="CIF or Crystallographic Information File is the standard format for storing crystallographic structural data" description_url="https://www.iucr.org/resources/cif"/>
<datatype extension="xyz" type="galaxy.datatypes.molecules:XYZ" display_in_upload="true" description="Basic format for atomic positions in a structure" description_url="https://open-babel.readthedocs.io/en/latest/FileFormats/XYZ_cartesian_coordinates_format.html"/>
<datatype extension="extxyz" type="galaxy.datatypes.molecules:ExtendedXYZ" display_in_upload="true" description="Extended XYZ format is an enhanced version of the basic XYZ format that allows extra columns to be present in the file for additonal per-atom properties as well as standardising the format of the comment line to include the cell lattice and other per-frame parameters" description_url="https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html#extxyz"/>
<datatype extension="magres" type="galaxy.datatypes.molecules:Magres" display_in_upload="true" description="Ab initio Nuclear Magnetic Resonance file format providing a complete archival and data processing format for the results of first principles calculation of NMR parameters" description_url="https://www.ccpnc.ac.uk/docs/magres"/>
<datatype extension="trr" type="galaxy.datatypes.binary:Trr" display_in_upload="true">
<converter file="mdconvert.xml" target_datatype="xtc"/>
<converter file="mdconvert.xml" target_datatype="dcd"/>
Expand Down Expand Up @@ -963,9 +964,9 @@
<datatype extension="storm.check" type="galaxy.datatypes.text:StormCheck" display_in_upload="true"/>
<datatype extension="ctl.result" type="galaxy.datatypes.text:CTLresult" display_in_upload="true"/>
<!-- CASTEP types -->
<datatype extension="castep" type="galaxy.datatypes.text:Castep" display_in_upload="true"/>
<datatype extension="param" type="galaxy.datatypes.text:Param" display_in_upload="true"/>
<datatype extension="den_fmt" type="galaxy.datatypes.text:FormattedDensity" display_in_upload="true"/>
<datatype extension="castep" type="galaxy.datatypes.text:Castep" display_in_upload="true" description="numerical output of a CASTEP job in ASCII format" description_url="https://www.tcm.phy.cam.ac.uk/castep/documentation/WebHelp/content/modules/castep/expcastepfilecastep.htm"/>
<datatype extension="param" type="galaxy.datatypes.text:Param" display_in_upload="true" description="the param file contains all the input control parameters required to run a CASTEP job. Consists of lines containing keywords and associated values" description_url="https://www.tcm.phy.cam.ac.uk/castep/documentation/WebHelp/content/modules/castep/expcastepfileparam.htm"/>
<datatype extension="den_fmt" type="galaxy.datatypes.text:FormattedDensity" display_in_upload="true" description="formatted electronic density file output by CASTEP containing value of electron density for a grid of points"/>
<!-- Larch types -->
<datatype extension="prj" type="galaxy.datatypes.larch:AthenaProject" display_in_upload="true" description="Athena project file."/>
<datatype extension="inp" type="galaxy.datatypes.larch:FEFFInput" display_in_upload="true" description="FEFF input file."/>
Expand Down Expand Up @@ -1141,6 +1142,7 @@
<sniffer type="galaxy.datatypes.molecules:CIF"/>
<sniffer type="galaxy.datatypes.molecules:ExtendedXYZ"/>
<sniffer type="galaxy.datatypes.molecules:XYZ"/>
<sniffer type="galaxy.datatypes.molecules:Magres" />
<sniffer type="galaxy.datatypes.molecules:MOL2"/>
<sniffer type="galaxy.datatypes.molecules:InChI"/>
<sniffer type="galaxy.datatypes.molecules:FPS"/>
Expand Down
4 changes: 2 additions & 2 deletions lib/galaxy/datatypes/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ def as_display_type(self, dataset: DatasetProtocol, type: str, **kwd) -> Union[F
return f"This display type ({type}) is not implemented for this datatype ({dataset.ext})."

def get_display_links(
self, dataset: DatasetProtocol, type: str, app, base_url: str, request, target_frame: str = "_blank", **kwd
self, dataset: DatasetProtocol, type: str, app, base_url: str, target_frame: str = "_blank", **kwd
):
"""
Returns a list of tuples of (name, link) for a particular display type. No check on
Expand All @@ -794,7 +794,7 @@ def get_display_links(
try:
if app.config.enable_old_display_applications and type in self.get_display_types():
return target_frame, getattr(self, self.supported_display_apps[type]["links_function"])(
dataset, type, app, base_url, request, **kwd
dataset, type, app, base_url, **kwd
)
except Exception:
log.exception(
Expand Down
4 changes: 1 addition & 3 deletions lib/galaxy/datatypes/display_applications/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,14 @@ def __init__(self, display_application):

def get_display_url(self, data, trans):
dataset_hash, user_hash = encode_dataset_user(trans, data, None)
return trans.app.legacy_url_for(
mapper=trans.app.legacy_mapper,
return trans.app.url_for(
controller="dataset",
action="display_application",
dataset_id=dataset_hash,
user_id=user_hash,
app_name=quote_plus(self.display_application.id),
link_name=quote_plus(self.id),
app_action=None,
environ=trans.request.environ,
)

def get_inital_values(self, data, trans):
Expand Down
4 changes: 1 addition & 3 deletions lib/galaxy/datatypes/display_applications/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ def url(self):
base_url = f"http{base_url[5:]}"
return "{}{}".format(
base_url,
self.trans.app.legacy_url_for(
mapper=self.trans.app.legacy_mapper,
self.trans.app.url_for(
controller="dataset",
action="display_application",
dataset_id=self._dataset_hash,
Expand All @@ -282,7 +281,6 @@ def url(self):
link_name=quote_plus(self.parameter.link.id),
app_action=self.action_name,
action_param=self._url,
environ=self.trans.request.environ,
),
)

Expand Down
8 changes: 3 additions & 5 deletions lib/galaxy/datatypes/genetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def as_ucsc_display_file(self, dataset: DatasetProtocol, **kwd) -> Union[FileObj
"""
return open(dataset.get_file_name(), "rb")

def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, request) -> List:
def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> List:
"""
from the ever-helpful angie hinrichs [email protected]
a genome graphs call looks like this
Expand All @@ -115,17 +115,15 @@ def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, re
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build("ucsc", dataset.dbkey):
if site_name in app.datatypes_registry.get_display_sites("ucsc"):
site_url = site_url.replace("/hgTracks?", "/hgGenome?") # for genome graphs
internal_url = "%s" % app.legacy_url_for(
mapper=app.legacy_mapper,
environ=request.environ,
internal_url = app.url_for(
controller="dataset",
dataset_id=dataset.id,
action="display_at",
filename=f"ucsc_{site_name}",
)
display_url = "%s%s/display_as?id=%i&display_app=%s&authz_method=display_at" % (
base_url,
app.legacy_url_for(mapper=app.legacy_mapper, environ=request.environ, controller="root"),
app.url_for(controller="root"),
dataset.id,
type,
)
Expand Down
42 changes: 23 additions & 19 deletions lib/galaxy/datatypes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def display_peek(self, dataset: DatasetProtocol) -> str:
},
)

def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, request) -> List:
def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> List:
"""
Generate links to UCSC genome browser sites based on the dbkey
and content of dataset.
Expand All @@ -338,9 +338,7 @@ def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, re
# Accumulate links for valid sites
ret_val = []
for site_name, site_url in valid_sites:
internal_url = app.legacy_url_for(
mapper=app.legacy_mapper,
environ=request.environ,
internal_url = app.url_for(
controller="dataset",
dataset_id=dataset.id,
action="display_at",
Expand All @@ -350,7 +348,7 @@ def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, re
"%s%s/display_as?id=%i&display_app=%s&authz_method=display_at"
% (
base_url,
app.legacy_url_for(mapper=app.legacy_mapper, environ=request.environ, controller="root"),
app.url_for(controller="root"),
dataset.id,
type,
)
Expand Down Expand Up @@ -769,20 +767,26 @@ class Bed12(BedStrict):

class _RemoteCallMixin:
def _get_remote_call_url(
self, redirect_url: str, site_name: str, dataset: HasId, type: str, app, base_url: str, request
self,
redirect_url: str,
site_name: str,
dataset: HasId,
type: str,
app,
base_url: str,
) -> str:
"""Retrieve the URL to call out to an external site and retrieve data.
This routes our external URL through a local galaxy instance which makes
the data available, followed by redirecting to the remote site with a
link back to the available information.
"""
internal_url = f"{app.legacy_url_for(mapper=app.legacy_mapper, environ=request.environ, controller='dataset', dataset_id=dataset.id, action='display_at', filename=f'{type}_{site_name}')}"
internal_url = f"{app.url_for(controller='dataset', dataset_id=dataset.id, action='display_at', filename=f'{type}_{site_name}')}"
base_url = app.config.get("display_at_callback", base_url)
display_url = quote_plus(
"%s%s/display_as?id=%i&display_app=%s&authz_method=display_at"
% (
base_url,
app.legacy_url_for(mapper=app.legacy_mapper, environ=request.environ, controller="root"),
app.url_for(controller="root"),
dataset.id,
type,
)
Expand Down Expand Up @@ -970,7 +974,7 @@ def get_estimated_display_viewport(
log.exception("Unexpected error")
return (None, None, None) # could not determine viewport

def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, request) -> List:
def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> List:
ret_val = []
seqid, start, stop = self.get_estimated_display_viewport(dataset)
if seqid is not None:
Expand All @@ -979,11 +983,11 @@ def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, re
redirect_url = quote_plus(
f"{site_url}db={dataset.dbkey}&position={seqid}:{start}-{stop}&hgt.customText=%s"
)
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url, request)
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url)
ret_val.append((site_name, link))
return ret_val

def gbrowse_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, request) -> List:
def gbrowse_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> List:
ret_val = []
seqid, start, stop = self.get_estimated_display_viewport(dataset)
if seqid is not None:
Expand All @@ -992,7 +996,7 @@ def gbrowse_links(self, dataset: DatasetProtocol, type: str, app, base_url: str,
if seqid.startswith("chr") and len(seqid) > 3:
seqid = seqid[3:]
redirect_url = quote_plus(f"{site_url}/?q={seqid}:{start}..{stop}&eurl=%s")
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url, request)
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url)
ret_val.append((site_name, link))
return ret_val

Expand Down Expand Up @@ -1372,7 +1376,7 @@ def get_estimated_display_viewport(
log.exception("Unexpected error")
return (None, None, None) # could not determine viewport

def gbrowse_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, request) -> List:
def gbrowse_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> List:
ret_val = []
chrom, start, stop = self.get_estimated_display_viewport(dataset)
if chrom is not None:
Expand All @@ -1381,11 +1385,11 @@ def gbrowse_links(self, dataset: DatasetProtocol, type: str, app, base_url: str,
if chrom.startswith("chr") and len(chrom) > 3:
chrom = chrom[3:]
redirect_url = quote_plus(f"{site_url}/?q={chrom}:{start}..{stop}&eurl=%s")
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url, request)
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url)
ret_val.append((site_name, link))
return ret_val

def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, request) -> List:
def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> List:
ret_val = []
chrom, start, stop = self.get_estimated_display_viewport(dataset)
if chrom is not None:
Expand All @@ -1394,7 +1398,7 @@ def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, re
redirect_url = quote_plus(
f"{site_url}db={dataset.dbkey}&position={chrom}:{start}-{stop}&hgt.customText=%s"
)
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url, request)
link = self._get_remote_call_url(redirect_url, site_name, dataset, type, app, base_url)
ret_val.append((site_name, link))
return ret_val

Expand Down Expand Up @@ -1554,18 +1558,18 @@ def get_estimated_display_viewport(
log.exception("Unexpected error")
return (None, None, None) # could not determine viewport

def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str, request) -> List:
def ucsc_links(self, dataset: DatasetProtocol, type: str, app, base_url: str) -> List:
ret_val = []
chrom, start, stop = self.get_estimated_display_viewport(dataset)
if chrom is not None:
for site_name, site_url in app.datatypes_registry.get_legacy_sites_by_build("ucsc", dataset.dbkey):
if site_name in app.datatypes_registry.get_display_sites("ucsc"):
internal_url = f"{app.legacy_url_for(mapper=app.legacy_mapper, environ=request.environ, controller='dataset', dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name)}"
internal_url = f"{app.url_for(controller='dataset', dataset_id=dataset.id, action='display_at', filename='ucsc_' + site_name)}"
display_url = quote_plus(
"%s%s/display_as?id=%i&display_app=%s&authz_method=display_at"
% (
base_url,
app.legacy_url_for(mapper=app.legacy_mapper, environ=request.environ, controller="root"),
app.url_for(controller="root"),
dataset.id,
type,
)
Expand Down
Loading

0 comments on commit 2a9c8d0

Please sign in to comment.