Skip to content

Commit 71834d1

Browse files
committed
Merge discvr-25.11 to develop
2 parents d5def2a + 552d9ce commit 71834d1

File tree

19 files changed

+222
-94
lines changed

19 files changed

+222
-94
lines changed

SequenceAnalysis/pipeline_code/extra_tools_install.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,32 @@ then
379379
else
380380
echo "Already installed"
381381
fi
382+
383+
#
384+
#clustalw
385+
#
386+
387+
echo ""
388+
echo ""
389+
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
390+
echo "Installing ClustalW"
391+
echo ""
392+
cd $LKSRC_DIR
393+
394+
if [[ ! -e ${LKTOOLS_DIR}/clustalw2 || ! -z $FORCE_REINSTALL ]];
395+
then
396+
rm -Rf clustal*
397+
rm -Rf 1.2.4-cmake.tar.gz
398+
rm -Rf $LKTOOLS_DIR/clustalw2
399+
400+
wget $WGET_OPTS https://github.com/GSLBiotech/clustal-omega/archive/refs/tags/1.2.4-cmake.tar.gz
401+
tar -xf 1.2.4-cmake.tar.gz
402+
cd clustal-omega-1.2.4-cmake
403+
./configure
404+
make
405+
406+
install ./src/clustalw2 $LKTOOLS_DIR/clustalw2
407+
408+
else
409+
echo "Already installed"
410+
fi

SequenceAnalysis/pipeline_code/sequence_tools_install.sh

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -999,37 +999,6 @@ else
999999
fi
10001000

10011001

1002-
#
1003-
#clustalw
1004-
#
1005-
1006-
echo ""
1007-
echo ""
1008-
echo "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
1009-
echo "Installing ClustalW"
1010-
echo ""
1011-
cd $LKSRC_DIR
1012-
1013-
if [[ ! -e ${LKTOOLS_DIR}/clustalw2 || ! -z $FORCE_REINSTALL ]];
1014-
then
1015-
rm -Rf clustalw-*
1016-
rm -Rf $LKTOOLS_DIR/clustalw2
1017-
1018-
wget $WGET_OPTS http://www.clustal.org/download/current/clustalw-2.1.tar.gz
1019-
gunzip clustalw-2.1.tar.gz
1020-
tar -xf clustalw-2.1.tar
1021-
gzip clustalw-2.1.tar
1022-
cd clustalw-2.1
1023-
./configure
1024-
make
1025-
1026-
install ./src/clustalw2 $LKTOOLS_DIR/clustalw2
1027-
1028-
else
1029-
echo "Already installed"
1030-
fi
1031-
1032-
10331002
#
10341003
#muscle
10351004
#

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5069,6 +5069,7 @@ public ApiResponse execute(ArchiveReadsetsForm form, BindException errors) throw
50695069

50705070
Set<File> toDelete = new HashSet<>();
50715071
List<Map<String, Object>> toUpdate = new ArrayList<>();
5072+
Set<Long> encounteredReaddata = new HashSet<>();
50725073
for (ReadData rd : rs.getReadData())
50735074
{
50745075
if (rd.getSra_accession() == null)
@@ -5077,7 +5078,14 @@ public ApiResponse execute(ArchiveReadsetsForm form, BindException errors) throw
50775078
return null;
50785079
}
50795080

5081+
// A given ReadData can be referenced by multiple readsets
5082+
if (encounteredReaddata.contains(rd.getRowid()))
5083+
{
5084+
continue;
5085+
}
5086+
50805087
toUpdate.add(new CaseInsensitiveHashMap<>(Map.of("rowid", rd.getRowid(), "archived", true, "container", rd.getContainer())));
5088+
encounteredReaddata.add(rd.getRowid());
50815089

50825090
// File 1:
50835091
ExpData d1 = ExperimentService.get().getExpData(rd.getFileId1());
@@ -5131,7 +5139,6 @@ public ApiResponse execute(ArchiveReadsetsForm form, BindException errors) throw
51315139
{
51325140
List<Map<String, Object>> keys = new ArrayList<>();
51335141
toUpdate.forEach(row -> {
5134-
51355142
keys.add(new CaseInsensitiveHashMap<>(Map.of("rowid", row.get("rowid"))));
51365143
});
51375144

@@ -5141,7 +5148,7 @@ public ApiResponse execute(ArchiveReadsetsForm form, BindException errors) throw
51415148
}
51425149
catch (Exception e)
51435150
{
5144-
_log.error(e);
5151+
_log.error("Error archiving readsets", e);
51455152
errors.reject(ERROR_MSG, "Error archiving readset: " + readsetId + ", " + e.getMessage());
51465153
return null;
51475154
}

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,11 @@ public void testSerializeWithMap() throws Exception
320320
js1._cachedObjects.put("cachedString", "foo");
321321
js1._cachedObjects.put("cachedLong", 2L);
322322

