Skip to content

Commit 795712c

Browse files
authored
Merge pull request #286 from BimberLab/24.3_fb_merge
Merge discvr-23.11 to discvr-24.3
2 parents aabe6ff + 8ce794c commit 795712c

File tree

10 files changed

+373
-136
lines changed

10 files changed

+373
-136
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/run/alignment/ParagraphStep.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public ParagraphStep()
4343
));
4444
}
4545

46+
@Override
47+
public boolean doSplitJobs()
48+
{
49+
return true;
50+
}
51+
4652
@Override
4753
public boolean canProcess(SequenceOutputFile o)
4854
{

jbrowse/api-src/org/labkey/api/jbrowse/JBrowseService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,6 @@ public interface LuceneIndexDetector
5656

5757
boolean isAvailable(Container c);
5858
}
59+
60+
abstract public void clearLuceneCacheEntry(File luceneIndexDir);
5961
}

jbrowse/src/org/labkey/jbrowse/JBrowseLuceneSearch.java

Lines changed: 335 additions & 130 deletions
Large diffs are not rendered by default.

jbrowse/src/org/labkey/jbrowse/JBrowseModule.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
3131
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
3232
import org.labkey.api.settings.AdminConsole;
33+
import org.labkey.api.util.ContextListener;
3334
import org.labkey.api.util.PageFlowUtil;
3435
import org.labkey.api.util.SystemMaintenance;
3536
import org.labkey.api.view.WebPartFactory;
@@ -110,6 +111,8 @@ public void doStartupAfterSpringConfig(ModuleContext moduleContext)
110111

111112
JBrowseService.get().registerFieldCustomizer(new JBrowseLuceneSearch.DefaultJBrowseFieldCustomizer());
112113
JBrowseService.get().registerGroupsProvider(new JBrowseLuceneSearch.TestJBrowseGroupProvider());
114+
115+
ContextListener.addShutdownListener(new JBrowseLuceneSearch.ShutdownHandler());
113116
}
114117

115118
public static void registerPipelineSteps()

jbrowse/src/org/labkey/jbrowse/JBrowseServiceImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ public void cacheDefaultQuery(User u, String sessionId, String trackId)
319319
luceneSearch.cacheDefaultQuery();
320320
}
321321

322+
@Override
323+
public void clearLuceneCacheEntry(File luceneIndexDir)
324+
{
325+
JBrowseLuceneSearch.clearCacheForFile(luceneIndexDir);
326+
}
327+
322328
public static final class DefaultLuceneIndexDetector implements LuceneIndexDetector
323329
{
324330
@Override

singlecell/resources/chunks/Functions.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,16 @@ file.create(trackerFile)
7070
print(paste0('Total lines in ', trackerFile, ' on job start:', length(readLines(trackerFile))))
7171

7272
saveData <- function(seuratObj, datasetId) {
73-
message(paste0('Saving dataset: ', datasetId, ' with ', ncol(seuratObj), ' cells'))
73+
logger::log_info(paste0('Saving dataset: ', datasetId, ' with ', ncol(seuratObj), ' cells'))
7474
print(paste0('Saving dataset: ', datasetId))
7575
print(seuratObj)
7676

7777
seuratObj <- .TestSplitLayers(seuratObj)
7878

7979
datasetIdForFile <- makeLegalFileName(datasetId)
8080
fn <- paste0(outputPrefix, '.', datasetIdForFile, '.seurat.rds')
81-
message(paste0('Filename: ', fn))
8281

83-
message(paste0('Saving RDS file: ', fn, ' with ', ncol(seuratObj), ' cells'))
82+
logger::log_info(paste0('Saving RDS file: ', fn, ' with ', ncol(seuratObj), ' cells'))
8483
barcodeFile <- paste0(outputPrefix, '.', datasetIdForFile, '.cellBarcodes.csv')
8584
metaFile <- paste0(outputPrefix, '.', datasetIdForFile, '.seurat.meta.txt')
8685

singlecell/resources/chunks/MergeSeurat.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ mergeBatch <- function(dat) {
1515
} else {
1616
toMerge[[datasetId]] <- readSeuratRDS(dat[[datasetId]])
1717
}
18+
19+
if (ncol(toMerge[[datasetId]]) == 1) {
20+
logger::log_info(paste0('Dataset has single cell, skipping: ', datasetId))
21+
toMerge[[datasetId]] <- NULL
22+
}
1823
}
1924

2025
if (!is.null(assaysToDrop)) {
@@ -28,6 +33,10 @@ mergeBatch <- function(dat) {
2833
}
2934
}
3035

36+
if (length(toMerge) == 0) {
37+
stop('There were no passing seurat objects!')
38+
}
39+
3140
seuratObj <- CellMembrane::MergeSeuratObjs(toMerge, projectName = projectName, doGC = doDiet, errorOnBarcodeSuffix = errorOnBarcodeSuffix)
3241
return(seuratObj)
3342
}
@@ -61,6 +70,7 @@ if (length(seuratObjects) == 1) {
6170
unlink(mergedObjectFiles[[1]])
6271
} else {
6372
logger::log_info('performing final merge')
73+
# TODO: check for single cell in object
6474
seuratObj <- readRDS(mergedObjectFiles[[1]])
6575
unlink(mergedObjectFiles[[1]])
6676

singlecell/resources/chunks/TcrFilter.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ for (datasetId in names(seuratObjects)) {
2727
})
2828

