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

Combining sequencing platforms - 10x and Cel-seq2 - Error in if (trim > 0 && n) { : missing value where TRUE/FALSE needed #253

Open
reberya opened this issue Jan 25, 2022 · 2 comments

Comments

@reberya
Copy link

reberya commented Jan 25, 2022

Hello,

First off, thanks for putting together an awesome tool. I'm a new user to rliger and was wondering if you had any guidance on how to handle integrating datasets from different analysis platforms - specifically I'm working with 10x data and CEL-Seq2 data. What I've tried thus far is to merge these objects into a single Seurat object and proceed with the integration strategy as outlined here.

toMerge = a list of Seurat objects from 10x data
kild_cs = a Seurat object from cel-seq2 data


# combine the seurat objects
MERGED <- merge(toMerge[[1]], 
              y = c(toMerge[[2]],toMerge[[5]],toMerge[[8]],toMerge[[11]],toMerge[[14]],
                    toMerge[[3]],toMerge[[6]],toMerge[[9]],toMerge[[12]],toMerge[[15]],
                    toMerge[[4]],toMerge[[7]],toMerge[[10]],toMerge[[13]],toMerge[[16]],
                    kild_cs))

# process with rliger
MERGED %<>% NormalizeData(.) %>%
  FindVariableFeatures(.) %>%
  ScaleData(., split.by = "SAMPLE", do.center = FALSE) %>% 
  RunOptimizeALS(., k = 20, lambda = 5, split.by = "SAMPLE") %>%
  RunQuantileNorm(., split.by = "SAMPLE") %>%
  FindNeighbors(., reduction = "iNMF", dims = 1:20)

However, this kicks out the error shown during the RunOptimizeALS() call:

Performing log-normalization
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating gene variances
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating feature variances of standardized and clipped values
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Scaling data matrix
Scaling data from split dong_GSM4088774
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088775
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088776
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088777
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088778
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088779
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088780
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088781
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088782
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4088783
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4654669
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4654670
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4654671
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4654672
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4654673
  |=================================================================================================================================================================================| 100%
Scaling data from split dong_GSM4654674
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_000CGH
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_000FQM
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_000GGU
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB060
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB086
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB098
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB106
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB107
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB123
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB124
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB125
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB130
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB132
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB138
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB151
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_NB152
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_PD42184
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_PD42752-1
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_PD42752-2
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_PD43255
  |=================================================================================================================================================================================| 100%
Scaling data from split kild_PD46693
  |=================================================================================================================================================================================| 100%
  |                                                                                                                                                                                 |   0%
Error in if (trim > 0 && n) { : missing value where TRUE/FALSE needed

I'm fairly certain this is occuring due to discrepancies between the 10x data and the cel-seq2 data since RunOptimizeALS() will finish if I remove the cel-seq2 seurat object. I also can successfully run the ifnb example provided. Happy to provide a reproducible example or share the dataset I'm trying to integrate. Any thoughts would be appreciated. THanks!

@skpalan
Copy link
Collaborator

skpalan commented Jan 28, 2022

Hi, thanks for your comments! Can you check if the 10x and cel-seq2 data share any genes or features? Also please check if the number of the variable genes selected by FindVariableFeatures is reasonable.

@reberya
Copy link
Author

reberya commented Jan 31, 2022

Thanks for the fast reply!

They do share genes.

> head(rownames(toMerge[[1]])) 
[1] "TSPAN6"   "DPM1"     "SCYL3"    "C1orf112" "FGR"      "CFH"      

> head(rownames(kild_cs)) 
[1] "TSPAN6"   "TNMD"     "DPM1"     "SCYL3"    "C1orf112" "FGR"  
    
> table(rownames(toMerge[[1]]) %in% rownames(kild_cs))  
FALSE  TRUE     
85 17954

The number of variable genes seems reasonable


> nbl <- merge(toMerge[[1]], 
+               y = c(toMerge[[2]],toMerge[[5]],toMerge[[8]],toMerge[[11]],toMerge[[14]],
+                     toMerge[[3]],toMerge[[6]],toMerge[[9]],toMerge[[12]],toMerge[[15]],
+                     toMerge[[4]],toMerge[[7]],toMerge[[10]],toMerge[[13]],toMerge[[16]],
+                     kild_10x, kild_cs))
Warning in CheckDuplicateCellNames(object.list = objects) :
  Some cell names are duplicated across objects provided. Renaming to enforce unique cell names.
> 
> test <- nbl %>% 
+   NormalizeData(.) %>%
+   FindVariableFeatures(.)
Performing log-normalization
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating gene variances
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Calculating feature variances of standardized and clipped values
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|

> length(test@[email protected])
[1] 2000
> head(test@[email protected])
[1] "HBB"   "HBA2"  "HBA1"  "IGKC"  "IGHG1" "IGHG4"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants