diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 53822d40..33efbe97 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -59,7 +59,7 @@ jobs: id: restore-cache-jbrowse with: path: ./_site/assets/js/jbrowse - key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_scripts/jbrowse-tracks.sh', 'Makefile', 'assets/js/jbrowse-config.json') }} + key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_config.yml', '_scripts/jbrowse-tracks.sh', '_themes/jekyll-theme-legumeinfo/_includes/analytics.html', 'Makefile', 'assets/js/jbrowse-config.json') }} - uses: actions/setup-node@v4 if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true' with: @@ -69,13 +69,13 @@ jobs: run: | make jbrowse rm -rf assets/js/jbrowse/test_data - mv assets/js/jbrowse _site/assets/js + bundle exec jekyll build --profile --trace # process assets/js/jbrowse/index.html as liquid - uses: actions/cache/save@v4 id: save-cache-jbrowse if: steps.restore-cache-jbrowse.outputs.cache-hit != 'true' with: path: ./_site/assets/js/jbrowse - key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_scripts/jbrowse-tracks.sh', 'Makefile', 'assets/js/jbrowse-config.json') }} + key: jbrowse-${{ hashFiles('_data/datastore-metadata/**', '_config.yml', '_scripts/jbrowse-tracks.sh', '_themes/jekyll-theme-legumeinfo/_includes/analytics.html', 'Makefile', 'assets/js/jbrowse-config.json') }} # create artifact.tar from ./_site directory & upload as artifact named 'github-pages' - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 diff --git a/Makefile b/Makefile index 58857ecc..ed4d0e25 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,7 @@ else # assume dev container PYTHON_VENV_ACTIVATE = true # no-op endif -JBROWSE_VERSION = 2.15.4 +JBROWSE_VERSION = 2.18.0 PA11YCI_VERSION = 3.1.X serve: mostlyclean setup @@ -74,9 +74,14 @@ pa11y: setup # JBrowse CLI will already be installed globally if using a dev container +# Ensure JBrowse index.html is parsed by jekyll & inline GA script jbrowse: setup if ! { command -v jbrowse || npm ls @jbrowse/cli ; } >/dev/null 2>&1; then npm install $(NPM_INSTALL_OPTIONS) @jbrowse/cli@${JBROWSE_VERSION}; fi - if ! [ -d ./assets/js/jbrowse ]; then npx jbrowse create assets/js/jbrowse --tag=v${JBROWSE_VERSION}; fi + if ! [ -d ./assets/js/jbrowse ]; then \ + npx jbrowse create assets/js/jbrowse --tag=v${JBROWSE_VERSION}; \ + sed -i.bak -e 's/^/---\n---\n/' -e 's/>/>\n/g' assets/js/jbrowse/index.html; \ + sed -i.bak -e '/<\/script>/r ./_themes/jekyll-theme-legumeinfo/_includes/analytics.html' assets/js/jbrowse/index.html; \ + fi cp assets/js/jbrowse-config.json assets/js/jbrowse/config.json npm exec -c '_scripts/jbrowse-tracks.sh' diff --git a/README.md b/README.md index d2700e76..8cd733e4 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Changes made to other file types (e.g., data and config files) may only be refle ```sh -make jbrowse # (optional) install JBrowse dependencies if needed +make jbrowse # (optional; slow!) install JBrowse dependencies if needed # & run _scripts/jbrowse-tracks.sh to generate JBrowse config.json make # install dependencies if needed & start jekyll server listening on localhost:4000 ... CTRL-C ... diff --git a/_scripts/jbrowse-tracks.sh b/_scripts/jbrowse-tracks.sh index 3a146694..a26b7d32 100755 --- a/_scripts/jbrowse-tracks.sh +++ b/_scripts/jbrowse-tracks.sh @@ -48,13 +48,46 @@ do ( eval $(yaml2sh ${readme}) datastore_dir_url=${DATASTORE_URL}/$(dirname ${readme#_data/datastore-metadata/}) + trackId=${identifier%.*} + assemblyNames=${identifier%.ann[0-9].*} + if grep -q jbrowse-index ${readme%/*}/MANIFEST.*.yml + then + config=$(printf ' + { + "displays": [{"displayId":"%s","renderer":{"maxHeight":3000}}], + "textSearching": { + "textSearchAdapter": { + "type": "TrixTextSearchAdapter", + "textSearchAdapterId": "%s-index", + "ixFilePath": { + "uri": "https://data.soybase.org/jbrowse-index/trix/%s.ix", + "locationType": "UriLocation" + }, + "ixxFilePath": { + "uri": "https://data.soybase.org/jbrowse-index/trix/%s.ixx", + "locationType": "UriLocation" + }, + "metaFilePath": { + "uri": "https://data.soybase.org/jbrowse-index/trix/%s_meta.json", + "locationType": "UriLocation" + }, + "assemblyNames": [ + "%s" + ] + } + } + }' "${trackId}" "${trackId}" "${trackId}" "${trackId}" "${trackId}" "${assemblyNames}") + else + config=$(printf '{"displays":[{"displayId":"%s","renderer":{"maxHeight":3000}}]}' "${identifier%.*}") + fi + jbrowse add-track \ ${datastore_dir_url}/${scientific_name_abbrev}.${identifier}.gene_models_main.gff3.gz \ - --assemblyNames=${identifier%.ann[0-9].*} \ + --assemblyNames=${assemblyNames} \ --category='Genes' \ - --trackId=${identifier%.*} \ + --trackId=${trackId} \ --description="${synopsis}

