Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public List<String> getBaseArgs(@Nullable String toolName)
args.add(SequencePipelineService.get().getJavaFilepath());
args.addAll(SequencePipelineService.get().getJavaOpts(_maxRamOverride));
args.add("-DGATK_STACKTRACE_ON_USER_EXCEPTION=true");
args.add("-Dsamjdk.optimistic_vcf_4_4=true");
args.add("-jar");
args.add(getJAR().getPath());

Expand Down
2 changes: 1 addition & 1 deletion SequenceAnalysis/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ dependencies {
BuildUtils.addExternalDependency(
project,
new ExternalDependency(
"com.github.broadinstitute:picard:3.1.0",
"com.github.broadinstitute:picard:3.4.0",
"Picard Tools Lib",
"PicardTools",
"https://github.com/broadinstitute/picard",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import org.junit.Assert;
import org.junit.Test;
import org.labkey.api.module.Module;
import org.labkey.api.module.ModuleLoader;
import org.labkey.api.pipeline.PipelineJobService;
import org.labkey.api.resource.FileResource;
import org.labkey.api.resource.DirectoryResource;
import org.labkey.api.resource.FileResource;
import org.labkey.api.resource.Resource;
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
import org.labkey.api.settings.AppProps;
Expand All @@ -46,6 +46,7 @@
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -366,7 +367,7 @@ private List<String> getBaseParams() throws FileNotFoundException
throw new RuntimeException("Not found: " + jbzip2.getPath());
}

File htsjdkJar = new File(libDir, "htsjdk-4.0.0.jar");
File htsjdkJar = findJar(libDir, "htsjdk-");
if (!htsjdkJar.exists())
{
throw new RuntimeException("Not found: " + htsjdkJar.getPath());
Expand Down Expand Up @@ -401,6 +402,27 @@ private List<String> getBaseParams() throws FileNotFoundException
return params;
}

private File findJar(final File libDir, final String prefix)
{
if (!libDir.exists())
{
throw new RuntimeException("Missing directory: " + libDir);
}

List<String> jarNames = Arrays.stream(libDir.list()).filter(fn -> fn.startsWith(prefix)).sorted().toList();
if (jarNames.isEmpty())
{
throw new RuntimeException("Unable to find JAR with prefix: " + prefix);
}

if (jarNames.size() > 1)
{
_logger.info("More than one JAR found with prefix: " + prefix);
}

return new File(libDir, jarNames.get(jarNames.size() - 1));
}

private int getThreads()
{
return _threads;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ public Output processVariants(File inputVCF, File outputDirectory, ReferenceGeno
plinkArgs.add("--max-alleles");
plinkArgs.add("2");

// NOTE: tools like sawfish can report half-called genotypes, like 0/.. For now, be most conservative in PCA:
plinkArgs.add("--vcf-half-call");
plinkArgs.add("missing");

Integer threads = SequencePipelineService.get().getMaxThreads(getPipelineCtx().getLogger());
if (threads != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ private void runBatch(File inputVCF, File outputDirectory, VariantProcessingStep
args.add(String.valueOf(maxRam));
}

// NOTE: tools like sawfish can report half-called genotypes, like 0/.. For now, be most conservative in PCA:
args.add("--vcf-half-call");
args.add("missing");

args.addAll(getClientCommandArgs());

getWrapper().execute(args);
Expand Down
20 changes: 20 additions & 0 deletions singlecell/resources/chunks/ApplyKnownClontypicData.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
netRc <- paste0(Sys.getenv('USER_HOME'), '/.netrc')
if (!file.exists(netRc)) {
print(list.files(Sys.getenv('USER_HOME')))
stop(paste0('Unable to find file: ', netRc))
}

invisible(Rlabkey::labkey.setCurlOptions(NETRC_FILE = netRc, connect-timeout = 10))
Rdiscvr::SetLabKeyDefaults(baseUrl = serverBaseUrl, defaultFolder = defaultLabKeyFolder)

for (datasetId in names(seuratObjects)) {
printName(datasetId)
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])

seuratObj <- ApplyKnownClontypicData(seuratObj, groupFields = groupFields, addMetadata = addMetadata)
saveData(seuratObj, datasetId)

# Cleanup
rm(seuratObj)
gc()
}
2 changes: 2 additions & 0 deletions singlecell/src/org/labkey/singlecell/SingleCellModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.labkey.singlecell.pipeline.singlecell.AppendNimble;
import org.labkey.singlecell.pipeline.singlecell.AppendSaturation;
import org.labkey.singlecell.pipeline.singlecell.AppendTcr;
import org.labkey.singlecell.pipeline.singlecell.ApplyKnownClonotypicData;
import org.labkey.singlecell.pipeline.singlecell.AvgExpression;
import org.labkey.singlecell.pipeline.singlecell.CalculateGeneComponentScores;
import org.labkey.singlecell.pipeline.singlecell.CalculateUCellScores;
Expand Down Expand Up @@ -299,6 +300,7 @@ public static void registerPipelineSteps()
SequencePipelineService.get().registerPipelineStep(new PerformDefaultNimbleAppend.Provider());
SequencePipelineService.get().registerPipelineStep(new PerformMhcDimRedux.Provider());
SequencePipelineService.get().registerPipelineStep(new RunTricycle.Provider());
SequencePipelineService.get().registerPipelineStep(new ApplyKnownClonotypicData.Provider());

SequenceAnalysisService.get().registerReadsetListener(new SingleCellReadsetListener());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.labkey.singlecell.pipeline.singlecell;

import org.labkey.api.sequenceanalysis.pipeline.AbstractPipelineStepProvider;
import org.labkey.api.sequenceanalysis.pipeline.PipelineContext;
import org.labkey.api.singlecell.pipeline.SingleCellStep;

import java.util.List;

public class ApplyKnownClonotypicData extends AbstractRDiscvrStep
{
public ApplyKnownClonotypicData(PipelineContext ctx, ApplyKnownClonotypicData.Provider provider)
{
super(provider, ctx);
}

public static class Provider extends AbstractPipelineStepProvider<SingleCellStep>
{
public Provider()
{
super("ApplyKnownClonotypicData", "Append Known Clonotype/Antigen Data", "RDiscvr", "This will query the clone_responses table and append a column tagging each cell for matching antigens (based on clonotype)", List.of(

), null, null);
}


@Override
public ApplyKnownClonotypicData create(PipelineContext ctx)
{
return new ApplyKnownClonotypicData(ctx, this);
}
}

@Override
public String getFileSuffix()
{
return "ctd";
}
}