2929
if (sum(matchingCells) == 0) {
30+
print(paste0('No matching cells, skipping: ', datasetId))
3031
next
3132
}
3233

@@ -40,6 +41,8 @@ for (datasetId in names(seuratObjects)) {
4041

4142
if (all(is.null(cellsToKeep))) {
4243
print('There were no matching cells')
44+
} else if (length(cellsToKeep) <= thresholdToKeep) {
45+
print(paste0('Too few cells, skipping: ', datasetId))
4346
} else {
4447
print(paste0('Total passing cells: ', length(cellsToKeep)))
4548
seuratObj <- subset(seuratObj, cells = cellsToKeep)

singlecell/src/org/labkey/singlecell/analysis/AbstractSingleCellHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ else if ("NotUsed".equals(val))
10631063
pf.setMaximumFractionDigits(2);
10641064

10651065
NumberFormat decimal = DecimalFormat.getNumberInstance();
1066-
decimal.setGroupingUsed(false);
1066+
decimal.setGroupingUsed(true);
10671067

10681068
descriptions.add("Total Cells: " + decimal.format(totalCells));
10691069
if (hashingUsed)

singlecell/src/org/labkey/singlecell/pipeline/singlecell/TcrFilter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ public static class Provider extends AbstractPipelineStepProvider<SingleCellStep
2121
{
2222
public Provider()
2323
{
24-
super("TcrFilter", "TCR-Based Filter", "CellMembrane/Seurat", "This will filter a seurat object based on TCR data.", Collections.singletonList(
24+
super("TcrFilter", "TCR-Based Filter", "CellMembrane/Seurat", "This will filter a seurat object based on TCR data.", Arrays.asList(
2525
SeuratToolParameter.create("cdr3s", "CDR3s To Keep", "A comma- or newline-delimited list of CDR3 sequences where locus prefixes the AA sequence (i.e. TRB:XXXXXX or TRA:YYYYYYY). Any cell matching any of these CDR3s will be kept. If that cell has multiple chains for a locus (i.e. 'CASSXXXXX,CASSYYYYY'), then only one of these needs to match for that cell to be kept. Also, all the input CDR3s should be single-chain (i.e. 'TRA:XXXXX', not 'TRA:XXXX,YYYY').", "sequenceanalysis-trimmingtextarea", new JSONObject(){{
2626
put("height", 150);
2727
put("delimiter", ",");
2828
put("stripCharsRe", "/(^['\"]+)|(['\"]+$)/g");
29-
}}, null).delimiter(",")
29+
}}, null).delimiter(","),
30+
SeuratToolParameter.create("thresholdToKeep", "Min Cells To Keep", "If fewer than this many cells remain, the object will be discarded. This is primary present because seurat cannot easily accommodate objects with 1 cells", "ldk-integerfield", new JSONObject(){{
31+
put("minValue", 0);
32+
}}, 1)
3033
), List.of("/sequenceanalysis/field/TrimmingTextArea.js"), null);
3134
}
3235

0 commit comments

Comments
 (0)