liuqivandy / SpaGene

16 stars 1 forks source link

How to get location information and mouse ligand receptor pair information? #5

Closed maqingyue closed 1 year ago

maqingyue commented 1 year ago

Hi, I'm trying to use my own spatial transcriptome data for SpaGene analysis. How do I get the location information? I don't know whether the imageow, imagecol and gene extracted in the seurat data format correspond to each other, or can you tell me how to extract them?

In addition, you use human ligand receptor pair data in the tutorial. Is there any mouse ligand receptor pair data that can be shared? Or is it the same library for humans and mice? I don't know much about it.

I'm looking forward to your reply, thanks!

maqingyue commented 1 year ago

To add, my data is the integrated data of six samples, and the tutorial is a sample. I don't know if it has any impact.

liuqivandy commented 1 year ago

Imagerow and imagecol is the location. You can use any ligand-receptor pair. There are many databases available. What I used is celltalkdb. http://tcm.zju.edu.cn/celltalkdb/ Best, Qi

From: maqingyue @.> Date: Wednesday, February 22, 2023 at 2:25 AM To: liuqivandy/SpaGene @.> Cc: Subscribed @.***> Subject: [liuqivandy/SpaGene] How to get location information and mouse ligand receptor pair information? (Issue #5)

Hi, I'm trying to use my own spatial transcriptome data for SpaGene analysis. How do I get the location information? I don't know whether the imageow, imagecol and gene extracted in the seurat data format correspond to each other, or can you tell me how to extract them?

In addition, you use human ligand receptor pair data in the tutorial. Is there any mouse ligand receptor pair data that can be shared? Or is it the same library for humans and mice? I don't know much about it.

I'm looking forward to your reply, thanks!

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliuqivandy%2FSpaGene%2Fissues%2F5&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7C3906a2c39e214c4cbf9608db14ae5378%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638126511200200904%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=b8aMBxQWG%2BVob%2BHrUUg43w7pc7EouLmBJYEJC%2BaejeM%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIH2RCMQSOFIEUNJB5DT6Q3WYXEOXANCNFSM6AAAAAAVEAGHUM&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7C3906a2c39e214c4cbf9608db14ae5378%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638126511200200904%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VKSR6SvE0ipPSDBaNfswQRha5vEmVm8yQAlIhTxP%2Fm0%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>

maqingyue commented 1 year ago

I wrote a piece of code to extract localiaon. Is the extraction method correct?

dimname <- sample@assays[["Spatial"]]@data@Dimnames[[2]] imagecol <- seurat_obj@meta.data[["imagecol"]] imagerow <- seurat_obj@meta.data[["imagerow"]] location <- data.frame(dimname, imagecol, imagerow) rownames(location) <- location[,1] location <- location[,-1]

My data is the integrated data of six samples, and the tutorial is a sample. I don't know if it has any impact. The pattern information I get is shown in the figure below. Each pattern is the superposition of six sample images. What I want is to display the pattern on each sample image.

fig

liuqivandy commented 1 year ago

Seurat has the function to extract the location GetTissueCoordinates

From: maqingyue @.> Date: Wednesday, February 22, 2023 at 7:09 PM To: liuqivandy/SpaGene @.> Cc: Liu, Qi (University) @.>, Comment @.> Subject: Re: [liuqivandy/SpaGene] How to get location information and mouse ligand receptor pair information? (Issue #5)

I wrote a piece of code to extract localiaon. Is the extraction method correct?

dimname <- @.**@*.**@*.[[2]] imagecol <- @*.**@*.>[["imagecol"]] imagerow <- @*.**@*.***>[["imagerow"]] location <- data.frame(dimname, imagecol, imagerow) rownames(location) <- location[,1] location <- location[,-1]

My data is the integrated data of six samples, and the tutorial is a sample. I don't know if it has any impact. The pattern information I get is shown in the figure below. Each pattern is the superposition of six sample images. What I want is to display the pattern on each sample image.

[fig]https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fuser-images.githubusercontent.com%2F113956599%2F220799651-0e63eb35-1f0e-43ae-b482-97a2456e6140.png&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7Ccb44bee2b0fe497b468d08db153aa3d0%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127113844475362%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=LdhwzpNrw%2FvzXTvJFor7Xgtkub75g84WVQ88YCIYSEU%3D&reserved=0

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliuqivandy%2FSpaGene%2Fissues%2F5%23issuecomment-1441097870&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7Ccb44bee2b0fe497b468d08db153aa3d0%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127113844475362%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=gw5Ut9uPaAbEKl65bs6tCYz%2FtMX0eJgwJ61wbfSzEj4%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIH2RCPCBFUYBRTC36AY22LWY22FHANCNFSM6AAAAAAVEAGHUM&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7Ccb44bee2b0fe497b468d08db153aa3d0%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127113844631598%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=834VVGHaDwBphWT3XjlyCnFt8Bp75AYUBPUmtL3aJ%2BE%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

maqingyue commented 1 year ago

Thank you very much. I have got the data of mouse ligand receptor pairs and know how to extract the location. But when doing SpaGene with the counts matrix I extracted, the error is reported as follows:

Error in SpaGene(counts, location) : the ncol of expr should match the nrow of location

My code is as follows:

location <- GetTissueCoordinates(seurat_obj) counts <- GetAssayData(object = seurat_obj, slot = "counts") bc_spagene<-SpaGene(counts,location)

liuqivandy commented 1 year ago

Please check dim(counts) and dim(location), the ncol of counts should match the nrow of location

From: maqingyue @.> Date: Wednesday, February 22, 2023 at 8:13 PM To: liuqivandy/SpaGene @.> Cc: Liu, Qi (University) @.>, Comment @.> Subject: Re: [liuqivandy/SpaGene] How to get location information and mouse ligand receptor pair information? (Issue #5)

Thank you very much. I have got the data of mouse ligand receptor pairs and know how to extract the location. But when doing SpaGene with the counts matrix I extracted, the error is reported as follows:

Error in SpaGene(counts, location) : the ncol of expr should match the nrow of location

My code is as follows:

location <- GetTissueCoordinates(seurat_obj) counts <- GetAssayData(object = seurat_obj, slot = "counts") bc_spagene<-SpaGene(counts,location)

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliuqivandy%2FSpaGene%2Fissues%2F5%23issuecomment-1441133669&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7C6286e4aa0a944fc22d4a08db1543885f%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127152011102656%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=7%2FJVR4gKQ84mlJ0paxW2hY09GxHawTT%2FsFsZ4OSkeUQ%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIH2RCKLFG7JWPA42FRDZRTWY3BT7ANCNFSM6AAAAAAVEAGHUM&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7C6286e4aa0a944fc22d4a08db1543885f%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127152011258889%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=R0DreRLDcu7p2Iq3F93Ij5kQH84V6xJuYI%2BXwtef3ao%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

maqingyue commented 1 year ago

It doesn't seem to match, but I can't find the reason.

dim(counts) [1] 16516 6762 dim(location) [1] 961 2

liuqivandy commented 1 year ago

This is only for one spatial transcriptomics data. If you have multiple spatial omics data, please follow the tutorial how to deal with multiple spatial omics data.

From: maqingyue @.> Date: Wednesday, February 22, 2023 at 8:20 PM To: liuqivandy/SpaGene @.> Cc: Liu, Qi (University) @.>, Comment @.> Subject: Re: [liuqivandy/SpaGene] How to get location information and mouse ligand receptor pair information? (Issue #5)

It doesn't seem to match, but I can't find the reason.

dim(counts) [1] 16516 6762 dim(location) [1] 961 2

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliuqivandy%2FSpaGene%2Fissues%2F5%23issuecomment-1441137701&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7Cb1646693554a416cb91408db1544779c%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127156030501640%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=PVzSTA4Uavp0uU204veZ8spJduSA%2BDeKhd9RWQfV1ws%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIH2RCORZVFXMGNS7XXI5MTWY3CNBANCNFSM6AAAAAAVEAGHUM&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7Cb1646693554a416cb91408db1544779c%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127156030501640%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=6LvxB9gX80mBbxTUfKo%2B0pejl9F%2BP32qEITq9V3Swx0%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

maqingyue commented 1 year ago

Ok, I have found your multi-sample tutorial. Thank you very much for your patience. Have a good day.

Sincerely, Qingyue Ma

maqingyue commented 1 year ago

Hi, there is no recognition of co-located ligand-receptor pairs in the multi-sample tutorial (https://htmlpreview.github.io/?https://github.com/liuqivandy/SpaGene/blob/master/Tutorial/mb_anterior_posterior.html). I tried to use this code, but it didn't work. Can you give me some suggestions?

countlist<-list(count1,count2,count3) locationlist<-list(location1[,2:1],location2[,2:1],location3[,2:1]) bc_lr<-SpaGene_LR(countlist,locationlist,LRpair=LRpair)

liuqivandy commented 1 year ago

Please follow the tutorials on multiple samples. You cannot combine location unless the location from one sample to another has some meaning.

From: maqingyue @.> Date: Wednesday, February 22, 2023 at 10:56 PM To: liuqivandy/SpaGene @.> Cc: Liu, Qi (University) @.>, Comment @.> Subject: Re: [liuqivandy/SpaGene] How to get location information and mouse ligand receptor pair information? (Issue #5)

Hi, there is no recognition of co-located ligand-receptor pairs in the multi-sample tutorial (https://htmlpreview.github.io/?https://github.com/liuqivandy/SpaGene/blob/master/Tutorial/mb_anterior_posterior.htmlhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fhtmlpreview.github.io%2F%3Fhttps%3A%2F%2Fgithub.com%2Fliuqivandy%2FSpaGene%2Fblob%2Fmaster%2FTutorial%2Fmb_anterior_posterior.html&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7C0eed2726eaed4baea26f08db155a56d7%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127249975266923%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Fo47sGAP8YZPS4LyuZfTKRFrHvw3HVVgD72%2FJlj8oIU%3D&reserved=0). I tried to use this code, but it didn't work. Can you give me some suggestions?

countlist<-list(count1,count2,count3) locationlist<-list(location1[,2:1],location2[,2:1],location3[,2:1]) bc_lr<-SpaGene_LR(countlist,locationlist,LRpair=LRpair)

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliuqivandy%2FSpaGene%2Fissues%2F5%23issuecomment-1441217964&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7C0eed2726eaed4baea26f08db155a56d7%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127249975266923%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=77VRc1rte78VYUVgvZ6%2Bnjz5KB%2BQCrZ%2F5CMxzRsUbDg%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIH2RCMDRVNQ42GKMKPIG33WY3UYFANCNFSM6AAAAAAVEAGHUM&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7C0eed2726eaed4baea26f08db155a56d7%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127249975423162%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5G7x0irn96K3PpCq8844gcF%2B%2B%2FNYnerKVCHf7nWEbK0%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

maqingyue commented 1 year ago

My three samples belong to biological duplication. I don't know if they are consistent with what you said. Can this location be merged? If it can be combined, how to find the subsequent ligand receptor pairs? This is not mentioned in the multi-sample tutorial. If it cannot be combined, does it need to analyze each sample separately when looking for ligand receptor pairs?

liuqivandy commented 1 year ago

I think it cannot be combined. You can analyze each sample separately.

From: maqingyue @.> Date: Thursday, February 23, 2023 at 6:53 PM To: liuqivandy/SpaGene @.> Cc: Liu, Qi (University) @.>, Comment @.> Subject: Re: [liuqivandy/SpaGene] How to get location information and mouse ligand receptor pair information? (Issue #5)

My three samples belong to biological duplication. I don't know if they are consistent with what you said. Can this location be merged? If it can be combined, how to find the subsequent ligand receptor pairs? This is not mentioned in the multi-sample tutorial. If it cannot be combined, does it need to analyze each sample separately when looking for ligand receptor pairs?

— Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliuqivandy%2FSpaGene%2Fissues%2F5%23issuecomment-1442638466&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7Cea0266e8d3934fb981dc08db160187e6%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127968055554471%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=p77JNMhkGcaxePBLd4MJ9RnevLPz2%2BdG8ZTbKoRgW9E%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAIH2RCPME4HMLS4NXXLVDTTWZABAFANCNFSM6AAAAAAVEAGHUM&data=05%7C01%7Cqi.liu%40vanderbilt.edu%7Cea0266e8d3934fb981dc08db160187e6%7Cba5a7f39e3be4ab3b45067fa80faecad%7C0%7C0%7C638127968055554471%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uc7PdDmJj%2ByepvA7THg7YXQquKoTIs%2FFWo315dn%2BaVU%3D&reserved=0. You are receiving this because you commented.Message ID: @.***>

maqingyue commented 1 year ago

Ok, thanks for your patience.