Skip to content

Commit 1140dec

Browse files
committed
Merge discvr-24.7 to develop
2 parents 20a9f93 + ea38f6b commit 1140dec

File tree

15 files changed

+175
-25
lines changed

15 files changed

+175
-25
lines changed

SequenceAnalysis/resources/web/SequenceAnalysis/panel/AnalysisSectionPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Ext4.define('SequenceAnalysis.panel.AnalysisSectionPanel', {
214214
}],
215215
listeners: {
216216
show: function(win){
217-
if (win.getHeight() > Ext4.getBody().getHeight()) {
217+
if (win.getHeight() > window.visualViewport.height) {
218218
win.alignTo(Ext4.getBody(), 't-t?');
219219
}
220220
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ public static void registerPipelineSteps()
302302
SequencePipelineService.get().registerPipelineStep(new MendelianViolationReportStep.Provider());
303303
SequencePipelineService.get().registerPipelineStep(new SummarizeGenotypeQualityStep.Provider());
304304
SequencePipelineService.get().registerPipelineStep(new BcftoolsFillTagsStep.Provider());
305+
SequencePipelineService.get().registerPipelineStep(new BcftoolsFixploidyStep.Provider());
305306
SequencePipelineService.get().registerPipelineStep(new SVAnnotateStep.Provider());
306307

307308
//handlers

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAlignmentTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ private void alignSet(Readset rs, String basename, Map<ReadData, Pair<File, File
707707
{
708708
if (!SequencePipelineService.get().getSteps(getJob(), BamProcessingStep.class).isEmpty())
709709
{
710-
throw new PipelineJobException("No BAM was created, but post-procesing steps were selected!");
710+
throw new PipelineJobException("No BAM was created, but post-processing steps were selected!");
711711
}
712712

713713
if (!SequencePipelineService.get().getSteps(getJob(), AnalysisStep.class).isEmpty())

SequenceAnalysis/src/org/labkey/sequenceanalysis/pipeline/SequenceAnalysisTask.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public List<String> getProtocolActionNames()
107107
}
108108

109109
@Override
110-
public PipelineJob.Task createTask(PipelineJob job)
110+
public PipelineJob.Task<?> createTask(PipelineJob job)
111111
{
112112
SequenceAnalysisTask task = new SequenceAnalysisTask(this, job);
113113
setJoin(true);
@@ -202,7 +202,7 @@ public RecordedActionSet run() throws PipelineJobException
202202

203203
//find BAM
204204
List<? extends ExpData> datas = run.getInputDatas(SequenceAlignmentTask.FINAL_BAM_ROLE, ExpProtocol.ApplicationType.ExperimentRunOutput);
205-
if (datas.size() > 0)
205+
if (!datas.isEmpty())
206206
{
207207
boolean found = false;
208208
for (ExpData d : datas)
@@ -261,7 +261,7 @@ else if (!d.getFile().exists())
261261
else
262262
{
263263
List<? extends ExpData> fastaDatas = run.getInputDatas(IndexOutputImpl.REFERENCE_DB_FASTA, null);
264-
if (fastaDatas.size() > 0)
264+
if (!fastaDatas.isEmpty())
265265
{
266266
for (ExpData d : fastaDatas)
267267
{
@@ -289,7 +289,7 @@ else if (d.getFile().exists())
289289

290290
//input FASTQs
291291
datas = run.getInputDatas(SequenceTaskHelper.FASTQ_DATA_INPUT_NAME, ExpProtocol.ApplicationType.ProtocolApplication);
292-
if (datas.size() > 0)
292+
if (!datas.isEmpty())
293293
{
294294
for (ExpData d : datas)
295295
{
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package org.labkey.sequenceanalysis.run.analysis;
2+
3+
import htsjdk.samtools.util.Interval;
4+
import org.apache.commons.lang3.StringUtils;
5+
import org.jetbrains.annotations.Nullable;
6+
import org.labkey.api.pipeline.PipelineJobException;
7+
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
8+
import org.labkey.api.sequenceanalysis.pipeline.AbstractVariantProcessingStepProvider;
9+
import org.labkey.api.sequenceanalysis.pipeline.BcftoolsRunner;
10+
import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
11+
import org.labkey.api.sequenceanalysis.pipeline.PipelineStepProvider;
12+
import org.labkey.api.sequenceanalysis.pipeline.ReferenceGenome;
13+
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
14+
import org.labkey.api.sequenceanalysis.pipeline.VariantProcessingStep;
15+
import org.labkey.api.sequenceanalysis.pipeline.VariantProcessingStepOutputImpl;
16+
import org.labkey.api.sequenceanalysis.run.AbstractCommandPipelineStep;
17+
import org.labkey.sequenceanalysis.pipeline.SequenceTaskHelper;
18+
19+
import java.io.File;
20+
import java.io.IOException;
21+
import java.util.ArrayList;
22+
import java.util.Arrays;
23+
import java.util.List;
24+
import java.util.stream.Collectors;
25+
26+
public class BcftoolsFixploidyStep extends AbstractCommandPipelineStep<BcftoolsRunner> implements VariantProcessingStep
27+
{
28+
public BcftoolsFixploidyStep(PipelineStepProvider<?> provider, PipelineContext ctx)
29+
{
30+
super(provider, ctx, new BcftoolsRunner(ctx.getLogger()));
31+
}
32+
33+
public static class Provider extends AbstractVariantProcessingStepProvider<BcftoolsFixploidyStep> implements SupportsScatterGather
34+
{
35+
public Provider()
36+
{
37+
super("BcftoolsFixploidyStep", "Bcftools Fixploidy", "bcftools", "Can be used to convert single dot ('.') genotypes to './.' for compatibility with some tools.", Arrays.asList(
38+
39+
), null, null);
40+
}
41+
42+
@Override
43+
public BcftoolsFixploidyStep create(PipelineContext ctx)
44+
{
45+
return new BcftoolsFixploidyStep(this, ctx);
46+
}
47+
}
48+
49+
@Override
50+
public Output processVariants(File inputVCF, File outputDirectory, ReferenceGenome genome, @Nullable List<Interval> intervals) throws PipelineJobException
51+
{
52+
VariantProcessingStepOutputImpl output = new VariantProcessingStepOutputImpl();
53+
54+
List<String> options = new ArrayList<>();
55+
options.add(BcftoolsRunner.getBcfToolsPath().getPath());
56+
options.add("+fixploidy");
57+
58+
options.add(inputVCF.getPath());
59+
60+
if (intervals != null)
61+
{
62+
options.add("--regions");
63+
options.add(intervals.stream().map(interval -> interval.getContig() + ":" + interval.getStart() + "-" + interval.getEnd()).collect(Collectors.joining(",")));
64+
}
65+
66+
options.add("-O");
67+
options.add("z9");
68+
69+
Integer threads = SequencePipelineService.get().getMaxThreads(getPipelineCtx().getLogger());
70+
if (threads != null)
71+
{
72+
options.add("--threads");
73+
options.add(threads.toString());
74+
}
75+
76+
File outputVcf = new File(outputDirectory, SequenceTaskHelper.getUnzippedBaseName(inputVCF) + ".ft.vcf.gz");
77+
options.add("-o");
78+
options.add(outputVcf.getPath());
79+
80+
options.add("--");
81+
82+
BcftoolsRunner wrapper = getWrapper();
83+
84+
String bcfPluginDir = StringUtils.trimToNull(System.getenv("BCFTOOLS_PLUGINS"));
85+
if (bcfPluginDir != null)
86+
{
87+
getPipelineCtx().getLogger().debug("Setting BCFTOOLS_PLUGINS environment variable: " + bcfPluginDir);
88+
wrapper.addToEnvironment("BCFTOOLS_PLUGINS", bcfPluginDir);
89+
}
90+
91+
wrapper.execute(options);
92+
if (!outputVcf.exists())
93+
{
94+
throw new PipelineJobException("output not found: " + outputVcf);
95+
}
96+
97+
try
98+
{
99+
SequenceAnalysisService.get().ensureVcfIndex(outputVcf, getWrapper().getLogger());
100+
}
101+
catch (IOException e)
102+
{
103+
throw new PipelineJobException(e);
104+
}
105+
106+
output.setVcf(outputVcf);
107+
108+
return output;
109+
}
110+
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/util/SequenceUtil.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.labkey.sequenceanalysis.util;
22

3+
import com.google.common.io.Files;
34
import htsjdk.samtools.SAMFileHeader;
45
import htsjdk.samtools.SAMFormatException;
56
import htsjdk.samtools.SAMReadGroupRecord;
@@ -514,13 +515,23 @@ else if (!samples.equals(header.getGenotypeSamples()))
514515
writer.write("} | bgzip -f" + (compressionLevel == null ? "" : " --compress-level 9") + (threads == null ? "" : " --threads " + threads) + " > '" + outputGzip.getPath() + "'\n");
515516
}
516517

517-
SimpleScriptWrapper wrapper = new SimpleScriptWrapper(log);
518-
wrapper.execute(Arrays.asList("/bin/bash", bashTmp.getPath()));
519-
520-
if (sortAfterMerge)
518+
File mergeDone = new File(outputGzip.getParentFile(), "merge.done");
519+
if (mergeDone.exists())
521520
{
522-
log.debug("sorting VCF");
523-
sortROD(outputGzip, log, 2);
521+
log.debug("Merge done file exists, will not repeat merge");
522+
}
523+
else
524+
{
525+
SimpleScriptWrapper wrapper = new SimpleScriptWrapper(log);
526+
wrapper.execute(Arrays.asList("/bin/bash", bashTmp.getPath()));
527+
528+
if (sortAfterMerge)
529+
{
530+
log.debug("sorting VCF");
531+
sortROD(outputGzip, log, 2);
532+
}
533+
534+
Files.touch(mergeDone);
524535
}
525536

526537
SequenceAnalysisService.get().ensureVcfIndex(outputGzip, log);
@@ -539,6 +550,8 @@ else if (!samples.equals(header.getGenotypeSamples()))
539550
{
540551
headerIdx.delete();
541552
}
553+
554+
mergeDone.delete();
542555
}
543556
catch (IOException e)
544557
{

jbrowse/src/client/JBrowse/Browser/plugins/ExtendedVariantPlugin/ExtendedVariantWidget/ExtendedVariantWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export default jbrowse => {
208208
const gt = samples[sample]["GT"]
209209
for (let genotype of gt){
210210
const nc = "No Call"
211-
if (genotype === "./." || genotype === ".|."){
211+
if (genotype === "./." || genotype === ".|." || genotype === '.'){
212212
gtCounts[nc] = gtCounts[nc] ? gtCounts[nc] + 1 : 1
213213
gtTotal = gtTotal + 1
214214
}

jbrowse/src/client/JBrowse/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export function passesSampleFilters(feature, sampleIDs){
8080
}
8181

8282
export function isVariant(gt) {
83-
return !(gt === "./." || gt === ".|." || gt === "0/0" || gt === "0|0")
83+
return !(gt === "./." || gt === ".|." || gt === '.' || gt === "0/0" || gt === "0|0")
8484
}
8585

8686

singlecell/resources/chunks/Functions.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ saveData <- function(seuratObj, datasetId) {
8181

8282
logger::log_info(paste0('Saving RDS file: ', fn, ' with ', ncol(seuratObj), ' cells'))
8383
barcodeFile <- paste0(outputPrefix, '.', datasetIdForFile, '.cellBarcodes.csv')
84-
metaFile <- paste0(outputPrefix, '.', datasetIdForFile, '.seurat.meta.txt')
84+
metaFile <- paste0(outputPrefix, '.', datasetIdForFile, '.seurat.meta.txt.gz')
8585

8686
saveRDS(seuratObj, file = fn)
8787

singlecell/src/org/labkey/singlecell/CellHashingServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ public File getMetaTableFromSeurat(File seuratObj)
15731573

15741574
public File getMetaTableFromSeurat(File seuratObj, boolean throwIfNotFound)
15751575
{
1576-
File barcodes = new File(seuratObj.getParentFile(), seuratObj.getName().replaceAll("seurat.rds$", "seurat.meta.txt"));
1576+
File barcodes = new File(seuratObj.getParentFile(), seuratObj.getName().replaceAll("seurat.rds$", "seurat.meta.txt.gz"));
15771577
if (throwIfNotFound && !barcodes.exists())
15781578
{
15791579
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());

0 commit comments

Comments
 (0)