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

aucellRankings - merging two object #5

Closed
ltosti opened this issue May 15, 2019 · 6 comments
Closed

aucellRankings - merging two object #5

ltosti opened this issue May 15, 2019 · 6 comments

Comments

@ltosti
Copy link

ltosti commented May 15, 2019

Hi,

Is there a way to merge two aucellRankings objects coming from one dataset that was initially split in two?

Thank you!

@s-aibar
Copy link
Member

s-aibar commented May 20, 2019

Dear @ltosti ,

To merge two objects you can concatenate the columns (e.g. cbind on the cells_rankings@assays[["ranking"]] or getRanking(cells_rankings)).

I have also just added a cbind function that will do this. It is already available in Github, but it will take a few days to be updated in Bioc_devel.

Thanks for the feedback!

@s-aibar s-aibar closed this as completed May 20, 2019
@ltosti
Copy link
Author

ltosti commented May 24, 2019

Dear @s-aibar ,

Thank you for your help, I did manage to merge the objects using cells_rankings@assays[["ranking"]] . However, when I went ahead with the subsequent step AUCell_calcAUC I got the following error:

Error in dimnames(assay) <- `*vtmp*` : 
  length of 'dimnames' [2] not equal to array extent
Calls: AUCell_calcAUC ... endoapply -> lapply -> lapply -> lapply -> lapply -> FUN
Execution halted

Do you think this error is caused by the merging?

Thank you!

@s-aibar
Copy link
Member

s-aibar commented May 24, 2019

Dear @ltosti ,

There is probably something wrong with the way you concatenated the rankings or created the new object (probably related to the dimnames...?).

Would you mind installing the latest version of the package and try the new cbind function? I have double-checked it and that one seems to work...

You can install it from Github or Bioconductor (devel):

install.packages("https://bioconductor.org/packages/devel/bioc/src/contrib/AUCell_1.7.1.tar.gz", repos=NULL, source=TRUE)

@ltosti
Copy link
Author

ltosti commented May 25, 2019

Hi @s-aibar ,

I tried to use the new cbind function on two objects (Formal class 'aucellResults' [package "AUCell"] with 6 slots) but I get the following error:

Error in slot(object, slot_name) : 
  cannot get a slot ("assays") from an object of type "list"

Did I do something wrong?

@s-aibar
Copy link
Member

s-aibar commented May 25, 2019

Hello @ltosti ,

Sorry, there was something wrong with the namespace of the new cbind function...
I think it should now work. You can test the new version with this code:

# Install and load
devtools::install_github("aertslab/AUCell")
library(AUCell)
packageVersion("AUCell") == "1.7.2"

# Create rankings
set.seed(123)
exprMatrix <- matrix(data=sample(c(rep(0, 5000), sample(1:3, 5000, replace=TRUE))),
                     nrow=20, 
                     dimnames=list(paste("Gene", 1:20, sep=""), 
                                   paste("Cell", 1:500, sep="")))
sample1 <- exprMatrix[,1:100]
sample2 <- exprMatrix[,101:500]
cells_rankings1 <- AUCell_buildRankings(sample1)
cells_rankings2 <- AUCell_buildRankings(sample2)

# Merge
cbind(cells_rankings1, cells_rankings2)

@ltosti
Copy link
Author

ltosti commented May 26, 2019

Hi @s-aibar ,

Yes, this works also on my objects. Thank you very much for your help!

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