Teichlab / cellphonedb

MIT License
338 stars 105 forks source link

Download the result from website #314

Closed bioguy2018 closed 3 years ago

bioguy2018 commented 3 years ago

Dear all, I have a very simple and maybe naive question. I am interested in running a list of ligands and get the possible receptors for without loading any count data. It is easily done through the website but I didn't find any option to download the result! How can I do it? Is it possible to run such task though the package? I didn't see any example for it!

Thanks

prete commented 3 years ago

Hi @bioguy2018 you can get the same information using the package's query find_interactions_by_element command:

cellphonedb query find_interactions_by_element FAS,TNF,FASLG,TNFSF13B,CD40

If you've got single column file (like the example from the website ligands_receptors_sample.txt) you can use this bit of bash to use it as input:

cellphonedb query find_interactions_by_element $(cat ligands_receptors_sample.txt | paste -sd "," -)

To get the output to a csv file you can simply redirect the output > interactions.csv and then cleanup the header of the resulting CSV because it'll have part of the log. Alternatively, you can run something like this to do all at once:

cellphonedb query find_interactions_by_element --quiet $(cat ligands_receptors_sample.txt | paste -sd "," -) | grep -v "^\[" > interactions.csv
prete commented 3 years ago

Note: in case you're on windows just do this and then cleanup the top part of the file manually:

cellphonedb query find_interactions_by_element --quiet FAS,TNF,FASLG,TNFSF13B,CD40 > interactions.csv
bioguy2018 commented 3 years ago

Dear Prete, Thank you so much for the information about how to run this particular task through command! I will definitely use it in future. meanwhile that I wrote the question I did try to download the table using an import function provided in google sheet and it actually worked too.

Thanks again and Kind Regards