323+
LongHashMap<Long> longMap = new LongHashMap<>();
324+
longMap.put(1L, 2L);
325+
326+
js1._cachedObjects.put("cachedLongMap", longMap);
327+
323328
ObjectMapper mapper = PipelineJob.createObjectMapper();
324329

325330
StringWriter writer = new StringWriter();
@@ -341,10 +346,13 @@ public void testSerializeWithMap() throws Exception
341346
//NOTE: this is not serializing properly. the keys are serialized as Strings
342347
Map serializedMap = deserialized.getCachedObject("cachedMap", mapper.getTypeFactory().constructParametricType(Map.class, Integer.class, Integer.class));
343348
assertEquals("Map not serialized properly", 1, serializedMap.size());
344-
345-
//TODO: determine if we can coax jackson into serializing these properly
346349
assertEquals("Object not serialized with correct key type", Integer.class, serializedMap.keySet().iterator().next().getClass());
347350
assertNotNull("Map keys not serialized properly", serializedMap.get(1));
351+
352+
LongHashMap<Long> serializedLongMap = (LongHashMap<Long>)deserialized.getCachedObject("cachedLongMap", LongHashMap.class);
353+
assertEquals("LongMap not serialized properly", 1, serializedLongMap.size());
354+
assertEquals("Object not serialized with correct key type", Long.class, serializedLongMap.keySet().iterator().next().getClass());
355+
assertNotNull("LongMap keys not serialized properly", serializedLongMap.get(1L));
348356
}
349357

350358
@Test

singlecell/api-src/org/labkey/api/singlecell/pipeline/AbstractSingleCellPipelineStep.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,19 @@ public static void executeR(SequenceOutputHandler.JobContext ctx, String dockerC
318318
throw new PipelineJobException(e);
319319
}
320320

321-
if (seuratThreads != null)
321+
Integer maxThreads = SequencePipelineService.get().getMaxThreads(ctx.getLogger());
322+
if (seuratThreads == null && maxThreads != null)
322323
{
323-
Integer maxThreads = SequencePipelineService.get().getMaxThreads(ctx.getLogger());
324-
if (maxThreads != null && maxThreads < seuratThreads)
325-
{
326-
seuratThreads = maxThreads;
327-
}
324+
seuratThreads = maxThreads;
325+
}
326+
else if (seuratThreads != null && maxThreads != null && maxThreads < seuratThreads)
327+
{
328+
ctx.getLogger().debug("Lowering SEURAT_MAX_THREADS based on the job settings, to: " + maxThreads);
329+
seuratThreads = maxThreads;
330+
}
328331

332+
if (seuratThreads != null)
333+
{
329334
wrapper.addToDockerEnvironment("SEURAT_MAX_THREADS", seuratThreads.toString());
330335
}
331336