more info: ${datastore_dir_url}/" \ - --config=$(printf '{"displays":[{"displayId":"%s","renderer":{"maxHeight":3000}}]}' "${identifier%.*}") \ + --config="${config}" \ --out=assets/js/jbrowse ) done @@ -64,12 +97,38 @@ do ( eval $(yaml2sh ${readme}) datastore_dir_url=${DATASTORE_URL}/$(dirname ${readme#_data/datastore-metadata/}) + assemblyNames=${identifier%.mrk.*} + config=$(printf ' + { + "textSearching": { + "textSearchAdapter": { + "type": "TrixTextSearchAdapter", + "textSearchAdapterId": "%s-index", + "ixFilePath": { + "uri": "https://data.soybase.org/jbrowse-index/trix/%s.ix", + "locationType": "UriLocation" + }, + "ixxFilePath": { + "uri": "https://data.soybase.org/jbrowse-index/trix/%s.ixx", + "locationType": "UriLocation" + }, + "metaFilePath": { + "uri": "https://data.soybase.org/jbrowse-index/trix/%s_meta.json", + "locationType": "UriLocation" + }, + "assemblyNames": [ + "%s" + ] + } + } + }' "${identifier}" "${identifier}" "${identifier}" "${identifier}" "${assemblyNames}") jbrowse add-track \ ${datastore_dir_url}/${scientific_name_abbrev}.${identifier}.gff3.gz \ - --assemblyNames=${identifier%.mrk.*} \ + --assemblyNames=${assemblyNames} \ --category='Markers' \ --name=${identifier##*.} \ --trackId=${identifier} \ + --config="${config}" \ --description="${synopsis}

more info: ${datastore_dir_url}/" \ --out=assets/js/jbrowse ) @@ -159,15 +218,3 @@ do --out=assets/js/jbrowse/ done done - - - - - - -# FIXME: too big & slow to generate for testing -# https://github.com/GMOD/jbrowse-components/issues/3019 -#npx jbrowse text-index \ -# --perTrack \ -# --tracks='...' \ -# --attributes='Name' diff --git a/assets/js/jbrowse-config.json b/assets/js/jbrowse-config.json index 74bf0ef1..8abf8937 100644 --- a/assets/js/jbrowse-config.json +++ b/assets/js/jbrowse-config.json @@ -1,5 +1,6 @@ { "configuration": { + "disableAnalytics": true, "hierarchical": { "defaultCollapsed": { "subCategories": true