Skip to content

Commit

Permalink
Merge branch 'release_18.01' into dev
Browse files Browse the repository at this point in the history
Conflicts:
	scripts/common_startup.sh
  • Loading branch information
nsoranzo committed Feb 8, 2018
2 parents 0ca7afb + d910780 commit 10ff797
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"build-production": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production\" \"yarn run gulp clean && yarn run gulp-production\" && yarn run save-build-hash",
"build-production-maps": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production-maps\" \"yarn run gulp clean && yarn run gulp-production-maps\" && yarn run save-build-hash",
"webpack": "webpack -d",
"save-build-hash": "git rev-parse HEAD > ../static/client_build_hash.txt",
"save-build-hash": "(git rev-parse HEAD 2>/dev/null || echo '') >../static/client_build_hash.txt",
"webpack-watch": "webpack -d --watch",
"webpack-production": "webpack -p",
"webpack-production-maps": "GXY_BUILD_SOURCEMAPS=1 webpack -p",
Expand Down
3 changes: 3 additions & 0 deletions config/datatypes_conf.xml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@
<datatype extension="allegro_ihaplo" type="galaxy.datatypes.tabular:Tabular" />
<datatype extension="allegro_descent" type="galaxy.datatypes.tabular:Tabular" />
<datatype extension="allegro_fparam" type="galaxy.datatypes.genetics:AllegroLOD" />
<!-- IDEAS datatypes -->
<datatype extension="ideaspre" type="galaxy.datatypes.genetics:IdeasPre" display_in_upload="true"/>
<!-- End IDEAS datatypes -->
</registration>
<sniffers>
<!--
Expand Down
67 changes: 67 additions & 0 deletions lib/galaxy/datatypes/genetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,73 @@ class Snptest(Rgenetics):
file_ext = "snptest"


class IdeasPre(Html):
"""
This datatype defines the input format required by IDEAS:
https://academic.oup.com/nar/article/44/14/6721/2468150
The IDEAS preprocessor tool produces an output using this
format. The extra_files_path of the primary input dataset
contains the following files and directories.
- chromosome_windows.txt (optional)
- chromosomes.bed (optional)
- IDEAS_input_config.txt
- compressed archived tmp directory containing a number of compressed bed files.
"""

MetadataElement(name="base_name", desc="Base name for this dataset", default='IDEASData', readonly=True, set_in_upload=True)
MetadataElement(name="chrom_bed", desc="Bed file specifying window positions", default=None, readonly=True)
MetadataElement(name="chrom_windows", desc="Chromosome window positions", default=None, readonly=True)
MetadataElement(name="input_config", desc="IDEAS input config", default=None, readonly=True)
MetadataElement(name="tmp_archive", desc="Compressed archive of compressed bed files", default=None, readonly=True)

composite_type = 'auto_primary_file'
allow_datatype_change = False
file_ext = 'ideaspre'

def __init__(self, **kwd):
Html.__init__(self, **kwd)
self.add_composite_file('chromosome_windows.txt', description='Chromosome window positions', is_binary=False, optional=True)
self.add_composite_file('chromosomes.bed', description='Bed file specifying window positions', is_binary=False, optional=True)
self.add_composite_file('IDEAS_input_config.txt', description='IDEAS input config', is_binary=False)
self.add_composite_file('tmp.tar.gz', description='Compressed archive of compressed bed files', is_binary=True)

def set_meta(self, dataset, **kwd):
Html.set_meta(self, dataset, **kwd)
for fname in os.listdir(dataset.extra_files_path):
if fname.startswith("chromosomes"):
dataset.metadata.chrom_bed = os.path.join(dataset.extra_files_path, fname)
elif fname.startswith("chromosome_windows"):
dataset.metadata.chrom_windows = os.path.join(dataset.extra_files_path, fname)
elif fname.startswith("IDEAS_input_config"):
dataset.metadata.input_config = os.path.join(dataset.extra_files_path, fname)
elif fname.startswith("tmp"):
dataset.metadata.tmp_archive = os.path.join(dataset.extra_files_path, fname)
self.regenerate_primary_file(dataset)

