Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge discvr-23.11 to discvr-24.3 #286

Merged
merged 7 commits into from
Jul 11, 2024
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 @@ -43,6 +43,12 @@ public ParagraphStep()
));
}

@Override
public boolean doSplitJobs()
{
return true;
}

@Override
public boolean canProcess(SequenceOutputFile o)
{
Expand Down
2 changes: 2 additions & 0 deletions jbrowse/api-src/org/labkey/api/jbrowse/JBrowseService.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ public interface LuceneIndexDetector

boolean isAvailable(Container c);
}

abstract public void clearLuceneCacheEntry(File luceneIndexDir);
}
465 changes: 335 additions & 130 deletions jbrowse/src/org/labkey/jbrowse/JBrowseLuceneSearch.java

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions jbrowse/src/org/labkey/jbrowse/JBrowseModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
import org.labkey.api.settings.AdminConsole;
import org.labkey.api.util.ContextListener;
import org.labkey.api.util.PageFlowUtil;
import org.labkey.api.util.SystemMaintenance;
import org.labkey.api.view.WebPartFactory;
Expand Down Expand Up @@ -110,6 +111,8 @@ public void doStartupAfterSpringConfig(ModuleContext moduleContext)

JBrowseService.get().registerFieldCustomizer(new JBrowseLuceneSearch.DefaultJBrowseFieldCustomizer());
JBrowseService.get().registerGroupsProvider(new JBrowseLuceneSearch.TestJBrowseGroupProvider());

ContextListener.addShutdownListener(new JBrowseLuceneSearch.ShutdownHandler());
}

public static void registerPipelineSteps()
Expand Down
6 changes: 6 additions & 0 deletions jbrowse/src/org/labkey/jbrowse/JBrowseServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,12 @@ public void cacheDefaultQuery(User u, String sessionId, String trackId)
luceneSearch.cacheDefaultQuery();
}

@Override
public void clearLuceneCacheEntry(File luceneIndexDir)
{
JBrowseLuceneSearch.clearCacheForFile(luceneIndexDir);
}

public static final class DefaultLuceneIndexDetector implements LuceneIndexDetector
{
@Override
Expand Down
5 changes: 2 additions & 3 deletions singlecell/resources/chunks/Functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,16 @@ file.create(trackerFile)
print(paste0('Total lines in ', trackerFile, ' on job start:', length(readLines(trackerFile))))

saveData <- function(seuratObj, datasetId) {
message(paste0('Saving dataset: ', datasetId, ' with ', ncol(seuratObj), ' cells'))
logger::log_info(paste0('Saving dataset: ', datasetId, ' with ', ncol(seuratObj), ' cells'))
print(paste0('Saving dataset: ', datasetId))
print(seuratObj)

seuratObj <- .TestSplitLayers(seuratObj)

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

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

Expand Down
10 changes: 10 additions & 0 deletions singlecell/resources/chunks/MergeSeurat.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ mergeBatch <- function(dat) {
} else {
toMerge[[datasetId]] <- readSeuratRDS(dat[[datasetId]])
}

if (ncol(toMerge[[datasetId]]) == 1) {
logger::log_info(paste0('Dataset has single cell, skipping: ', datasetId))
toMerge[[datasetId]] <- NULL
}
}

if (!is.null(assaysToDrop)) {
Expand All @@ -28,6 +33,10 @@ mergeBatch <- function(dat) {
}
}

if (length(toMerge) == 0) {
stop('There were no passing seurat objects!')
}

seuratObj <- CellMembrane::MergeSeuratObjs(toMerge, projectName = projectName, doGC = doDiet, errorOnBarcodeSuffix = errorOnBarcodeSuffix)
return(seuratObj)
}
Expand Down Expand Up @@ -61,6 +70,7 @@ if (length(seuratObjects) == 1) {
unlink(mergedObjectFiles[[1]])
} else {
logger::log_info('performing final merge')
# TODO: check for single cell in object
seuratObj <- readRDS(mergedObjectFiles[[1]])
unlink(mergedObjectFiles[[1]])

Expand Down
3 changes: 3 additions & 0 deletions singlecell/resources/chunks/TcrFilter.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ for (datasetId in names(seuratObjects)) {
})

if (sum(matchingCells) == 0) {
print(paste0('No matching cells, skipping: ', datasetId))
next
}

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

if (all(is.null(cellsToKeep))) {
print('There were no matching cells')
} else if (length(cellsToKeep) <= thresholdToKeep) {
print(paste0('Too few cells, skipping: ', datasetId))
} else {
print(paste0('Total passing cells: ', length(cellsToKeep)))
seuratObj <- subset(seuratObj, cells = cellsToKeep)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ else if ("NotUsed".equals(val))
pf.setMaximumFractionDigits(2);

NumberFormat decimal = DecimalFormat.getNumberInstance();
decimal.setGroupingUsed(false);
decimal.setGroupingUsed(true);

descriptions.add("Total Cells: " + decimal.format(totalCells));
if (hashingUsed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ public static class Provider extends AbstractPipelineStepProvider<SingleCellStep
{
public Provider()
{
super("TcrFilter", "TCR-Based Filter", "CellMembrane/Seurat", "This will filter a seurat object based on TCR data.", Collections.singletonList(
super("TcrFilter", "TCR-Based Filter", "CellMembrane/Seurat", "This will filter a seurat object based on TCR data.", Arrays.asList(
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(){{
put("height", 150);
put("delimiter", ",");
put("stripCharsRe", "/(^['\"]+)|(['\"]+$)/g");
}}, null).delimiter(",")
}}, null).delimiter(","),
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(){{
put("minValue", 0);
}}, 1)
), List.of("/sequenceanalysis/field/TrimmingTextArea.js"), null);
}

Expand Down