Skip to content

Commit 1d79f4e

Browse files
authored
Merge pull request #205 from LabKey/fb_merge_22.11_to_develop
Merge discvr-22.11 to develop
2 parents bdb5e4b + 5577336 commit 1d79f4e

File tree

18 files changed

+289
-34
lines changed

18 files changed

+289
-34
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,18 @@ private void verifySequenceDataPresent(Logger log)
138138
log.info("verifying sequence data files present");
139139
TableInfo ti = SequenceAnalysisSchema.getTable(SequenceAnalysisSchema.TABLE_READ_DATA);
140140
TableSelector ts = new TableSelector(ti);
141+
142+
log.info("Inspecting ReadData");
141143
List<ReadDataImpl> readDatas = ts.getArrayList(ReadDataImpl.class);
144+
int i = 0;
142145
for (ReadDataImpl rd : readDatas)
143146
{
147+
i++;
148+
if (i % 1000 == 0)
149+
{
150+
log.info("readdata " + i + " of " + readDatas.size() + ". Current container: " + ContainerManager.getForId(rd.getContainer()).getPath());
151+
}
152+
144153
if (rd.getFileId1() != null)
145154
{
146155
ExpData d = ExperimentService.get().getExpData(rd.getFileId1());
@@ -191,11 +200,19 @@ else if (!d.getFile().exists())
191200
}
192201

193202
//also check analyses
203+
log.info("Inspecting Analyses");
194204
TableInfo analysesTable = SequenceAnalysisSchema.getTable(SequenceAnalysisSchema.TABLE_ANALYSES);
195205
TableSelector tsAnalyses = new TableSelector(analysesTable);
196206
List<AnalysisModelImpl> analyses = tsAnalyses.getArrayList(AnalysisModelImpl.class);
207+
i = 0;
197208
for (AnalysisModelImpl m : analyses)
198209
{
210+
i++;
211+
if (i % 500 == 0)
212+
{
213+
log.info("analysis " + i + " of " + analyses.size() + ". Current container: " + ContainerManager.getForId(m.getContainer()).getPath());
214+
}
215+
199216
if (m.getAlignmentFile() != null)
200217
{
201218
ExpData d = m.getAlignmentData();

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/analysis/PbsvJointCallingHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
139139
outputBaseName = outputBaseName.replaceAll(".vcf$", "");
140140
}
141141

142-
if (getVariantPipelineJob(ctx.getJob()).isScatterJob())
142+
if (getVariantPipelineJob(ctx.getJob()) != null && getVariantPipelineJob(ctx.getJob()).isScatterJob())
143143
{
144144
outputBaseName = outputBaseName + "." + getVariantPipelineJob(ctx.getJob()).getIntervalSetName();
145145
}
@@ -149,7 +149,7 @@ public void processFilesRemote(List<SequenceOutputFile> inputFiles, JobContext c
149149
boolean jobCompleted = expectedFinalOutputIdx.exists(); // this would occur if the job died during the cleanup phase
150150

151151
List<File> outputs = new ArrayList<>();
152-
if (getVariantPipelineJob(ctx.getJob()).isScatterJob())
152+
if (getVariantPipelineJob(ctx.getJob()) != null && getVariantPipelineJob(ctx.getJob()).isScatterJob())
153153
{
154154
for (Interval i : getVariantPipelineJob(ctx.getJob()).getIntervalsForTask())
155155
{

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptCropWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,6 @@ public void cropReads(File inputFile1, @Nullable File inputFile2, File outputFil
161161

162162
public File getExe()
163163
{
164-
return SequencePipelineService.get().getExeForPackage("CUTADAPTPATH", "cutadapt.py");
164+
return SequencePipelineService.get().getExeForPackage("CUTADAPTPATH", "cutadapt");
165165
}
166166
}

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/preprocessing/CutadaptWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,6 @@ private void trimPE(Pair<File, File> inputs, Pair<File, File> outputs, List<Stri
311311

312312
public File getExe()
313313
{
314-
return SequencePipelineService.get().getExeForPackage("CUTADAPTPATH", "cutadapt.py");
314+
return resolveFileInPath("cutadapt", "CUTADAPTPATH", false);
315315
}
316316
}

cluster/src/org/labkey/cluster/pipeline/SlurmExecutionEngine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ private File createSubmitScript(PipelineJob job) throws PipelineJobException
435435
if (disallowedNodes != null)
436436
{
437437
job.getLogger().debug("Disallowed nodes: " + StringUtils.join(ClusterManager.get().getDisallowedNodes(), ","));
438-
writer.write("#SBATCH --exclude=" + StringUtils.join(ClusterManager.get().getDisallowedNodes(), ","));
438+
writer.write("#SBATCH --exclude=" + StringUtils.join(ClusterManager.get().getDisallowedNodes(), ",") + "\n");
439439
}
440440

441441
// This allows modules to register code to modify resource usage per task.

singlecell/api-src/org/labkey/api/singlecell/CellHashingService.java

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.io.IOException;
2525
import java.util.ArrayList;
2626
import java.util.Arrays;
27+
import java.util.Collection;
2728
import java.util.Collections;
2829
import java.util.HashSet;
2930
import java.util.List;
@@ -71,7 +72,7 @@ static public void setInstance(CellHashingService instance)
7172

7273
abstract public boolean usesCiteSeq(SequenceAnalysisJobSupport support, List<SequenceOutputFile> inputFiles) throws PipelineJobException;
7374

74-
abstract public List<ToolParameterDescriptor> getHashingCallingParams(boolean allowDemuxEm);
75+
abstract public List<ToolParameterDescriptor> getHashingCallingParams(boolean allowMethodsNeedingGex);
7576

7677
abstract public Set<String> getHtosForParentReadset(Integer parentReadsetId, File webserverJobDir, SequenceAnalysisJobSupport support, boolean throwIfNotFound) throws PipelineJobException;
7778

@@ -316,17 +317,25 @@ public enum CALLING_METHOD
316317
htodemux(false, false),
317318
dropletutils(true, true),
318319
gmm_demux(true, true),
319-
demuxem(true, true),
320+
demuxem(true, true, true),
321+
demuxmix(true, true, true),
320322
bff_cluster(true, true),
321323
bff_raw(true, false);
322324

323325
boolean isDefaultRun;
324326
boolean isDefaultConsensus;
327+
boolean requiresH5;
325328

326329
CALLING_METHOD(boolean isDefaultRun, boolean isDefaultConsensus)
330+
{
331+
this(isDefaultRun, isDefaultConsensus, false);
332+
}
333+
334+
CALLING_METHOD(boolean isDefaultRun, boolean isDefaultConsensus, boolean requiresH5)
327335
{
328336
this.isDefaultRun = isDefaultRun;
329337
this.isDefaultConsensus = isDefaultConsensus;
338+
this.requiresH5 = requiresH5;
330339
}
331340

332341
public boolean isDefaultRun()
@@ -339,6 +348,11 @@ public boolean isDefaultConsensus()
339348
return isDefaultConsensus;
340349
}
341350

351+
public boolean isRequiresH5()
352+
{
353+
return requiresH5;
354+
}
355+
342356
private static List<CALLING_METHOD> getDefaultRunMethods()
343357
{
344358
return Arrays.stream(values()).filter(CALLING_METHOD::isDefaultRun).collect(Collectors.toList());
@@ -358,6 +372,22 @@ public static List<String> getDefaultConsensusMethodNames()
358372
{
359373
return getDefaultConsensusMethods().stream().map(Enum::name).collect(Collectors.toList());
360374
}
375+
376+
public static boolean requiresH5(String methodNames)
377+
{
378+
methodNames = StringUtils.trimToNull(methodNames);
379+
if (methodNames == null)
380+
{
381+
return false;
382+
}
383+
384+
return requiresH5(Arrays.stream(methodNames.split(";")).map(CALLING_METHOD::valueOf).collect(Collectors.toList()));
385+
}
386+
387+
public static boolean requiresH5(Collection<CALLING_METHOD> methods)
388+
{
389+
return methods.stream().anyMatch(CALLING_METHOD::isRequiresH5);
390+
}
361391
}
362392

363393
public enum BARCODE_TYPE

singlecell/resources/chunks/DropAssays.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ for (datasetId in names(seuratObjects)) {
44

55
for (assayName in assayNames) {
66
if (assayName %in% names(seuratObj@assays)) {
7+
print(paste0('Dropping assay: ', assayName))
8+
updateAssay <- assayName == Seurat::DefaultAssay(seuratObj)
79
seuratObj@assays[[assayName]] <- NULL
10+
if (updateAssay) {
11+
print(paste0('Changing default assay to: ', names(seuratObj@assays)[1]))
12+
Seurat::DefaultAssay(seuratObj) <- names(seuratObj@assays)[1]
13+
}
814
} else {
915
print(paste0('Assay not found, skipping: ', assayName))
1016
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
if (Sys.getenv('SEURAT_MAX_THREADS') != '') {
2+
nCores <- Sys.getenv('SEURAT_MAX_THREADS')
3+
} else {
4+
nCores <- 1
5+
}
6+
7+
ldaFiles <- data.frame(DatasetId = character(), FileName = character())
8+
9+
for (datasetId in names(seuratObjects)) {
10+
printName(datasetId)
11+
seuratObj <- readRDS(seuratObjects[[datasetId]])
12+
13+
if (!is.null(maxAllowableCells) && maxAllowableCells > 0 && ncol(seuratObj) > maxAllowableCells) {
14+
stop(paste0('The object has ', ncol(seuratObj), ' which is above the maxAllowableCells: ', maxAllowableCells))
15+
}
16+
17+
ldaResults <- bindArgs(CellMembrane::DoLdaParameterScan, seuratObj)()
18+
19+
outputFileId <- ifelse(datasetId %in% names(datasetIdToOutputFileId), yes = datasetIdToOutputFileId[[datasetId]], no = NA)
20+
ldaResults$OutputFileId <- outputFileId
21+
22+
fileName <- paste0('lda.', datasetId, '.rds')
23+
saveRDS(ldaResults, file = fileName)
24+
25+
ldaFiles <- rbind(ldaFiles, data.frame(DatasetId = datasetId, FileName = fileName))
26+
27+
# Cleanup
28+
rm(seuratObj)
29+
gc()
30+
}
31+
32+
write.table(ldaFiles, file = 'ldaFiles.txt', row.names = FALSE, col.names = FALSE, quote = FALSE, sep = '\t')

singlecell/resources/queries/singlecell/samples.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function beforeUpsert(row, oldRow, errors){
3838
}
3939

4040
if (['pLN', 'perLN', 'PerLN'].indexOf(row.tissue) !== -1){
41-
row.tissue = 'PeriLN';
41+
row.tissue = 'PLN';
4242
}
4343
else if (['mesLN'].indexOf(row.tissue) !== -1){
4444
row.tissue = 'MesLN';
@@ -47,11 +47,19 @@ function beforeUpsert(row, oldRow, errors){
4747
row.tissue = 'Bone marrow';
4848
}
4949

50-
if ('Lung L' === row.tissue){
50+
if (row.tissue && row.tissue.match(/LD LN/)){
51+
row.tissue = row.tissue.replace(/LD LN/g, 'LD-LN')
52+
}
53+
54+
if (row.tissue && row.tissue.match(/LD-LN /)){
55+
row.tissue = row.tissue.replace(/LD-LN /g, 'LD-LN-')
56+
}
57+
58+
if (['Lung L', 'Lung Left', 'Lung-Left'].indexOf(row.tissue) !== -1){
5159
row.tissue = 'Lung-L';
5260
}
5361

54-
if ('Lung R' === row.tissue){
62+
if (['Lung R', 'Lung Right', 'Lung-Right'].indexOf(row.tissue) !== -1){
5563
row.tissue = 'Lung-R';
5664
}
5765
}

singlecell/resources/views/singleCellDataManagement.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
url: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'sequenceanalysis', queryName: 'sequence_readsets', 'query.totalAlignments~eq': 0, 'query.totalForwardReads~isnonblank': null, 'query.application~contains': 'single', 'query.status~isblank': null, 'query.isArchived~eq': 0, 'query.librarytype~doesnotcontain': 'BCR', 'query.librarytype~contains': 'VDJ', 'query.sort': 'name'})
3030
},{
3131
name: '10x Hashing/Cite-seq Libraries Needing Feature Counts',
32-
url: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'sequenceanalysis', queryName: 'sequence_readsets', 'query.application~in': 'Cell Hashing;CITE-Seq', 'query.totalForwardReads~isnonblank': null, 'query.totalOutputs~eq': 0, 'query.status~isblank': null, 'query.sort': 'name'})
32+
url: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'sequenceanalysis', queryName: 'sequence_readsets', 'query.application~containsoneof': 'Cell Hashing;CITE-Seq', 'query.totalForwardReads~isnonblank': null, 'query.totalOutputs~eq': 0, 'query.status~isblank': null, 'query.sort': 'name'})
3333
},{
3434
name: 'VLoupe Files Needing TCR Import',
3535
url: LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, {schemaName: 'sequenceanalysis', queryName: 'outputfiles', 'query.readset/status~isblank': null, 'query.readset/numTcrResults~eq': 0, 'query.category~eq': '10x VLoupe', 'query.sort': 'readset/name'})

0 commit comments

Comments
 (0)