def generate_primary_file(self, dataset=None):
rval = ['<html><head></head><body>']
rval.append('<h3>Files prepared for IDEAS</h3>')
rval.append('<ul>')
for composite_name, composite_file in self.get_composite_files(dataset=dataset).items():
fn = composite_name
rval.append('<li><a href="%s>%s</a></li>' % (fn, fn))
rval.append('</ul></body></html>\n')
return "\n".join(rval)

def regenerate_primary_file(self, dataset):
# Cannot do this until we are setting metadata.
rval = ['<html><head></head><body>']
rval.append('<h3>Files prepared for IDEAS</h3>')
rval.append('<ul>')
for fname in os.listdir(dataset.extra_files_path):
fn = os.path.split(fname)[-1]
rval.append('<li><a href="%s">%s</a></li>' % (fn, fn))
rval.append('</ul></body></html>')
with open(dataset.file_name, 'w') as f:
f.write("\n".join(rval))
f.write('\n')


class Pheno(Tabular):
"""
base class for pheno files
Expand Down
26 changes: 16 additions & 10 deletions scripts/common_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ for rmfile in $RMFILES; do
done

# Determine branch (if using git)
if command -v git >/dev/null; then
if command -v git >/dev/null && [ -d .git ]; then
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
case $GIT_BRANCH in
release_*|master)
Expand All @@ -93,7 +93,7 @@ if command -v git >/dev/null; then
esac
else
GIT_BRANCH=0
SKIP_CLIENT_BUILD=1
DEV_WHEELS=1
fi

: ${GALAXY_CONFIG_FILE:=config/galaxy.yml}
Expand All @@ -120,7 +120,7 @@ if [ $SET_VENV -eq 1 -a $CREATE_VENV -eq 1 ]; then
# Ensure Python is a supported version before creating .venv
python ./scripts/check_python.py || exit 1
if command -v virtualenv >/dev/null; then
virtualenv -p $(command -v python) "$GALAXY_VIRTUAL_ENV"
virtualenv -p "$(command -v python)" "$GALAXY_VIRTUAL_ENV"
else
vvers=13.1.2
vurl="https://pypi.python.org/packages/source/v/virtualenv/virtualenv-${vvers}.tar.gz"
Expand Down Expand Up @@ -192,13 +192,19 @@ fi
# Check client build state.
if [ $SKIP_CLIENT_BUILD -eq 0 ]; then
if [ -f static/client_build_hash.txt ]; then
# Compare hash.
githash=$(git rev-parse HEAD)
statichash=$(cat static/client_build_hash.txt)
if [ "$githash" = "$statichash" ]; then
# If git is not used and static/client_build_hash.txt is present, next
# client rebuilds must be done manually by the admin
if [ "$GIT_BRANCH" = "0" ]; then
SKIP_CLIENT_BUILD=1
else
echo "The Galaxy client is out of date and will be built now."
# Compare hash.
githash=$(git rev-parse HEAD)
statichash=$(cat static/client_build_hash.txt)
if [ "$githash" = "$statichash" ]; then
SKIP_CLIENT_BUILD=1
else
echo "The Galaxy client is out of date and will be built now."
fi
fi
else
echo "The Galaxy client has not yet been built and will be built now."
Expand All @@ -209,11 +215,11 @@ fi
if [ $SKIP_CLIENT_BUILD -eq 0 ]; then
# Ensure dependencies are installed
if [ -n "$VIRTUAL_ENV" ]; then
if ! in_venv `command -v node`; then
if ! in_venv "$(command -v node)"; then
echo "Installing node into $VIRTUAL_ENV with nodeenv."
nodeenv -p
fi
if ! in_venv `command -v yarn`; then
if ! in_venv "$(command -v yarn)"; then
echo "Installing yarn into $VIRTUAL_ENV with npm."
npm install --global yarn
fi
Expand Down

0 comments on commit 10ff797

Please sign in to comment.