decoupler-py icon indicating copy to clipboard operation
decoupler-py copied to clipboard

CytoSig resource providing incorrect data

Open adamgayoso opened this issue 2 years ago • 2 comments

Describe the bug It's unclear what the CytoSig resource is outputting. For example,

res = dc.get_resource('CytoSig')
res

Provides a DataFrame with this info

Screen Shot 2022-09-26 at 3 15 00 PM

which has 36 unique cytokines.

Meanwhile going to the cytosig repo and downloading their data

pd.read_csv("https://raw.githubusercontent.com/data2intelligence/CytoSig/master/CytoSig/signature.centroid", sep="\t")

provides 43 columns (cytokines, and with completely different names than the resource code above, but with names that make a lot more sense)

Screen Shot 2022-09-26 at 3 17 00 PM

adamgayoso avatar Sep 26 '22 22:09 adamgayoso

Hi @adamgayoso,

Thanks for checking out the package! This seems like a problem coming from omnipath, that instead of returning gene names it returns protein ids from Uniprot. @deeenes could you take a look?

In the meantime you could use the original csv and transform it into a long-format data-frame with df.melt() so that it can be used by decoupler.

PauBadiaM avatar Sep 27 '22 16:09 PauBadiaM

Those are the same cytokines but by UniProt IDs. We do this because using UniProt IDs in general is less ambiguous and thus results less data loss than using gene symbols. The footprint genes are also shown primarily by UniProts, only Decoupler removes that column as it uses gene symbols.

In the CytoSig annotations we could actually leave the gene symbols in place, or have them along with the UniProt IDs. I will also check whether we are indeed missing 7 cytokines.

deeenes avatar Sep 30 '22 10:09 deeenes

Hey @deeenes, any update on this? :)

dbdimitrov avatar Apr 04 '23 09:04 dbdimitrov

Yes @dbdimitrov, You're asking in the best moment :)

2 weeks ago I had a look into this issue, and this week I rebuilt and updated the OmniPath instance in the web service. You see above the two commits where I changed the processing of CytoSig. There were a handful of genes where the ID translation was problematic. For five cytokines with non-standard gene names, I had to adjust the translation manually. Now all cytokines are translated without ambiguity, except two, IFN1 and NO. The former is supposed to be a family of proteins, while the latter is just nitrogen-monoxide. I also included the original gene symbols in OmniPath data (cytokine_genesymbol and target_genesymbol columns), but these have the few non-standard names, e.g. Activin A. Translated cytokine gene symbols I didn't include, but it's possible to add them by translating from UniProts in the cytokine column. Let me know if I should make these available too:

library(OmnipathR)
library(dplyr)

cytosig <- 
	import_omnipath_annotations(resources = 'CytoSig', wide = TRUE) %>%
    translate_ids(cytokine = uniprot, translated_cytokine_genesymbol = genesymbol)
import omnipath
from pypath.utils import mapping

cytosig = omnipath.requests.Annotations.get(resources = 'CytoSig', wide = True)
up_gs = mapping.translation_df('uniprot', 'genesymbol')
# look at the ugly pandas syntax...
cytosig = cytosig.merge(
    up_gs,
    left_on = ['cytokine'],
    right_on = ['uniprot'],
    suffixes = ('', '_y'),
).rename(
    {'genesymbol_y': 'translated_cytokine_genesymbol'},
    axis = 1,
).drop(
    'uniprot_y',
    axis = 1,
)

With these adjustments I think we need no change in Decoupler. Among the targets there are some ambiguity, but this is what we can not avoid with gene symbols; 0.5% of the records are affected.

Note: either with OmnipathR or Python omnipath package, please don't forget to wipe the cache.

deeenes avatar Apr 05 '23 15:04 deeenes

Hey @deeenes,

This looks great. I will have a more detailed look these days & will come back to you in case I notice anything.

For my use case, missing IFN1& NO is not a big deal. Though I wonder if their addition (e.g. having NO map to an hmdb ID & a tupple with all uniprot IDs for IFN1) would be useful for others @PauBadiaM @adamgayoso?

I can provide you with the list of gene symbols that I had as part of the IFN1 family.

Thanks a lot! Daniel

dbdimitrov avatar Apr 11 '23 09:04 dbdimitrov

I think CytoSig is fine already also in the web service, so I'm closing this one

deeenes avatar Oct 06 '23 13:10 deeenes