Skip to content

Commit

Permalink
spaceranger_bump_version (nf-core#7088)
Browse files Browse the repository at this point in the history
* spaceranger_bump_version

* build: Use ADD to download tar.gz

* style: Clean up Dockerfile

* chore: Update labels and use an ARG

* chore: Switch base image to match Seqera Containers

* build: Make a manual checksum

* chore: Update [email protected]

* docs: Update documentation

* build: Bump image location and tag

* build: Can't actually get run of the tar.gz unzip step

Because of the Spaceranger URL.

* test(spaceranger): Add stub for mkref

* test: Bump snapshot

* test: Update versions yaml snapshot

* docs: Use a placeholder to avoid confusion

Co-authored-by: sebotic <[email protected]>

---------

Co-authored-by: Edmund Miller <[email protected]>
Co-authored-by: Edmund Miller <[email protected]>
Co-authored-by: sebotic <[email protected]>
  • Loading branch information
4 people authored and LouisLeNezet committed Dec 4, 2024
1 parent 01c4266 commit c9bc9a5
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 114 deletions.
42 changes: 27 additions & 15 deletions modules/nf-core/spaceranger/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
FROM continuumio/miniconda3:4.9.2
LABEL authors="Gisela Gabernet <[email protected]>,Edmund Miller <[email protected]>" \
description="Docker image containing Space Ranger"
# syntax=docker/dockerfile:1

FROM mambaorg/micromamba:1.5.10-noble
ARG SPACERANGER_VER="3.1.2"
# NOTE you need to go fill out the form to get a new download link
ARG SPACERANGER_URL="https://cf.10xgenomics.com/releases/spatial-exp/spaceranger-3.1.2.tar.gz?Expires=1732608367&Key-Pair-Id=APKAI7S6A5RYOXBWRPDA&Signature=S4jcGCs5H0wLFfREhSc~AfuPIOXE~PW96kX9o2EyxZnmn1goUecgfEWTj67fL1DnZJBIa06kFdUdNpsMn2ustiSWOfXEgjlYQnxIcNnQIiEBGoQTHWphvx3LEQ6wtZnkWS80P6IcE0HJkIsgy04t6Sohih5cxY4jgytYsrAfZDYr5G3KKFwTfCKmhzMaXqW635yPbyQ8xEcQHK0QwviAx8-EFq-PE8UzC4QgUKi2MW-ivcfZkSDSfF8C3s7SgwDXIGIWv52mzeszenxMjN4KrWQotZ7ZpktzI0Vfpz0dNC17dQeDQUHj4LuNYbdh3RqsPKtqu3wjCe2Q7KiyoWnmaw__" \"
ARG SPACERANGER_SHA256="2566b24f29829b39f3add112a674990b1c54ae2fbe7ccb50a4c7dce9ccf152e6"
LABEL org.opencontainers.image.authors="Gisela Gabernet <[email protected]>,Edmund Miller <[email protected]>"
LABEL org.opencontainers.image.description="Docker image containing spaceranger"
LABEL org.opencontainers.image.version="$SPACERANGER_VER"
LABEL org.opencontainers.image.documentation="https://github.com/nf-core/modules/blob/master/modules/nf-core/spaceranger/README.md"
LABEL org.opencontainers.image.source="https://github.com/nf-core/modules"
LABEL org.opencontainers.image.vendor="nf-core"
LABEL org.opencontainers.image.license="https://www.10xgenomics.com/support/software/space-ranger/downloads/eula"
# Disclaimer: this container is not provided nor supported by 10x Genomics.

# Install procps and curl and clean apt cache
RUN apt-get update --allow-releaseinfo-change \
&& apt-get install -y procps curl \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
RUN micromamba install -y -n base conda-forge::procps-ng \
&& micromamba clean -a -y
USER root
ENV PATH="$MAMBA_ROOT_PREFIX/bin:$PATH"

# Copy pre-downloaded spaceranger file
ENV SPACERANGER_VER 3.0.0
COPY spaceranger-$SPACERANGER_VER.tar.gz /opt/spaceranger-$SPACERANGER_VER.tar.gz
# NOTE Docker doesn't support md5sum and that's what spaceranger gives us --checksum=md5sum:949088b1e2cc5bd03079b60a65b41d39
# https://docs.docker.com/reference/dockerfile/#add---checksum
ADD --checksum=sha256:$SPACERANGER_SHA256 \
$SPACERANGER_URL \
/opt/spaceranger-$SPACERANGER_VER.tar.gz

# Install spaceranger
RUN \
cd /opt && \
tar -xzvf spaceranger-$SPACERANGER_VER.tar.gz && \
export PATH=/opt/spaceranger-$SPACERANGER_VER:$PATH && \
ln -s /opt/spaceranger-$SPACERANGER_VER/spaceranger /usr/bin/spaceranger && \
rm -rf /opt/spaceranger-$SPACERANGER_VER.tar
RUN tar -xzf /opt/spaceranger-$SPACERANGER_VER.tar.gz -C /opt/ \
&& rm /opt/spaceranger-$SPACERANGER_VER.tar.gz \
&& ln -s /opt/spaceranger-$SPACERANGER_VER/spaceranger /usr/bin/spaceranger
ENV PATH="/opt/spaceranger-$SPACERANGER_VER:$PATH"
22 changes: 11 additions & 11 deletions modules/nf-core/spaceranger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

Space Ranger is a commercial tool by 10X Genomics. The container provided for the spaceranger nf-core module is not provided nor supported by 10x Genomics. Updating the Space Ranger version in the container and pushing the update to Dockerhub needs to be done manually.

1. Navigate to the [Space Ranger download page](https://support.10xgenomics.com/spatial-gene-expression/software/downloads/latest) and download the tar ball of the desired Space Ranger version with `curl` or `wget`. Place this file in the same folder where the Dockerfile lies.
1. Navigate to the [Space Ranger download page](https://support.10xgenomics.com/spatial-gene-expression/software/downloads/latest) and get a link for the Space Ranger downloads

2. Edit the Dockerfile: update the Cell Ranger version in this line:
2. Edit the Dockerfile: update the Space Ranger version in this line:

```bash
ENV SPACERANGER_VER <VERSION>
```
```diff
- ARG SPACERANGER_VER="3.1.2"
+ ARG SPACERANGER_VER="<New version>"
- ARG SPACERANGER_URL="https://cf.10xgenomics.com/releases/spatial-exp/spaceranger-3.1.2.tar.gz?Expires=1732608367&Key-Pair-Id=APKAI7S6A5RYOXBWRPDA&Signature=S4jcGCs5H0wLFfREhSc~AfuPIOXE~PW96kX9o2EyxZnmn1goUecgfEWTj67fL1DnZJBIa06kFdUdNpsMn2ustiSWOfXEgjlYQnxIcNnQIiEBGoQTHWphvx3LEQ6wtZnkWS80P6IcE0HJkIsgy04t6Sohih5cxY4jgytYsrAfZDYr5G3KKFwTfCKmhzMaXqW635yPbyQ8xEcQHK0QwviAx8-EFq-PE8UzC4QgUKi2MW-ivcfZkSDSfF8C3s7SgwDXIGIWv52mzeszenxMjN4KrWQotZ7ZpktzI0Vfpz0dNC17dQeDQUHj4LuNYbdh3RqsPKtqu3wjCe2Q7KiyoWnmaw__" \"
+ ARG SPACERANGER_URL="<Your-unique-download-link-that-expires"
- ARG SPACERANGER_SHA256="2566b24f29829b39f3add112a674990b1c54ae2fbe7ccb50a4c7dce9ccf152e6"
+ ARG SPACERANGER_SHA256="<Manual SHA256 of tar.gz>"
```

3. Create the container:

```bash
docker build . -t quay.io/nf-core/spaceranger:<VERSION>
docker push quay.io/nf-core/spaceranger:<VERSION>
```
3. Push the changes and the Dockerfile should be built and uploaded to `quay.io/nf-core/modules/spaceranger`!
2 changes: 1 addition & 1 deletion modules/nf-core/spaceranger/count/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process SPACERANGER_COUNT {
tag "$meta.id"
label 'process_high'

container "nf-core/spaceranger:3.0.0"
container "nf-core/modules/spaceranger:d71611e316a8614b"

input:
tuple val(meta), path(reads), path(image), path(cytaimage), path(darkimage), path(colorizedimage), path(alignment), path(slidefile)
Expand Down
6 changes: 3 additions & 3 deletions modules/nf-core/spaceranger/count/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
path(process.out.versions.get(0)).yaml,
process.out.outs.get(0).get(1).findAll { file(it).name !in [
'web_summary.html',
'scalefactors_json.json',
Expand Down Expand Up @@ -144,7 +144,7 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.versions).match() }
{ assert snapshot(path(process.out.versions.get(0)).yaml).match() },
)
}
}
Expand Down Expand Up @@ -204,7 +204,7 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
path(process.out.versions.get(0)).yaml,
process.out.outs.get(0).get(1).findAll { file(it).name !in [
'web_summary.html',
'scalefactors_json.json',
Expand Down
120 changes: 63 additions & 57 deletions modules/nf-core/spaceranger/count/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,90 +1,96 @@
{
"spaceranger v1 (stub) - homo_sapiens - fasta - gtf - fastq - tif - csv": {
"content": [
[
"versions.yml:md5,1539e8a9a3d63ce3653920721d1af509"
]
{
"SPACERANGER_COUNT": {
"spaceranger": "3.1.2"
}
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-04-02T09:29:02.205153668"
"timestamp": "2024-11-26T01:48:31.348979531"
},
"spaceranger v2 - homo_sapiens - fasta - gtf - fastq - tif - csv": {
"content": [
{
"SPACERANGER_COUNT": {
"spaceranger": "3.1.2"
}
},
[
"versions.yml:md5,1539e8a9a3d63ce3653920721d1af509"
],
[
"clusters.csv:md5,2cc2d0c94ec0af69f03db235f9ea6932",
"clusters.csv:md5,46c12f3845e28f27f2cd580cb004c0ea",
"clusters.csv:md5,4e5f082240b9c9903168842d1f9dbe34",
"clusters.csv:md5,e626eb7049baf591ea49f5d8c305621c",
"clusters.csv:md5,65cfb24fc937e4df903a742c1adf8b08",
"clusters.csv:md5,819a71787618945dacfa2d5301b953b1",
"clusters.csv:md5,5ae17ed02cdb9f61d7ceb0cd6922c9d4",
"clusters.csv:md5,641550bec22e02fff3611087f7fd6e07",
"clusters.csv:md5,9fbe5c79035175bc1899e9a7fc80f7ac",
"clusters.csv:md5,ed0c2dcca15c14a9983407ff9af0daaf",
"differential_expression.csv:md5,d37a8ef21699372ec4a4bdf0c43d71b7",
"differential_expression.csv:md5,ac3181524385c88d38a0fc17d3bdd526",
"differential_expression.csv:md5,557d6dfec7421c392aa6443725608cd1",
"differential_expression.csv:md5,1437fad68d701c97a4a46318aee45575",
"differential_expression.csv:md5,7a2f3d0e90782055580f4903617a7d27",
"differential_expression.csv:md5,41756e9570d07aee6aed710e6a965846",
"differential_expression.csv:md5,62ea7651c3f195d3c960c6c688dca477",
"differential_expression.csv:md5,b630542266c4abb71f4205922340498d",
"differential_expression.csv:md5,0deb97f0be7e72ad73e456092db31e6d",
"differential_expression.csv:md5,3bba8490f753507e7e2e29be759f218b",
"components.csv:md5,568bb9bcb6ee913356fcb4be3fea1911",
"dispersion.csv:md5,e2037b1db404f6e5d8b3144629f2500d",
"features_selected.csv:md5,3ba6d1315ae594963b306d94ba1180e7",
"projection.csv:md5,aef5d71381678d5245e471f3d5a8ab67",
"variance.csv:md5,475a95e51ce66e639ae21d801c455e2b",
"projection.csv:md5,928c0f68a9c773fba590941d3d5af7ca",
"projection.csv:md5,216dcc5589a083fcc27d981aa90fa2ab",
"filtered_feature_bc_matrix.h5:md5,f1a8f225c113974b47efffe08e70f367",
"metrics_summary.csv:md5,faa17487b479eab361050d3266da2efb",
"clusters.csv:md5,221a4554e62ea94b0df8dbf637d2c13c",
"clusters.csv:md5,53ee76645943b5562392aac51d2d9f3f",
"clusters.csv:md5,b791359469683ad19cdb8d1af3de5705",
"clusters.csv:md5,9a4f9148e0e834c1127bf8393ece6330",
"clusters.csv:md5,c11bcc64f870469ab2f136d9272a7a6d",
"clusters.csv:md5,488846bbb469365e199928c7a440320a",
"clusters.csv:md5,5941f7e847d35a4f06d3631e21d2eb9d",
"clusters.csv:md5,d244d405c32766339d2b7a3fa8bf8cee",
"clusters.csv:md5,981386408cd953548994c31253e787de",
"clusters.csv:md5,24c4f13449e5362fcbcd41b9ff413992",
"differential_expression.csv:md5,589c1bd4529f092bb1d332e7da561dad",
"differential_expression.csv:md5,d9d978b398b33ac9687b44531909e0cd",
"differential_expression.csv:md5,4edbc893280f9d03c3de00a503e86f8c",
"differential_expression.csv:md5,316181d501c495384016227309856b09",
"differential_expression.csv:md5,dae49941396609fb08df13b82fe89151",
"differential_expression.csv:md5,4a13ae44c8454dbcb0298eb63df8b8e8",
"differential_expression.csv:md5,eeb02c4afe1f49d5502fb024b25b2c38",
"differential_expression.csv:md5,9a456828fe5d762e6e07383da5c2791d",
"differential_expression.csv:md5,bcbd1504976824e9f4d20a8dd36e2a1f",
"differential_expression.csv:md5,3ad93fc4d52950cfede885dc58cd2823",
"components.csv:md5,811a32dce6c795e958dc4bc635ee53be",
"dispersion.csv:md5,64c2e57ef0ca9a80cce8b952c81b62f5",
"features_selected.csv:md5,bd0c0a20b0b0009df796e8a755d028c1",
"projection.csv:md5,e530c925a185965514fa82f4da83fa81",
"variance.csv:md5,4159711ab5d64e97737fad9d75d945b3",
"projection.csv:md5,ce729f7e237df4570ac3e4a79251df24",
"projection.csv:md5,fa7bdefa8424b233fe6461129ab76d57",
"filtered_feature_bc_matrix.h5:md5,f625d7e2c063c8c079ccc35a853b356d",
"metrics_summary.csv:md5,5ece84f5f8e08839749b1c8f2bff6701",
"probe_set.csv:md5,5bfb8f12319be1b2b6c14142537c3804",
"raw_feature_bc_matrix.h5:md5,6e40ae93a116c6fc0adbe707b0eb415f",
"raw_probe_bc_matrix.h5:md5,3d5e711d0891ca2caaf301a2c1fbda91",
"raw_feature_bc_matrix.h5:md5,90575715eb252f0b652c9d36a1f5628e",
"raw_probe_bc_matrix.h5:md5,8ab08437814506f98e3f10107cfc38ac",
"aligned_fiducials.jpg:md5,51dcc3a32d3d5ca4704f664c8ede81ef",
"cytassist_image.tiff:md5,0fb04a55e5658f4d158d986a334b034d",
"detected_tissue_image.jpg:md5,1d3ccc1e12c4fee091b006e48b9cc16a",
"spatial_enrichment.csv:md5,1117792553e82feb2b4b3934907a0136",
"detected_tissue_image.jpg:md5,11c9fa90913b5c6e93cecdb8f53d58db",
"spatial_enrichment.csv:md5,4379bc4fef891b45ff9264ee8c408bd0",
"tissue_hires_image.png:md5,834706fff299024fab48e6366afc9cb9",
"tissue_lowres_image.png:md5,8c1fcb378f7f886301f49ffc4f84360a",
"tissue_positions.csv:md5,425601ef21661ec0126000f905ef044f"
"tissue_positions.csv:md5,930aeb2b790032337d91dd27cc70f135"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-04-02T10:13:00.787792273"
"timestamp": "2024-11-26T01:58:16.555517048"
},
"spaceranger v1 - homo_sapiens - fasta - gtf - fastq - tif - csv": {
"content": [
{
"SPACERANGER_COUNT": {
"spaceranger": "3.1.2"
}
},
[
"versions.yml:md5,1539e8a9a3d63ce3653920721d1af509"
],
[
"filtered_feature_bc_matrix.h5:md5,7e09d1cd2e1f497a698c5efde9e4af84",
"metrics_summary.csv:md5,07a6fcc2e20f854f8d3fcde2457a2f9a",
"molecule_info.h5:md5,1f2e0fd31d15509e7916e84f22632c9c",
"raw_feature_bc_matrix.h5:md5,5a4184a3bfaf722eec8d1a763a45906e",
"filtered_feature_bc_matrix.h5:md5,a756f6dda550f52f9fb3e347207a2c6c",
"metrics_summary.csv:md5,38774fc5f54873d711b4898a2dd50e72",
"molecule_info.h5:md5,9e6393dbbccdfe58edf9e92181261f88",
"raw_feature_bc_matrix.h5:md5,860702876f936f89fdcec2b5f599a7d2",
"aligned_fiducials.jpg:md5,f6217ddd707bb189e665f56b130c3da8",
"detected_tissue_image.jpg:md5,c1c7e8741701a576c1ec103c1aaf98ea",
"tissue_hires_image.png:md5,d91f8f176ae35ab824ede87117ac0889",
"tissue_lowres_image.png:md5,475a04208d193191c84d7a3b5d4eb287",
"tissue_positions.csv:md5,748bf590c445db409d7dbdf5a08e72e8"
"tissue_positions.csv:md5,7f9cb407b3dd69726a12967b979a5624"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-04-02T09:37:13.128424153"
"timestamp": "2024-11-26T01:48:13.569651476"
}
}
2 changes: 1 addition & 1 deletion modules/nf-core/spaceranger/mkgtf/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process SPACERANGER_MKGTF {
tag "$gtf"
label 'process_low'

container "nf-core/spaceranger:3.0.0"
container "nf-core/modules/spaceranger:d71611e316a8614b"

input:
path gtf
Expand Down
5 changes: 4 additions & 1 deletion modules/nf-core/spaceranger/mkgtf/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ nextflow_process {
then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(
process.out.gtf,
path(process.out.versions.get(0)).yaml,
).match() }
)
}

Expand Down
24 changes: 9 additions & 15 deletions modules/nf-core/spaceranger/mkgtf/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
{
"homo_sapiens - gtf": {
"content": [
[
"genome.filtered.gtf:md5,50fc877b1c53b36b3b413aff88bda48c"
],
{
"0": [
"genome.filtered.gtf:md5,50fc877b1c53b36b3b413aff88bda48c"
],
"1": [
"versions.yml:md5,2e30a28641165e16d77eec844cbaffe5"
],
"gtf": [
"genome.filtered.gtf:md5,50fc877b1c53b36b3b413aff88bda48c"
],
"versions": [
"versions.yml:md5,2e30a28641165e16d77eec844cbaffe5"
]
"SPACERANGER_MKGTF": {
"spaceranger": "3.1.2"
}
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
"nf-test": "0.9.2",
"nextflow": "24.10.1"
},
"timestamp": "2024-04-02T09:29:35.376030595"
"timestamp": "2024-11-26T01:58:29.469616437"
}
}
35 changes: 34 additions & 1 deletion modules/nf-core/spaceranger/mkref/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process SPACERANGER_MKREF {
tag "$fasta"
label 'process_high'

container "nf-core/spaceranger:3.0.0"
container "nf-core/modules/spaceranger:d71611e316a8614b"

input:
path fasta
Expand Down Expand Up @@ -41,4 +41,37 @@ process SPACERANGER_MKREF {
spaceranger: \$(spaceranger -V | sed -e "s/spaceranger spaceranger-//g")
END_VERSIONS
"""

stub:
// Exit if running this module with -profile conda / -profile mamba
if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) {
error "SPACERANGER_COUNT module does not support Conda. Please use Docker / Singularity / Podman instead."
}
"""
mkdir -p $reference_name
touch ${reference_name}/genome.fa
touch ${reference_name}/genome.fa.fai
touch ${reference_name}/genes.gtf.gz
touch ${reference_name}/reference.json
touch ${reference_name}/Genome
touch ${reference_name}/SA
touch ${reference_name}/SAindex
touch ${reference_name}/chrLength.txt
touch ${reference_name}/chrName.txt
touch ${reference_name}/chrNameLength.txt
touch ${reference_name}/chrStart.txt
touch ${reference_name}/exonGeTrInfo.tab
touch ${reference_name}/exonInfo.tab
touch ${reference_name}/geneInfo.tab
touch ${reference_name}/sjdbInfo.txt
touch ${reference_name}/sjdbList.fromGTF.out.tab
touch ${reference_name}/sjdbList.out.tab
touch ${reference_name}/transcriptInfo.tab
cat <<-END_VERSIONS > versions.yml
"${task.process}":
spaceranger: \$(spaceranger -V | sed -e "s/spaceranger spaceranger-//g")
END_VERSIONS
"""
}
2 changes: 1 addition & 1 deletion modules/nf-core/spaceranger/mkref/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.versions,
path(process.out.versions.get(0)).yaml,
"${process.out.reference[0]}/fasta",
"${process.out.reference[0]}/genes",
"${process.out.reference[0]}/reference.json",
Expand Down
Loading

0 comments on commit c9bc9a5

Please sign in to comment.