Commit e404dd87 authored by Eric CHARPENTIER's avatar Eric CHARPENTIER 🐍
Browse files

Merge branch 'fix-string-report' into 'master'

Update according to StringDB changes

See merge request !34
parents 0d89f00c 85b2036d
...@@ -296,6 +296,10 @@ for c in conditionVS: ...@@ -296,6 +296,10 @@ for c in conditionVS:
# Building functional enrichment table # Building functional enrichment table
templateVars["stringParams"][c["condition1"]+"__vs__"+c["condition2"]]["enrich"] = list() templateVars["stringParams"][c["condition1"]+"__vs__"+c["condition2"]]["enrich"] = list()
count = 0 count = 0
# When enchiched gene list contains 1 gene, the inputGenes list is completed by string with some no DE genes
# We must check them
DEgenes = [x["Gene"] for x in templateVars["deseqres"][c["condition1"]+"__vs__"+c["condition2"]]["genes"]]
# Opening of StringDB file # Opening of StringDB file
with open(stringFunctionalEnrichmentFile, "r") as f: with open(stringFunctionalEnrichmentFile, "r") as f:
f.readline() f.readline()
...@@ -305,11 +309,12 @@ for c in conditionVS: ...@@ -305,11 +309,12 @@ for c in conditionVS:
g = dict() g = dict()
g["category"] = ls[0] g["category"] = ls[0]
term = ls[1] term = ls[1]
id = ls[1].split('.') id = ls[1].split(':')
category = id[0] category = id[0]
uid = '.'.join(id[1:]) uid = '.'.join(id[1:])
taxa = ls[4]
if g["category"] in ["Component", "Process", "Function"]: if g["category"] in ["Component", "Process", "Function"]:
term = '<a href="http://amigo.geneontology.org/amigo/term/GO:{}" target="_blank">{}</a>'.format(uid, term) term = '<a href="http://amigo.geneontology.org/amigo/term/{}" target="_blank">{}</a>'.format(term, term)
if g["category"] == "InterPro": if g["category"] == "InterPro":
term = '<a href="https://www.ebi.ac.uk/interpro/entry/{}" target="_blank">{}</a>'.format(term, term) term = '<a href="https://www.ebi.ac.uk/interpro/entry/{}" target="_blank">{}</a>'.format(term, term)
if g["category"] == 'KEGG': if g["category"] == 'KEGG':
...@@ -324,20 +329,26 @@ for c in conditionVS: ...@@ -324,20 +329,26 @@ for c in conditionVS:
term = '<a href="https://reactome.org/content/detail/R-{}" target="_blank">{}</a>'.format(term, term) term = '<a href="https://reactome.org/content/detail/R-{}" target="_blank">{}</a>'.format(term, term)
if g["category"] == 'SMART': if g["category"] == 'SMART':
term = '<a href="http://smart.embl-heidelberg.de/smart/do_annotation.pl?DOMAIN={}" target="_blank">{}</a>'.format(term, term) term = '<a href="http://smart.embl-heidelberg.de/smart/do_annotation.pl?DOMAIN={}" target="_blank">{}</a>'.format(term, term)
if g["category"] == 'NetworkNeighborAL':
term = '<a href="https://string-db.org/cgi/network?network_cluster_id={}&input_query_species={}" target="_blank">{}</a>'.format(term, taxa, term)
g["term"] = term g["term"] = term
g["number_of_genes"] = ls[2] g["number_of_genes"] = ls[2]
g["number_of_genes_in_background"] = ls[3] g["number_of_genes_in_background"] = ls[3]
g["gene_ratio"] = str("%.2f" % (int(ls[2]) / int(ls[3]))) g["gene_ratio"] = str("%.2f" % (int(ls[2]) / int(ls[3])))
g["ncbiTaxonId"] = ls[4] g["ncbiTaxonId"] = taxa
gc = [] gc = []
for g1, g2 in zip(ls[5].split(','), ls[6].split(',')): for g1, g2 in zip(ls[5].split(','), ls[6].split(',')):
fc = templateVars["deseqres"][c["condition1"]+"__vs__"+c["condition2"]]["fc"][g1] if g1 in DEgenes: # We must check if inputGenes are DE genes
if fc < 0: fc = templateVars["deseqres"][c["condition1"]+"__vs__"+c["condition2"]]["fc"][g1]
color = "green" if fc < 0:
sign = "+" color = "green"
elif fc > 0: sign = "+"
color = "red" elif fc > 0:
sign = "-" color = "red"
sign = "-"
else:
color = "grey"
sign = ""
else: else:
color = "grey" color = "grey"
sign = "" sign = ""
......
...@@ -419,7 +419,8 @@ ...@@ -419,7 +419,8 @@
UniProt Keywords (Keyword), UniProt Keywords (Keyword),
PFAM Protein Domains (Pfam), PFAM Protein Domains (Pfam),
INTERPRO Protein Domains and Features (InterPro), INTERPRO Protein Domains and Features (InterPro),
SMART Protein Domains (SMART). SMART Protein Domains (SMART),
String Local Network Cluster (NetworkNeighborAL).
</p> </p>
{% if stringParams[i.condition1+"__vs__"+i.condition2].counts == 0 %} {% if stringParams[i.condition1+"__vs__"+i.condition2].counts == 0 %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment