zakandrewking / escher

Build, share, and embed visualizations of metabolic pathways.
https://escher.github.io
Other
210 stars 78 forks source link

Question on using gene_data for Builder() in python API #329

Closed forestrywhale closed 4 years ago

forestrywhale commented 4 years ago

Hi, I aware that this might looks similar to one other question on using reaction_scale and gene_data option in python API, but I'm having trouble understanding how it works.

I am not sure how to implement compared gene data using the Builder.opitions.gene_data. I generated a dictionary like:

mydict = {
    "condition 1": {gene1: 2.2, gene2: 2.2...},
    "condition 2": {gene1: 2.2, gene2: 2.2...}
}

But if I use both conditions, the graph would give me all blank pathways, for now I only figured out way to use one condition is adding gene_data = mydict["condition 1"] to Builder(), in this case, how can I map two conditions on the pathways?

zakandrewking commented 4 years ago

With multiple conditions, Eschers expect a list. I think what you're looking for is:

mydata = [
    {gene1: 2.2, gene2: 2.2...}, # "condition 1"
    {gene1: 2.2, gene2: 2.2...}, # "condition 2"
]
forestrywhale commented 4 years ago

Thank you so much! I'll try that.

forestrywhale commented 4 years ago

This is exactly what I needed!