Skip to content

Commit

Permalink
Use external jbrowse text-index service
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanweeks committed Nov 2, 2024
1 parent 25ca1d4 commit b49ce66
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 19 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ jbrowse: setup
if ! [ -d ./assets/js/jbrowse ]; then npx jbrowse create assets/js/jbrowse --tag=v${JBROWSE_VERSION}; fi
cp assets/js/jbrowse-config.json assets/js/jbrowse/config.json
npm exec -c '_scripts/jbrowse-tracks.sh'
# Add .csv suffix to trix index files (*.ix/*.ixx) to trix GitHub pages into serving them with Content-Encoding: gz
if [ -d assets/js/jbrowse/trix ]; then find assets/js/jbrowse/trix \( -name '*.ix' -o -name '*.ixx' \) -exec mv {} {}.csv \; ; fi
sed -i.bak 's/\(\.ixx\{0,1\}\)"/\1.csv"/' assets/js/jbrowse/config.json && rm assets/js/jbrowse/config.json.bak


setup:
Expand Down
72 changes: 56 additions & 16 deletions _scripts/jbrowse-tracks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,27 +49,41 @@ do
eval $(yaml2sh ${readme})
datastore_dir_url=${DATASTORE_URL}/$(dirname ${readme#_data/datastore-metadata/})
trackId=${identifier%.*}
assemblyNames=${identifier%.ann[0-9].*}
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}")

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=${trackId} \
--description="${synopsis}<br /><br /><b>more info:</b> ${datastore_dir_url}/" \
--config=$(printf '{"displays":[{"displayId":"%s","renderer":{"maxHeight":3000}}]}' "${identifier%.*}") \
--config="${config}" \
--out=assets/js/jbrowse

# index only if under the "Reference" category
if awk '$2 == "identifier:" && $3 == identifier {
getline; getline; exit(/accession_group:.* et al\.,/)}' \
identifier=${identifier%%.*} ${readme%/annotations/*}/about_this_collection/description_*_*.yml
then
jbrowse text-index \
--perTrack \
--tracks=${trackId} \
--prefixSize=40 \
--exclude=exon,CDS,five_prime_UTR,three_prime_UTR \
--out=assets/js/jbrowse
fi
)
done

Expand All @@ -78,12 +92,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}<br /><br /><b>more info:</b> ${datastore_dir_url}/" \
--out=assets/js/jbrowse
)
Expand Down

0 comments on commit b49ce66

Please sign in to comment.