Entering edit mode
9 months ago
cassy
•
0
Hello,
I am trying to integrate the data by correcting for batch effects per patient and I'm running into this error while executing the IntegrateData function, how do I fix this? Is it because the sepsis2HTO_HAB3 (7th dataset) has too few samples (66) to be properly integrated?
analyseFinalList = function(objlist, intname)
{
dir.create(intname, recursive = TRUE)
#
# integrate based on RNA/GEX assay
#
objSamples = objlist
print(objSamples)
objSamples = lapply(objSamples, function(x) {
DefaultAssay(x) <- 'RNA'
#x <- RunPCA(x, verbose = FALSE, reduction.name="pca", assay="RNA")
# DefaultAssay(x) <- 'SCT'
# print(x@reductions$pca)
return(x)
})
print("GEX integration features")
print(objSamples)
features_gex <- SelectIntegrationFeatures(object.list = objSamples, nfeatures = 800)#, assay=rep("RNA", length(objSamples)))
objlist.anchors <- FindIntegrationAnchors(object.list = objSamples, reduction = "rpca", dims = 1:30, anchor.features = features_gex, reference = 1)
obj.list.integrated <- IntegrateData(new.assay.name = "integrated_gex", anchorset = objlist.anchors, dims = 1:30, verbose=T) #normalization.method = "SCT",
print("GEX integration done")
return(obj.list.integrated)
}
integratedList_sample = analyseFinalList(finalList_samples, "wnn")
[1] "GEX integration features"
$sepsis1HTO_HAB7
An object of class Seurat
36605 features across 2217 samples within 2 assays
Active assay: RNA (36601 features, 800 variable features)
1 other assay present: HTO
1 dimensional reduction calculated: pca
$sepsis1HTO_HAB8
An object of class Seurat
36605 features across 2610 samples within 2 assays
Active assay: RNA (36601 features, 800 variable features)
1 other assay present: HTO
1 dimensional reduction calculated: pca
$sepsis1HTO_HAB5
An object of class Seurat
36605 features across 1833 samples within 2 assays
Active assay: RNA (36601 features, 800 variable features)
1 other assay present: HTO
1 dimensional reduction calculated: pca
$sepsis1HTO_HAB6
An object of class Seurat
36605 features across 2116 samples within 2 assays
Active assay: RNA (36601 features, 800 variable features)
1 other assay present: HTO
1 dimensional reduction calculated: pca
$sepsis2HTO_HAB1
An object of class Seurat
36621 features across 513 samples within 2 assays
Active assay: RNA (36601 features, 800 variable features)
1 other assay present: HTO
1 dimensional reduction calculated: pca
$sepsis2HTO_HAB2
An object of class Seurat
36621 features across 418 samples within 2 assays
Active assay: RNA (36601 features, 800 variable features)
1 other assay present: HTO
1 dimensional reduction calculated: pca
$sepsis2HTO_HAB3
An object of class Seurat
36621 features across 66 samples within 2 assays
Active assay: RNA (36601 features, 800 variable features)
1 other assay present: HTO
1 dimensional reduction calculated: pca
Scaling features for provided objects
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=01s
Computing within dataset neighborhoods
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s
Finding anchors between all query and reference datasets
| | 0 % ~calculating Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
Found 1038 anchors
|+++++++++ | 17% ~09s Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
Found 678 anchors
|+++++++++++++++++ | 33% ~07s Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
Found 1039 anchors
|+++++++++++++++++++++++++ | 50% ~05s Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
Found 242 anchors
|++++++++++++++++++++++++++++++++++ | 67% ~03s Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
Found 230 anchors
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~01s Projecting new data onto SVD
Projecting new data onto SVD
Finding neighborhoods
Finding anchors
Found 115 anchors
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=08s
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from integrated_gex_ to integratedgex_
| | 0 % ~calculating
Integrating dataset 2 with reference dataset
Finding integration vectors
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from integrated_gex_ to integratedgex_
|+++++++++ | 17% ~09s
Integrating dataset 3 with reference dataset
Finding integration vectors
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from integrated_gex_ to integratedgex_
|+++++++++++++++++ | 33% ~06s
Integrating dataset 4 with reference dataset
Finding integration vectors
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from integrated_gex_ to integratedgex_
|+++++++++++++++++++++++++ | 50% ~05s
Integrating dataset 5 with reference dataset
Finding integration vectors
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from integrated_gex_ to integratedgex_
|++++++++++++++++++++++++++++++++++ | 67% ~03s
Integrating dataset 6 with reference dataset
Finding integration vectors
Finding integration vector weights
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: Keys should be one or more alphanumeric characters followed by an underscore, setting key from integrated_gex_ to integratedgex_
|++++++++++++++++++++++++++++++++++++++++++ | 83% ~01s
Integrating dataset 7 with reference dataset
Finding integration vectors
Finding integration vector weights
Error in idx[i, ] <- res[[i]][[1]] :
number of items to replace is not a multiple of replacement length
Please use the formatting bar (especially the
code
option) to present your post better. You can use backticks for inline code (`text` becomestext
), or select a chunk of text and use the highlighted button to format it as a code block. If your code has long lines with a single command, break those lines into multiple lines with proper escape sequences so they're easier to read and still run when copy-pasted. I've done it for you this time.I've also added some indentation to make the code readable and removed unnecessary new lines. Please invest some more effort in your presentation.
You've cross-posted this on bioinformatics Stack Exchange and annoyed two communities at once. Cross-posting - without waiting on responses from one community - is a bad technique.