Skip to content

Potential error in FindLR for datatype = 'DEG' ?  #19

Open
@dlmatera

Description

@dlmatera

Cool package and useful LR pair database!

I can successfully use the FindLR function, etc. for count data but when I input a list of DEGs for various cell types the result is always returned as "No significant pairs found" - even though I can clearly see LR pairs in the data

Capture italk

Im just using the sample code with the following setup (data1 is seen above)
Capture italk2

any advice?

Activity

XiaofeiSunUCSF

XiaofeiSunUCSF commented on Jul 13, 2020

@XiaofeiSunUCSF

I got the error here
LRPlot(res,datatype='DEG')
Error: order should contain names of all sectors.
In addition: Warning message:
Since you have set order, you should better set grid.col as a named
vector where sector names are the vector names (should contain all sectors).

XinYu-pumch

XinYu-pumch commented on Jul 16, 2020

@XinYu-pumch

I got the error here
LRPlot(res,datatype='DEG')
Error: order should contain names of all sectors.
In addition: Warning message:
Since you have set order, you should better set grid.col as a named
vector where sector names are the vector names (should contain all sectors).

XiaofeiSunUCSF, I've got the same problem. Can you please show detailed code of the solution? Thanks!!!

XiaofeiSunUCSF

XiaofeiSunUCSF commented on Jul 16, 2020

@XiaofeiSunUCSF

chordDiagram

Hi XinYu-pumch,
That works!!

Thank you for sharing your code!

XinYu-pumch

XinYu-pumch commented on Jul 17, 2020

@XinYu-pumch

chordDiagram

Hi XinYu-pumch,
That works!!

Thank you for sharing your code!

Hey dude!!!!! I finally sovled the problem!!!!!!!!
My previous reply that Setting "order =Null" was totally wrong. We do need correct set of "order" in the function "chordDiagram".

The bug results from "order = paste(names(genes),genes)" in the function "chordDiagram". It's because the object "genes" doesn't contain the correct name of the data.frame the chordDiagram use. But it's easy to solve it just by simplely creating a new object of "genes".
Here's my code:

cell_group <- unique(c(data$cell_from, data$cell_to))
genes_2 <- c(structure(cbind(paste(data$cell_from, data$ligand)), names =data$cell_from ),
structure(cbind(paste(data$cell_to, data$receptor)), names = data$cell_to ))
genes_2 <- genes_2[!duplicated(paste(names(genes_2), genes_2))]
genes_2 <- genes_2[order(names(genes_2))]
genes_matrix <- data.frame(names=names(genes_2),genes_2=genes_2)
genes_matrix <- separate(genes_matrix,genes_2,into = c("cell","gene"),sep = " ")
genes_matrix$genes_2 <- genes_2

And in the function "chordDiagram", "circos.trackPlotRegion" and "highlight.sector", which are in the last three parts of the code of "LRplot" function in "iTALK", you can replase the corresponding parameters by the created object "genes_matrix" to get the correct circos plot.

For detailed information, please view my codes:
https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot
When you've got your object "res" as the tutorial points, just run my codes and you'll get the plot.

It seems that the link has sth wrong.
just paste the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot" in your chrome and you'll get the code.

XinYu-pumch

XinYu-pumch commented on Jul 17, 2020

@XinYu-pumch

Reply to dlmatera:
If you want to find the pairs in all of your cell types, just run my code below.

deg_list=list()
for (cell in unique(iTalk_data$cell_type)) {
t <- DEG(iTalk_data %>% filter(cell_type==cell),method='DESeq2',contrast=c('BD', 'HC'))
deg_list[[cell]]=t
}
deglist=do.call(rbind,deg_list)

res<-NULL
for(comm_type in comm_list){
res_cat<-FindLR(deglist, datatype='DEG',comm_type=comm_type)
#res_cat<-FindLR(deg_t, datatype='DEG',comm_type=comm_type)
res<-rbind(res,res_cat)
}
res <- na.omit(res)
res<-res[order(abs(res$cell_from_logFC*res$cell_to_logFC),decreasing=T),]

Then use the code in the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot"
to get the circos plot.

XiaofeiSunUCSF

XiaofeiSunUCSF commented on Jul 17, 2020

@XiaofeiSunUCSF
XiaofeiSunUCSF

XiaofeiSunUCSF commented on Jul 17, 2020

@XiaofeiSunUCSF

Reply to dlmatera:
If you want to find the pairs in all of your cell types, just run my code below.

deg_list=list()
for (cell in unique(iTalk_data$cell_type)) {
t <- DEG(iTalk_data %>% filter(cell_type==cell),method='DESeq2',contrast=c('BD', 'HC'))
deg_list[[cell]]=t
}
deglist=do.call(rbind,deg_list)

