From 18b187d0558726748d83d39f6f6e21b8a67d5a3a Mon Sep 17 00:00:00 2001 From: Bill Flynn Date: Tue, 2 Jan 2024 14:10:14 -0500 Subject: [PATCH 1/3] added gpr creation to spaceranger pipeline --- modules/spaceranger.nf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/spaceranger.nf b/modules/spaceranger.nf index 050a694..ced6815 100644 --- a/modules/spaceranger.nf +++ b/modules/spaceranger.nf @@ -57,6 +57,8 @@ process SPACERANGER_COUNT { script: main_options = construct_vis_cli_options(record) localmem = Math.round(task.memory.toGiga() * 0.95) + serial_prefix = record.slide.substring(0, 6) + spatial_dir = "${record.tool_pubdir}/spatial" """ spaceranger count $main_options --localcores=$task.cpus --localmem=$localmem @@ -66,6 +68,18 @@ process SPACERANGER_COUNT { mv ${record.output_id}/outs/* ${record.tool_pubdir}/ find ${record.output_id}/SPATIAL_RNA_COUNTER_CS/ -type f -name "metrics_summary_json.json" -exec mv {} ${record.tool_pubdir}/summary.json \\; find ${record.output_id}/SPATIAL_RNA_COUNTER_CS/ -type f -name "alignment_metrics.json" -exec mv {} ${record.tool_pubdir}/spatial/alignment_summary.json \\; + + # new 2024-01-02 + # spaceranger containers wont have gprreader on PATH so build its path manually + sr_root=$(which spaceranger | xargs dirname) + gprreader="${sr_root}/lib/bin/gprreader + $gprreader fetch ${record.slide} "${spatial_dir}" --area=${record.area} + + # the above unfortunately doesn't get the raw GPR file, but just a JSON representation + # below is to pull the raw GPR + + url_base="http://s3-us-west-2.amazonaws.com/10x.spatial-slides/gpr" + curl -L -o "${spatial_dir}/${record.slide}.gpr" "${url_base}/${serial_prefix}/${serial}.gpr" """ } @@ -104,6 +118,9 @@ process IMAGE_PROCESS { if [ -f "${record.manual_alignment}" ]; then cp ${record.manual_alignment} . fi + if [ -f "${record.raw_image}" ]; then + cp ${record.raw_image} . + fi md5sum * > hashes_img.md5 """ } From d7998c7cf87f12672db337021d12f937508eaa86 Mon Sep 17 00:00:00 2001 From: Bill Flynn Date: Tue, 2 Jan 2024 14:10:34 -0500 Subject: [PATCH 2/3] added 'raw-image' to visium samplesheets --- bin/check_samplesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check_samplesheet.py b/bin/check_samplesheet.py index ef0eda9..410c20b 100755 --- a/bin/check_samplesheet.py +++ b/bin/check_samplesheet.py @@ -410,7 +410,7 @@ def __init__(self): for key in ( "slide", "area", "cyta_image", "dark_image", "color_image", "manual_alignment", - "slide_file", "requires_rotation", "roi_json" + "slide_file", "requires_rotation", "roi_json", "raw_image" ): self.allowed_fields.add(key) From 04eacde9efa5bfd3c9542b2e7aaabcb7c7cc2d3f Mon Sep 17 00:00:00 2001 From: Bill Flynn Date: Tue, 2 Jan 2024 17:25:53 -0500 Subject: [PATCH 3/3] bugfix several issues introduced with gpr-downloading code --- modules/spaceranger.nf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/spaceranger.nf b/modules/spaceranger.nf index ced6815..fecdd10 100644 --- a/modules/spaceranger.nf +++ b/modules/spaceranger.nf @@ -71,15 +71,15 @@ process SPACERANGER_COUNT { # new 2024-01-02 # spaceranger containers wont have gprreader on PATH so build its path manually - sr_root=$(which spaceranger | xargs dirname) - gprreader="${sr_root}/lib/bin/gprreader - $gprreader fetch ${record.slide} "${spatial_dir}" --area=${record.area} + sr_root=\$(which spaceranger | xargs dirname) + gprreader="\${sr_root}/lib/bin/gprreader" + \$gprreader fetch ${record.slide} ${spatial_dir} --area=${record.area} # the above unfortunately doesn't get the raw GPR file, but just a JSON representation # below is to pull the raw GPR url_base="http://s3-us-west-2.amazonaws.com/10x.spatial-slides/gpr" - curl -L -o "${spatial_dir}/${record.slide}.gpr" "${url_base}/${serial_prefix}/${serial}.gpr" + wget -O "${spatial_dir}/${record.slide}.gpr" "\${url_base}/${serial_prefix}/${record.slide}.gpr" """ }