Skip to content

Commit

Permalink
Make AppendMetadata more tolerant
Browse files Browse the repository at this point in the history
  • Loading branch information
bbimber committed Jan 31, 2025
1 parent cde358a commit 3843ffe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion singlecell/resources/chunks/AppendMetadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ for (datasetId in names(seuratObjects)) {
printName(datasetId)
seuratObj <- readSeuratRDS(seuratObjects[[datasetId]])

seuratObj <- Rdiscvr::QueryAndApplyCdnaMetadata(seuratObj)
if ('BarcodePrefix' %in% names(seuratObj@meta.data) && !any(is.na(as.integer(seuratObj$BarcodePrefix)))) {
seuratObj <- Rdiscvr::QueryAndApplyCdnaMetadata(seuratObj)
} else if ('cDNA_ID' %in% names(seuratObj@meta.data)) {
seuratObj <- Rdiscvr::QueryAndApplyMetadataUsingCDNA(seuratObj)
} else {
stop('Unable to find either BarcodePrefix or cDNA_ID in meta.data')
}

saveData(seuratObj, datasetId)

Expand Down

0 comments on commit 3843ffe

Please sign in to comment.