res<-NULL
for(comm_type in comm_list){
res_cat<-FindLR(deglist, datatype='DEG',comm_type=comm_type)
#res_cat<-FindLR(deg_t, datatype='DEG',comm_type=comm_type)
res<-rbind(res,res_cat)
}
res <- na.omit(res)
res<-res[order(abs(res$cell_from_logFC*res$cell_to_logFC),decreasing=T),]

Then use the code in the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot"
to get the circos plot.

Forget my last message. I figured it out finally.
BTW, I like your github repositories!

XinYu-pumch

XinYu-pumch commented on Jul 17, 2020

@XinYu-pumch

Reply to dlmatera:
If you want to find the pairs in all of your cell types, just run my code below.
deg_list=list()
for (cell in unique(iTalk_data$cell_type)) {
t <- DEG(iTalk_data %>% filter(cell_type==cell),method='DESeq2',contrast=c('BD', 'HC'))
deg_list[[cell]]=t
}
deglist=do.call(rbind,deg_list)
res<-NULL
for(comm_type in comm_list){
res_cat<-FindLR(deglist, datatype='DEG',comm_type=comm_type)
#res_cat<-FindLR(deg_t, datatype='DEG',comm_type=comm_type)
res<-rbind(res,res_cat)
}
res <- na.omit(res)
res<-res[order(abs(res$cell_from_logFC*res$cell_to_logFC),decreasing=T),]
Then use the code in the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot"
to get the circos plot.

Forget my last message. I figured it out finally.
BTW, I like your github repositories!

It's my pleasure that my code can help you.

The plots will be totally different when you set different "order".
If you set "order = NULL", you will find that the arrows in the circos plot may point to the wrong targets.
You can try different "res" to get the results, and you will find that it's just coincidence that there is no diffenence between "order = NULL" and "order=genes_matrix$genes_2".

We can discuss if you have other problems :)

(But I cannot reply as soon as possible due to different time zones. It's Beijing time zone here and now I'm going to sleep ......

XiaofeiSunUCSF

XiaofeiSunUCSF commented on Jul 17, 2020

@XiaofeiSunUCSF

Reply to dlmatera:
If you want to find the pairs in all of your cell types, just run my code below.

deg_list=list()
for (cell in unique(iTalk_data$cell_type)) {
t <- DEG(iTalk_data %>% filter(cell_type==cell),method='DESeq2',contrast=c('BD', 'HC'))
deg_list[[cell]]=t
}
deglist=do.call(rbind,deg_list)

res<-NULL
for(comm_type in comm_list){
res_cat<-FindLR(deglist, datatype='DEG',comm_type=comm_type)
#res_cat<-FindLR(deg_t, datatype='DEG',comm_type=comm_type)
res<-rbind(res,res_cat)
}
res <- na.omit(res)
res<-res[order(abs(res$cell_from_logFC*res$cell_to_logFC),decreasing=T),]

Then use the code in the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot"
to get the circos plot.

Have you tried "cell_col=" function? I just curious why the cell color disappeared(cell color, not gene color) after I assign colors to "cell_col=" ?

XiaofeiSunUCSF

XiaofeiSunUCSF commented on Jul 17, 2020

@XiaofeiSunUCSF

Reply to dlmatera:
If you want to find the pairs in all of your cell types, just run my code below.
deg_list=list()
for (cell in unique(iTalk_data$cell_type)) {
t <- DEG(iTalk_data %>% filter(cell_type==cell),method='DESeq2',contrast=c('BD', 'HC'))
deg_list[[cell]]=t
}
deglist=do.call(rbind,deg_list)
res<-NULL
for(comm_type in comm_list){
res_cat<-FindLR(deglist, datatype='DEG',comm_type=comm_type)
#res_cat<-FindLR(deg_t, datatype='DEG',comm_type=comm_type)
res<-rbind(res,res_cat)
}
res <- na.omit(res)
res<-res[order(abs(res$cell_from_logFC*res$cell_to_logFC),decreasing=T),]
Then use the code in the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot"
to get the circos plot.

Forget my last message. I figured it out finally.
BTW, I like your github repositories!

It's my pleasure that my code can help you.

The plots will be totally different when you set different "order".
If you set "order = NULL", you will find that the arrows in the circos plot may point to the wrong targets.
You can try different "res" to get the results, and you will find that it's just coincidence that there is no diffenence between "order = NULL" and "order=genes_matrix$genes_2".

We can discuss if you have other problems :)