singlecell/resources/chunks/ApplyKnownClonotypicData.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ for (datasetId in names(seuratObjects)) {
1111
printName(datasetId)
1212
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
1313

14-
seuratObj <- ApplyKnownClonotypicData(seuratObj)
14+
seuratObj <- ApplyKnownClonotypicData(seuratObj, antigenInclusionList = antigenInclusionList, antigenExclusionList = antigenExclusionList, minActivationFrequency = minActivationFrequency)
1515
saveData(seuratObj, datasetId)
1616

1717
# Cleanup

singlecell/resources/chunks/PerformTcrClustering.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ for (datasetId in names(seuratObjects)) {
22
printName(datasetId)
33
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
44

5+
print(paste0('Calculating distances for: ', datasetId))
56
seuratObj <- tcrClustR::CalculateTcrDistances(
67
inputData = seuratObj,
7-
chains = c('TRA', 'TRB', 'TRG', 'TRD'),
8+
chains = chains,
89
organism = organism,
910
minimumCloneSize = 2,
1011
calculateChainPairs = TRUE
1112
)
1213

14+
print('Performing TCR Clustering')
1315
seuratObj <- tcrClustR::RunTcrClustering(
1416
seuratObj_TCR = seuratObj,
1517
dianaHeight = 20,
@@ -22,10 +24,13 @@ for (datasetId in names(seuratObjects)) {
2224
} else {
2325
for (an in names(seuratObj@misc$TCR_Distances)) {
2426
ad <- seuratObj@misc$TCR_Distances[[an]]
25-
print(paste0('Assay: ', an, ', total clones: ', nrow(ad)))
27+
fn <- length(unique(seuratObj[[paste0(an, '_ClusterIdx')]]))
28+
print(paste0('Assay: ', an, ', total clones: ', nrow(ad), '. Distinct families: ', fn))
2629
}
2730
}
2831

32+
VisualizeTcrDistances(seuratObj)
33+
2934
saveData(seuratObj, datasetId)
3035

3136
# Cleanup

singlecell/resources/chunks/PredictTcellActivation.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ for (datasetId in names(seuratObjects)) {
22
printName(datasetId)
33
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
44

5+
toDrop <- grep(names(seuratObj@meta.data), pattern = "sPLS", value = TRUE)
6+
if (length(toDrop) > 0) {
7+
print(paste0('Dropping pre-existing columns: ', paste0(toDrop, collapse = ', ')))
8+
for (colName in toDrop) {
9+
seuratObj[[toDrop]] <- NULL
10+
}
11+
}
12+
513
seuratObj <- RIRA::PredictTcellActivation(seuratObj)
614

715
saveData(seuratObj, datasetId)

singlecell/resources/chunks/RunDecoupler.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ for (datasetId in names(seuratObjects)) {
33
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
44

55
seuratObj <- CellMembrane::RunDecoupleR(seuratObj)
6+
if (!all(is.na(heatmapGroupingVars))) {
7+
for (heatmapGroupingVar in heatmapGroupingVars) {
8+
PlotTfData(seuratObj, groupField = heatmapGroupingVar)
9+
}
10+
}
611

712
saveData(seuratObj, datasetId)
813

singlecell/resources/chunks/RunEscape.R

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,41 @@ if (Sys.getenv('SEURAT_MAX_THREADS') != '') {
55
}
66

77
for (datasetId in names(seuratObjects)) {
8-
printName(datasetId)
9-
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
8+
printName(datasetId)
9+
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])
1010

11-
seuratObj <- CellMembrane::RunEscape(seuratObj, outputAssayBaseName = outputAssayBaseName, doPlot = TRUE, performDimRedux = performDimRedux, nCores = nCores)
11+
toDelete <- c()
1212

13-
saveData(seuratObj, datasetId)
13+
vals <- eval(formals(CellMembrane::RunEscape)$msigdbGeneSets)
14+
for (idx in seq_along(vals)) {
15+
geneSetName <- names(vals)[idx]
16+
geneSet <- vals[[idx]]
17+
logger::log_info(paste0('Processing: ', geneSetName, ' / ', geneSet))
1418

15-
# Cleanup
16-
rm(seuratObj)
17-
gc()
19+
fn <- paste0('escape.', datasetId, '.', ifelse(geneSetName == '', yes = geneSet, no = geneSetName), '.rds')
20+
if (file.exists(fn)) {
21+
logger::log_info(paste0('resuming: ', fn))
22+
seuratObj <- readRDS(fn)
23+
toDelete <- c(toDelete, fn)
24+
} else {
25+
msigdbGeneSets <- geneSet
26+
if (geneSetName != '') {
27+
names(msigdbGeneSets) <- geneSetName
28+
}
29+
30+
seuratObj <- CellMembrane::RunEscape(seuratObj, msigdbGeneSets = msigdbGeneSets, outputAssayBaseName = outputAssayBaseName, doPlot = TRUE, heatmapGroupingVars = heatmapGroupingVars, performDimRedux = performDimRedux, escapeMethod = escapeMethod, nCores = nCores)
31+
saveRDS(seuratObj, file = fn)
32+
toDelete <- c(toDelete, fn)
33+
}
34+
}
35+
36+
for(fn in toDelete) {
37+
unlink(fn)
38+
}
39+
40+
saveData(seuratObj, datasetId)
41+
42+
# Cleanup
43+
rm(seuratObj)
44+
gc()
1845
}

0 commit comments

Comments
 (0)