From f10c26da4c132205b9f2ec10088761a9ce9ae380 Mon Sep 17 00:00:00 2001 From: bbimber Date: Fri, 11 Oct 2024 15:51:55 -0700 Subject: [PATCH 1/9] Update Conga default --- .../web/SequenceAnalysis/panel/AnalysisSectionPanel.js | 2 +- .../src/org/labkey/singlecell/pipeline/singlecell/RunConga.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SequenceAnalysis/resources/web/SequenceAnalysis/panel/AnalysisSectionPanel.js b/SequenceAnalysis/resources/web/SequenceAnalysis/panel/AnalysisSectionPanel.js index 117296416..0b125221c 100644 --- a/SequenceAnalysis/resources/web/SequenceAnalysis/panel/AnalysisSectionPanel.js +++ b/SequenceAnalysis/resources/web/SequenceAnalysis/panel/AnalysisSectionPanel.js @@ -214,7 +214,7 @@ Ext4.define('SequenceAnalysis.panel.AnalysisSectionPanel', { }], listeners: { show: function(win){ - if (win.getHeight() > Ext4.getBody().getHeight()) { + if (win.getHeight() > window.visualViewport.height) { win.alignTo(Ext4.getBody(), 't-t?'); } } diff --git a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/RunConga.java b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/RunConga.java index ca1711558..e6a2a4622 100644 --- a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/RunConga.java +++ b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/RunConga.java @@ -37,7 +37,7 @@ public Provider() }}, "conga"), SeuratToolParameter.create("fieldToIterate", "Field to Iterate", "If provided, in addition to running CoNGA for the entire dataset, it will iterate the values of this field, subset the data by this value, and run CoNGA on that subset. The resulting metadata will be saved with the field name pattern: {congaMetadataPrefix}{FieldValue}", "textfield", new JSONObject(){{ - }}, "SubjectId", "fieldToIterate", true), + }}, null, "fieldToIterate", true), SeuratToolParameter.create("assayName", "Assay Name", "The name of the assay holding the GEX data", "textfield", new JSONObject(){{ }}, "RNA"), From 3999b68d22181018c3ffdc61dfa7a3da179fdae4 Mon Sep 17 00:00:00 2001 From: bbimber Date: Wed, 16 Oct 2024 06:44:24 -0700 Subject: [PATCH 2/9] Gzip metadata for seurat objects --- singlecell/resources/chunks/Functions.R | 2 +- .../singlecell/CellHashingServiceImpl.java | 2 +- .../singlecell/UpdateSeuratPrototype.java | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/singlecell/resources/chunks/Functions.R b/singlecell/resources/chunks/Functions.R index 622e88e48..71b18e449 100644 --- a/singlecell/resources/chunks/Functions.R +++ b/singlecell/resources/chunks/Functions.R @@ -81,7 +81,7 @@ saveData <- function(seuratObj, datasetId) { logger::log_info(paste0('Saving RDS file: ', fn, ' with ', ncol(seuratObj), ' cells')) barcodeFile <- paste0(outputPrefix, '.', datasetIdForFile, '.cellBarcodes.csv') - metaFile <- paste0(outputPrefix, '.', datasetIdForFile, '.seurat.meta.txt') + metaFile <- paste0(outputPrefix, '.', datasetIdForFile, '.seurat.meta.txt.gz') saveRDS(seuratObj, file = fn) diff --git a/singlecell/src/org/labkey/singlecell/CellHashingServiceImpl.java b/singlecell/src/org/labkey/singlecell/CellHashingServiceImpl.java index 85355473f..2675311c2 100644 --- a/singlecell/src/org/labkey/singlecell/CellHashingServiceImpl.java +++ b/singlecell/src/org/labkey/singlecell/CellHashingServiceImpl.java @@ -1573,7 +1573,7 @@ public File getMetaTableFromSeurat(File seuratObj) public File getMetaTableFromSeurat(File seuratObj, boolean throwIfNotFound) { - File barcodes = new File(seuratObj.getParentFile(), seuratObj.getName().replaceAll("seurat.rds$", "seurat.meta.txt")); + File barcodes = new File(seuratObj.getParentFile(), seuratObj.getName().replaceAll("seurat.rds$", "seurat.meta.txt.gz")); if (throwIfNotFound && !barcodes.exists()) { throw new IllegalArgumentException("Unable to find expected metadata file. This might indicate the seurat object was created with an older version of the pipeline. Expected: " + barcodes.getPath()); diff --git a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/UpdateSeuratPrototype.java b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/UpdateSeuratPrototype.java index d44f48a40..690891471 100644 --- a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/UpdateSeuratPrototype.java +++ b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/UpdateSeuratPrototype.java @@ -15,6 +15,7 @@ import org.labkey.api.sequenceanalysis.pipeline.SequenceOutputHandler; import org.labkey.api.singlecell.pipeline.SeuratToolParameter; import org.labkey.api.singlecell.pipeline.SingleCellStep; +import org.labkey.singlecell.CellHashingServiceImpl; import org.labkey.singlecell.SingleCellSchema; import java.io.File; @@ -140,6 +141,24 @@ public Output execute(SequenceOutputHandler.JobContext ctx, List Date: Thu, 17 Oct 2024 11:59:59 -0700 Subject: [PATCH 3/9] Add BcftoolsSetGtStep --- .../SequenceAnalysisModule.java | 1 + .../run/analysis/BcftoolsSetGtStep.java | 116 ++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsSetGtStep.java diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java index ac5215794..4847380b9 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java @@ -302,6 +302,7 @@ public static void registerPipelineSteps() SequencePipelineService.get().registerPipelineStep(new MendelianViolationReportStep.Provider()); SequencePipelineService.get().registerPipelineStep(new SummarizeGenotypeQualityStep.Provider()); SequencePipelineService.get().registerPipelineStep(new BcftoolsFillTagsStep.Provider()); + SequencePipelineService.get().registerPipelineStep(new BcftoolsSetGtStep.Provider()); SequencePipelineService.get().registerPipelineStep(new SVAnnotateStep.Provider()); //handlers diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsSetGtStep.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsSetGtStep.java new file mode 100644 index 000000000..5155ddf74 --- /dev/null +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsSetGtStep.java @@ -0,0 +1,116 @@ +package org.labkey.sequenceanalysis.run.analysis; + +import htsjdk.samtools.util.Interval; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.Nullable; +import org.labkey.api.pipeline.PipelineJobException; +import org.labkey.api.sequenceanalysis.SequenceAnalysisService; +import org.labkey.api.sequenceanalysis.pipeline.AbstractVariantProcessingStepProvider; +import org.labkey.api.sequenceanalysis.pipeline.BcftoolsRunner; +import org.labkey.api.sequenceanalysis.pipeline.PipelineContext; +import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider; +import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome; +import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService; +import org.labkey.api.sequenceanalysis.pipeline.VariantProcessingStep; +import org.labkey.api.sequenceanalysis.pipeline.VariantProcessingStepOutputImpl; +import org.labkey.api.sequenceanalysis.run.AbstractCommandPipelineStep; +import org.labkey.sequenceanalysis.pipeline.SequenceTaskHelper; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +public class BcftoolsSetGtStep extends AbstractCommandPipelineStep implements VariantProcessingStep +{ + public BcftoolsSetGtStep(PipelineStepProvider provider, PipelineContext ctx) + { + super(provider, ctx, new BcftoolsRunner(ctx.getLogger())); + } + + public static class Provider extends AbstractVariantProcessingStepProvider implements SupportsScatterGather + { + public Provider() + { + super("BcftoolsSetGtStep", "Bcftools Set GT", "bcftools", "Can be used to convert single dot ('.') genotypes to './.' for compatibility with more tools.", Arrays.asList( + + ), null, null); + } + + @Override + public BcftoolsSetGtStep create(PipelineContext ctx) + { + return new BcftoolsSetGtStep(this, ctx); + } + } + + @Override + public Output processVariants(File inputVCF, File outputDirectory, ReferenceGenome genome, @Nullable List intervals) throws PipelineJobException + { + VariantProcessingStepOutputImpl output = new VariantProcessingStepOutputImpl(); + + List options = new ArrayList<>(); + options.add(BcftoolsRunner.getBcfToolsPath().getPath()); + options.add("+setGT"); + + options.add(inputVCF.getPath()); + + if (intervals != null) + { + options.add("--regions"); + options.add(intervals.stream().map(interval -> interval.getContig() + ":" + interval.getStart() + "-" + interval.getEnd()).collect(Collectors.joining(","))); + } + + options.add("-O"); + options.add("z9"); + + Integer threads = SequencePipelineService.get().getMaxThreads(getPipelineCtx().getLogger()); + if (threads != null) + { + options.add("--threads"); + options.add(threads.toString()); + } + + File outputVcf = new File(outputDirectory, SequenceTaskHelper.getUnzippedBaseName(inputVCF) + ".ft.vcf.gz"); + options.add("-o"); + options.add(outputVcf.getPath()); + + options.add("--"); + + options.add("-t"); + options.add("."); + + options.add("-n"); + options.add("./."); + + BcftoolsRunner wrapper = getWrapper(); + + String bcfPluginDir = StringUtils.trimToNull(System.getenv("BCFTOOLS_PLUGINS")); + if (bcfPluginDir != null) + { + getPipelineCtx().getLogger().debug("Setting BCFTOOLS_PLUGINS environment variable: " + bcfPluginDir); + wrapper.addToEnvironment("BCFTOOLS_PLUGINS", bcfPluginDir); + } + + wrapper.execute(options); + if (!outputVcf.exists()) + { + throw new PipelineJobException("output not found: " + outputVcf); + } + + try + { + SequenceAnalysisService.get().ensureVcfIndex(outputVcf, getWrapper().getLogger()); + } + catch (IOException e) + { + throw new PipelineJobException(e); + } + + output.setVcf(outputVcf); + + return output; + } +} From 18431eab35d109f4ab0eb148e12a36cfa2414ff5 Mon Sep 17 00:00:00 2001 From: bbimber Date: Thu, 17 Oct 2024 13:29:20 -0700 Subject: [PATCH 4/9] Support single-dot genotype --- .../ExtendedVariantWidget/ExtendedVariantWidget.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantWidget/ExtendedVariantWidget.tsx b/jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantWidget/ExtendedVariantWidget.tsx index 594bce952..1fe878691 100644 --- a/jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantWidget/ExtendedVariantWidget.tsx +++ b/jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantWidget/ExtendedVariantWidget.tsx @@ -208,7 +208,7 @@ export default jbrowse => { const gt = samples[sample]["GT"] for (let genotype of gt){ const nc = "No Call" - if (genotype === "./." || genotype === ".|."){ + if (genotype === "./." || genotype === ".|." || genotype === '.'){ gtCounts[nc] = gtCounts[nc] ? gtCounts[nc] + 1 : 1 gtTotal = gtTotal + 1 } From 873be95f3ad9917fa99254d1ca365b2b4dbdc2a1 Mon Sep 17 00:00:00 2001 From: bbimber Date: Thu, 17 Oct 2024 17:00:48 -0700 Subject: [PATCH 5/9] Add bcftools fixploidy --- .../SequenceAnalysisModule.java | 2 +- ...GtStep.java => BcftoolsFixploidyStep.java} | 20 +++++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) rename SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/{BcftoolsSetGtStep.java => BcftoolsFixploidyStep.java} (83%) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java index 4847380b9..9b4cfb4c5 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java @@ -302,7 +302,7 @@ public static void registerPipelineSteps() SequencePipelineService.get().registerPipelineStep(new MendelianViolationReportStep.Provider()); SequencePipelineService.get().registerPipelineStep(new SummarizeGenotypeQualityStep.Provider()); SequencePipelineService.get().registerPipelineStep(new BcftoolsFillTagsStep.Provider()); - SequencePipelineService.get().registerPipelineStep(new BcftoolsSetGtStep.Provider()); + SequencePipelineService.get().registerPipelineStep(new BcftoolsFixploidyStep.Provider()); SequencePipelineService.get().registerPipelineStep(new SVAnnotateStep.Provider()); //handlers diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsSetGtStep.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsFixploidyStep.java similarity index 83% rename from SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsSetGtStep.java rename to SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsFixploidyStep.java index 5155ddf74..f5c7cf153 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsSetGtStep.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/BcftoolsFixploidyStep.java @@ -23,26 +23,26 @@ import java.util.List; import java.util.stream.Collectors; -public class BcftoolsSetGtStep extends AbstractCommandPipelineStep implements VariantProcessingStep +public class BcftoolsFixploidyStep extends AbstractCommandPipelineStep implements VariantProcessingStep { - public BcftoolsSetGtStep(PipelineStepProvider provider, PipelineContext ctx) + public BcftoolsFixploidyStep(PipelineStepProvider provider, PipelineContext ctx) { super(provider, ctx, new BcftoolsRunner(ctx.getLogger())); } - public static class Provider extends AbstractVariantProcessingStepProvider implements SupportsScatterGather + public static class Provider extends AbstractVariantProcessingStepProvider implements SupportsScatterGather { public Provider() { - super("BcftoolsSetGtStep", "Bcftools Set GT", "bcftools", "Can be used to convert single dot ('.') genotypes to './.' for compatibility with more tools.", Arrays.asList( + super("BcftoolsFixploidyStep", "Bcftools Fixploidy", "bcftools", "Can be used to convert single dot ('.') genotypes to './.' for compatibility with some tools.", Arrays.asList( ), null, null); } @Override - public BcftoolsSetGtStep create(PipelineContext ctx) + public BcftoolsFixploidyStep create(PipelineContext ctx) { - return new BcftoolsSetGtStep(this, ctx); + return new BcftoolsFixploidyStep(this, ctx); } } @@ -53,7 +53,7 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno List options = new ArrayList<>(); options.add(BcftoolsRunner.getBcfToolsPath().getPath()); - options.add("+setGT"); + options.add("+fixploidy"); options.add(inputVCF.getPath()); @@ -79,12 +79,6 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno options.add("--"); - options.add("-t"); - options.add("."); - - options.add("-n"); - options.add("./."); - BcftoolsRunner wrapper = getWrapper(); String bcfPluginDir = StringUtils.trimToNull(System.getenv("BCFTOOLS_PLUGINS")); From f6f3db0c26b78bb4b617612573570f39c0db2ac3 Mon Sep 17 00:00:00 2001 From: bbimber Date: Fri, 25 Oct 2024 20:36:37 -0700 Subject: [PATCH 6/9] Switch default for cellranger include-introns --- .../org/labkey/singlecell/run/CellRangerGexCountStep.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java b/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java index 9b73487cf..cee15de83 100644 --- a/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java +++ b/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java @@ -124,10 +124,10 @@ public static List getCellRangerGexParams(@Nullable Lis ToolParameterDescriptor.createCommandLineParam(CommandLineParam.create("--chemistry"), "chemistry", "Chemistry", "This is usually left blank, in which case cellranger will auto-detect. Example values are: SC3Pv1, SC3Pv2, SC3Pv3, SC5P-PE, SC5P-R2, or SC5P-R1", "textfield", new JSONObject(){{ }}, null), - ToolParameterDescriptor.createCommandLineParam(CommandLineParam.createSwitch("--include-introns"), "includeIntrons", "Include Introns", "If selected, reads from introns will be included in the counts", "ldk-simplecombo", new JSONObject(){{ + ToolParameterDescriptor.createCommandLineParam(CommandLineParam.create("--include-introns"), "includeIntrons", "Include Introns", "If selected, reads from introns will be included in the counts", "ldk-simplecombo", new JSONObject(){{ put("storeValues", "true;false"); - put("value", "false"); - }}, null) + put("value", "true"); + }}, "true") ); if (additionalParams != null) From 9c0b1971bded701fdd8cc3d793db0c11afd8fdcd Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 28 Oct 2024 10:15:25 -0700 Subject: [PATCH 7/9] Improve resume behavior for VCF merge step --- .../sequenceanalysis/util/SequenceUtil.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java index a35d003b6..0fbd9a075 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java @@ -1,5 +1,6 @@ package org.labkey.sequenceanalysis.util; +import com.google.common.io.Files; import htsjdk.samtools.SAMFileHeader; import htsjdk.samtools.SAMFormatException; import htsjdk.samtools.SAMReadGroupRecord; @@ -514,13 +515,23 @@ else if (!samples.equals(header.getGenotypeSamples())) writer.write("} | bgzip -f" + (compressionLevel == null ? "" : " --compress-level 9") + (threads == null ? "" : " --threads " + threads) + " > '" + outputGzip.getPath() + "'\n"); } - SimpleScriptWrapper wrapper = new SimpleScriptWrapper(log); - wrapper.execute(Arrays.asList("/bin/bash", bashTmp.getPath())); - - if (sortAfterMerge) + File mergeDone = new File(outputGzip.getParentFile(), "merge.done"); + if (mergeDone.exists()) { - log.debug("sorting VCF"); - sortROD(outputGzip, log, 2); + log.debug("Merge done file exists, will not repeat merge"); + } + else + { + SimpleScriptWrapper wrapper = new SimpleScriptWrapper(log); + wrapper.execute(Arrays.asList("/bin/bash", bashTmp.getPath())); + + if (sortAfterMerge) + { + log.debug("sorting VCF"); + sortROD(outputGzip, log, 2); + } + + Files.touch(mergeDone); } SequenceAnalysisService.get().ensureVcfIndex(outputGzip, log); @@ -539,6 +550,8 @@ else if (!samples.equals(header.getGenotypeSamples())) { headerIdx.delete(); } + + mergeDone.delete(); } catch (IOException e) { From 2e356d12090281e36b2dab617950837a8135f2a4 Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 28 Oct 2024 14:11:34 -0700 Subject: [PATCH 8/9] Update seurat defaults --- .../singlecell/pipeline/singlecell/FilterRawCounts.java | 6 +++--- .../singlecell/pipeline/singlecell/PrepareRawCounts.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/FilterRawCounts.java b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/FilterRawCounts.java index e125709b4..7a42c13c1 100644 --- a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/FilterRawCounts.java +++ b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/FilterRawCounts.java @@ -25,13 +25,13 @@ public Provider() }}, 0, "nCount_RNA.low", false), SeuratToolParameter.create("nCountRnaHigh", "Max UMI Count", "Cells with UMI counts above this value will be discarded", "ldk-integerfield", new JSONObject(){{ put("minValue", 0); - }}, 20000, "nCount_RNA.high", false), + }}, 30000, "nCount_RNA.high", false), SeuratToolParameter.create("nCountFeatureLow", "Min Feature Count", "Cells with unique feature totals below this value will be discarded", "ldk-integerfield", new JSONObject(){{ put("minValue", 0); - }}, 200, "nFeature.low", false), + }}, 150, "nFeature.low", false), SeuratToolParameter.create("nCountFeatureHigh", "Max Feature Count", "Cells with unique feature totals above this value will be discarded", "ldk-integerfield", new JSONObject(){{ put("minValue", 0); - }}, 5000, "nFeature.high", false), + }}, 7500, "nFeature.high", false), SeuratToolParameter.create("pMitoLow", "Min Percent Mito", "Cells percent mitochondrial genes below this value will be discarded", "ldk-numberfield", new JSONObject(){{ put("minValue", 0); put("maxValue", 1); diff --git a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/PrepareRawCounts.java b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/PrepareRawCounts.java index 874eecf00..f317fd90e 100644 --- a/singlecell/src/org/labkey/singlecell/pipeline/singlecell/PrepareRawCounts.java +++ b/singlecell/src/org/labkey/singlecell/pipeline/singlecell/PrepareRawCounts.java @@ -39,10 +39,10 @@ public Provider() }}, 0.001), SeuratToolParameter.create("maxAllowableCells", "Max Cells Allowed", "If more than this many cells are predicted by EmptyDrops, the job will fail", "ldk-integerfield", new JSONObject(){{ put("minValue", 0); - }}, 20000), + }}, 35000), SeuratToolParameter.create("minAllowableCells", "Min Cells Allowed", "If fewer than this many cells are predicted by EmptyDrops, the job will fail", "ldk-integerfield", new JSONObject(){{ put("minValue", 0); - }}, 1500), + }}, 500), SeuratToolParameter.create("useEmptyDropsCellRanger", "Use emptyDropsCellRanger", "If checked, this will run emptyDropsCellRanger instead of emptyDrops", "checkbox", null, false), SeuratToolParameter.create("nExpectedCells", "# Expected Cells", "Only applied if emptyDropsCellRanger is selected. Passed to n.expected.cells argument", "ldk-integerfield", new JSONObject(){{ put("minValue", 0); From ea38f6b75e6defb1e4c3ff648f30189d47ede6c4 Mon Sep 17 00:00:00 2001 From: bbimber Date: Mon, 28 Oct 2024 17:29:50 -0700 Subject: [PATCH 9/9] Ensure CellRanger retains BAM when analyses are selected --- .../sequenceanalysis/pipeline/SequenceAlignmentTask.java | 2 +- .../sequenceanalysis/pipeline/SequenceAnalysisTask.java | 8 ++++---- jbrowse/src/client/JBrowse/utils.ts | 2 +- .../org/labkey/singlecell/run/CellRangerGexCountStep.java | 7 +++++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java b/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java index 8a460ce6f..b254cb86d 100644 --- a/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java +++ b/SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java @@ -707,7 +707,7 @@ private void alignSet(Readset rs, String basename, Map getProtocolActionNames() } @Override - public PipelineJob.Task createTask(PipelineJob job) + public PipelineJob.Task createTask(PipelineJob job) { SequenceAnalysisTask task = new SequenceAnalysisTask(this, job); setJoin(true); @@ -202,7 +202,7 @@ public RecordedActionSet run() throws PipelineJobException //find BAM List datas = run.getInputDatas(SequenceAlignmentTask.FINAL_BAM_ROLE, ExpProtocol.ApplicationType.ExperimentRunOutput); - if (datas.size() > 0) + if (!datas.isEmpty()) { boolean found = false; for (ExpData d : datas) @@ -261,7 +261,7 @@ else if (!d.getFile().exists()) else { List fastaDatas = run.getInputDatas(IndexOutputImpl.REFERENCE_DB_FASTA, null); - if (fastaDatas.size() > 0) + if (!fastaDatas.isEmpty()) { for (ExpData d : fastaDatas) { @@ -289,7 +289,7 @@ else if (d.getFile().exists()) //input FASTQs datas = run.getInputDatas(SequenceTaskHelper.FASTQ_DATA_INPUT_NAME, ExpProtocol.ApplicationType.ProtocolApplication); - if (datas.size() > 0) + if (!datas.isEmpty()) { for (ExpData d : datas) { diff --git a/jbrowse/src/client/JBrowse/utils.ts b/jbrowse/src/client/JBrowse/utils.ts index de51e775e..e69b0b3e7 100644 --- a/jbrowse/src/client/JBrowse/utils.ts +++ b/jbrowse/src/client/JBrowse/utils.ts @@ -80,7 +80,7 @@ export function passesSampleFilters(feature, sampleIDs){ } export function isVariant(gt) { - return !(gt === "./." || gt === ".|." || gt === "0/0" || gt === "0|0") + return !(gt === "./." || gt === ".|." || gt === '.' || gt === "0/0" || gt === "0|0") } diff --git a/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java b/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java index cee15de83..62ea31c90 100644 --- a/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java +++ b/singlecell/src/org/labkey/singlecell/run/CellRangerGexCountStep.java @@ -31,6 +31,7 @@ import org.labkey.api.sequenceanalysis.pipeline.AlignmentOutputImpl; import org.labkey.api.sequenceanalysis.pipeline.AlignmentStep; import org.labkey.api.sequenceanalysis.pipeline.AlignmentStepProvider; +import org.labkey.api.sequenceanalysis.pipeline.AnalysisStep; import org.labkey.api.sequenceanalysis.pipeline.CommandLineParam; import org.labkey.api.sequenceanalysis.pipeline.IndexOutputImpl; import org.labkey.api.sequenceanalysis.pipeline.PipelineContext; @@ -321,6 +322,12 @@ public boolean canAlignMultiplePairsAtOnce() private boolean shouldDiscardBam() { + // NOTE: if downstream analyses are selected, always keep BAM + if (!SequencePipelineService.get().getSteps(getPipelineCtx().getJob(), AnalysisStep.class).isEmpty()) + { + return false; + } + return !_alwaysRetainBam && getProvider().getParameterByName(AbstractAlignmentStepProvider.DISCARD_BAM).extractValue(getPipelineCtx().getJob(), getProvider(), getStepIdx(), Boolean.class, false); }