Commit 5456be43 authored by Eric CHARPENTIER's avatar Eric CHARPENTIER 🐍
Browse files
parents 1ec38943 dcf94c2a
......@@ -255,11 +255,11 @@ for c in conditionVS:
table['geneID'] = newGeneID
# We add some columns
precision = 5
table = table.assign(GenesInQuery = [int(q[1]) for q in table['GeneRatio'].str.split("/")])
table = table.assign(GenesInTermBackground = [int(q[0]) for q in table['BgRatio'].str.split("/")])
table = table.assign(GenesInOntologyBackground = [int(q[1]) for q in table['BgRatio'].str.split("/")])
table = table.assign(GeneQueryRatio = table['Count']/table['GenesInQuery'])
table = table.assign(GeneTermRatio = table['Count']/table['GenesInTermBackground'])
table = table.assign(GeneQueryRatio = round(table['Count']/table['GenesInQuery'], precision))
table = table.assign(GeneTermRatio = round(table['Count']/table['GenesInTermBackground'], precision))
# Format in scientific notation until we found a way in DataTable
table['pvalue'] = [str("%.2e" % s) for s in table['pvalue']]
table['p.adjust'] = [str("%.2e" % s) for s in table['p.adjust']]
......@@ -269,9 +269,9 @@ for c in conditionVS:
table = table.rename(columns={'GeneRatio': 'GeneQueryRatio', 'pvalue' : 'pval', 'p.adjust' : 'padj', 'qvalue':'qval'})
# We select and order interesting columns
if annot == "annotGo":
table = table[['ONTOLOGY', 'ID', 'GeneTermRatio', 'GeneQueryRatio', 'pval', 'padj', 'qval', 'Description', 'Count', 'GenesInQuery', 'GenesInTermBackground', 'GenesInOntologyBackground', 'geneID']]
table = table[['ONTOLOGY', 'ID', 'GeneTermRatio', 'GeneQueryRatio', 'pval', 'padj', 'qval', 'Description', 'Count', 'GenesInQuery', 'GenesInTermBackground', 'geneID']]
else:
table = table[['ID', 'GeneTermRatio', 'GeneQueryRatio', 'pval', 'padj', 'qval', 'Description', 'Count', 'GenesInQuery', 'GenesInTermBackground', 'GenesInOntologyBackground', 'geneID']]
table = table[['ID', 'GeneTermRatio', 'GeneQueryRatio', 'pval', 'padj', 'qval', 'Description', 'Count', 'GenesInQuery', 'GenesInTermBackground', 'geneID']]
# We export them
templateVars["deseqres"][c["condition1"]+"__vs__"+c["condition2"]][annot] = dataframe_to_list_of_dicts(table)
......@@ -328,7 +328,6 @@ for c in conditionVS:
g["number_of_genes_in_background"] = ls[3]
g["gene_ratio"] = str("%.2f" % (int(ls[2]) / int(ls[3])))
g["ncbiTaxonId"] = ls[4]
g["inputGenes"] = ', '.join(ls[5].split(','))
gc = []
for g1, g2 in zip(ls[5].split(','), ls[6].split(',')):
fc = templateVars["deseqres"][c["condition1"]+"__vs__"+c["condition2"]]["fc"][g1]
......@@ -343,7 +342,6 @@ for c in conditionVS:
sign = ""
gc.append('<font color="{}">{}</font>'.format(color, g2))
g["coloredPreferredNames"] = ', '.join(gc)
g["preferredNames"] = ', '.join(ls[6].split(','))
g["p_value"] = ls[7]
g["fdr"] = ls[8]
g["description"] = ls[9]
......
......@@ -323,7 +323,6 @@
<th>Description</th>
<th>GenesInQuery</th>
<th>GenesInTermBackground</th>
<th>GenesInOntologyBackground"</th>
<th>geneID</th>
</tr>
</thead>
......@@ -360,7 +359,6 @@
<th>Description</th>
<th>GenesInQuery</th>
<th>GenesInTermBackground</th>
<th>GenesInOntologyBackground"</th>
<th>geneID</th>
</tr>
</thead>
......@@ -436,8 +434,6 @@
<th>Term</th>
<th>Count</th>
<th>Ratio&nbsp;of genes&nbsp;in&nbsp;term</th>
<th>inputGenes</th>
<th>preferredNames</th>
<th>pvalue</th>
<th>fdr</th>
<th>Description</th>
......@@ -630,7 +626,7 @@
function gen_stringdb_table(table_id, comp){
var table = $('#'+table_id).DataTable({
"order": [[ 8, "asc" ]],
"order": [[ 6, "asc" ]],
"data":{{stringParams}}[comp]["enrich"],
"columns":[
{
......@@ -643,18 +639,10 @@
{"data":"term"},
{"data":"number_of_genes"},
{"data":"gene_ratio"},
{"data":"inputGenes"},
{"data":"preferredNames"},
{"data":"p_value"},
{"data":"fdr"},
{"data":"description"}
],
"columnDefs": [
{
"targets": [ 5, 6 ],
"visible": false
}
],
"initComplete": function () {
this.api().columns([1]).every( function () {
var column = this;
......@@ -733,12 +721,11 @@
{"data":"Description"},
{"data":"GenesInQuery", render: $.fn.dataTable.render.number( ' ', '.', 2)},
{"data":"GenesInTermBackground", render: $.fn.dataTable.render.number( ' ', '.', 2)},
{"data":"GenesInOntologyBackground", render: $.fn.dataTable.render.number( ' ', '.', 2)},
{"data":"geneID"}
],
"columnDefs": [
{
"targets": [ 10, 11, 12, 13 ],
"targets": [ 10, 11, 12 ],
"visible": false
}
],
......@@ -801,12 +788,11 @@
{"data":"Description"},
{"data":"GenesInQuery", render: $.fn.dataTable.render.number( ' ', '.', 2)},
{"data":"GenesInTermBackground", render: $.fn.dataTable.render.number( ' ', '.', 2)},
{"data":"GenesInOntologyBackground", render: $.fn.dataTable.render.number( ' ', '.', 2)},
{"data":"geneID"}
],
"columnDefs": [
{
"targets": [ 9, 10, 11, 12 ],
"targets": [ 9, 10, 11 ],
"visible": false
}
]});
......
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