(But I cannot reply as soon as possible due to different time zones. It's Beijing time zone here and now I'm going to sleep ......

Yes, I also realized the wrong arrow pointing to.
Thank you for your help! I guess it's already 3am in Beijing....You work so hard

XinYu-pumch

XinYu-pumch commented on Jul 19, 2020

@XinYu-pumch

Reply to dlmatera:
If you want to find the pairs in all of your cell types, just run my code below.
deg_list=list()
for (cell in unique(iTalk_data$cell_type)) {
t <- DEG(iTalk_data %>% filter(cell_type==cell),method='DESeq2',contrast=c('BD', 'HC'))
deg_list[[cell]]=t
}
deglist=do.call(rbind,deg_list)
res<-NULL
for(comm_type in comm_list){
res_cat<-FindLR(deglist, datatype='DEG',comm_type=comm_type)
#res_cat<-FindLR(deg_t, datatype='DEG',comm_type=comm_type)
res<-rbind(res,res_cat)
}
res <- na.omit(res)
res<-res[order(abs(res$cell_from_logFC*res$cell_to_logFC),decreasing=T),]
Then use the code in the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot"
to get the circos plot.

Forget my last message. I figured it out finally.
BTW, I like your github repositories!

It's my pleasure that my code can help you.
The plots will be totally different when you set different "order".
If you set "order = NULL", you will find that the arrows in the circos plot may point to the wrong targets.
You can try different "res" to get the results, and you will find that it's just coincidence that there is no diffenence between "order = NULL" and "order=genes_matrix$genes_2".
We can discuss if you have other problems :)
(But I cannot reply as soon as possible due to different time zones. It's Beijing time zone here and now I'm going to sleep ......

Yes, I also realized the wrong arrow pointing to.
Thank you for your help! I guess it's already 3am in Beijing....You work so hard

I've found another way to get the circos plot with appropriate colors.
The codes are based on https://www.jianshu.com/p/b589bc23d7a0.
You can find the code in “https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat%E4%B8%8B%E6%B8%B8%E5%88%86%E6%9E%90/iTALK%E7%9A%84res%E7%BB%98%E5%9B%BE%EF%BC%9Acircos%20plot”
When you get your "res" object, just run the code.

XiaofeiSunUCSF

XiaofeiSunUCSF commented on Jul 20, 2020

@XiaofeiSunUCSF

Reply to dlmatera:
If you want to find the pairs in all of your cell types, just run my code below.
deg_list=list()
for (cell in unique(iTalk_data$cell_type)) {
t <- DEG(iTalk_data %>% filter(cell_type==cell),method='DESeq2',contrast=c('BD', 'HC'))
deg_list[[cell]]=t
}
deglist=do.call(rbind,deg_list)
res<-NULL
for(comm_type in comm_list){
res_cat<-FindLR(deglist, datatype='DEG',comm_type=comm_type)
#res_cat<-FindLR(deg_t, datatype='DEG',comm_type=comm_type)
res<-rbind(res,res_cat)
}
res <- na.omit(res)
res<-res[order(abs(res$cell_from_logFC*res$cell_to_logFC),decreasing=T),]
Then use the code in the "https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat下游分析/iTALK-LRplot"
to get the circos plot.

Forget my last message. I figured it out finally.
BTW, I like your github repositories!

It's my pleasure that my code can help you.
The plots will be totally different when you set different "order".
If you set "order = NULL", you will find that the arrows in the circos plot may point to the wrong targets.
You can try different "res" to get the results, and you will find that it's just coincidence that there is no diffenence between "order = NULL" and "order=genes_matrix$genes_2".
We can discuss if you have other problems :)
(But I cannot reply as soon as possible due to different time zones. It's Beijing time zone here and now I'm going to sleep ......

Yes, I also realized the wrong arrow pointing to.
Thank you for your help! I guess it's already 3am in Beijing....You work so hard

I've found another way to get the circos plot with appropriate colors.
The codes are based on https://www.jianshu.com/p/b589bc23d7a0.
You can find the code in “https://github.com/XinYu-pumch/bioinformatics/blob/master/seurat%E4%B8%8B%E6%B8%B8%E5%88%86%E6%9E%90/iTALK%E7%9A%84res%E7%BB%98%E5%9B%BE%EF%BC%9Acircos%20plot”
When you get your "res" object, just run the code.

Great! Thank you!

XinYu-pumch

XinYu-pumch commented on Dec 15, 2020

@XinYu-pumch
liaoshengyou

liaoshengyou commented on Feb 18, 2021

@liaoshengyou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @liaoshengyou@XiaofeiSunUCSF@XinYu-pumch@dlmatera

        Issue actions

          Potential error in FindLR for datatype = 'DEG' ? · Issue #19 · Coolgenome/iTALK