Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 009c495b authored by Anze Vavpetic's avatar Anze Vavpetic
Browse files

renamed branch to segmine

parent 5aff3025
'''
Bioinformatics interaction viewes.
@author: Anze Vavpetic <anze.vavpetic@ijs.si>
'''
from django.shortcuts import render
def insilico_search(request, input_dict, output_dict, widget):
#TODOl
return render(request, 'interactions/insilico_search.html', {'widget':widget})
'''
Bioinformatics library.
@author: Anze Vavpetic <anze.vavpetic@ijs.si>
'''
def insilico_search(input_dict):
return input_dict
def insilico_finished(input_dict):
#TODO
return input_dict
\ No newline at end of file
import os
package_name = 'bioinformatics'
package_root = os.path.dirname(__file__)
package_statics = os.path.join(os.path.dirname(__file__), 'static', package_name)
package_bin = os.path.join(package_root, 'bin')
auto_update_db = False
create_backups = True
This diff is collapsed.
[
{
"pk": 5,
"model": "workflows.category",
"fields": {
"uid": "d2dfe5ca-7d73-4b4d-b922-b389ec610d99",
"parent": null,
"workflow": null,
"user": null,
"order": 1,
"name": "Orange"
}
},
{
"pk": 49,
"model": "workflows.category",
"fields": {
"uid": "c29ac8e0-5e9a-4058-959e-f51c59eaf58a",
"parent": 5,
"workflow": null,
"user": null,
"order": 1,
"name": "SegMine"
}
},
{
"pk": 217,
"model": "workflows.abstractwidget",
"fields": {
"category": 49,
"treeview_image": "",
"name": "Fold change gene filter",
"is_streaming": false,
"uid": "a0b7e149-066e-4054-874f-4d452e0de507",
"interaction_view": "segmine_fc_gene_filter",
"image": "",
"package": "segmine",
"static_image": "",
"post_interact_action": "segmine_fc_gene_filter_finished",
"user": null,
"visualization_view": "",
"action": "segmine_fc_gene_filter",
"wsdl_method": "",
"wsdl": "",
"interactive": true,
"has_progress_bar": false,
"order": 1,
"description": "Filters the genes according to FC threshold."
}
},
{
"pk": 671,
"model": "workflows.abstractinput",
"fields": {
"widget": 217,
"name": "Orange dataset",
"short_name": "odt",
"uid": "e008b9dd-f90d-477f-9dd0-378f64ff0627",
"default": "",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "dataset",
"parameter": false,
"order": 2,
"description": "Orange dataset"
}
},
{
"pk": 249,
"model": "workflows.abstractoutput",
"fields": {
"widget": 217,
"name": "Orange dataset",
"short_name": "odt",
"variable": "dataset",
"uid": "8768f51e-9404-4e40-842d-71788e2df738",
"order": 1,
"description": "Orange dataset with filtered genes"
}
},
{
"pk": 216,
"model": "workflows.abstractwidget",
"fields": {
"category": 49,
"treeview_image": "",
"name": "Gene Ranker",
"is_streaming": false,
"uid": "34b12afe-e881-447c-90d4-bddcd1cd137b",
"interaction_view": "",
"image": "",
"package": "segmine",
"static_image": "",
"post_interact_action": "",
"user": null,
"visualization_view": "",
"action": "segmine_gene_ranker",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"has_progress_bar": false,
"order": 1,
"description": ""
}
},
{
"pk": 665,
"model": "workflows.abstractinput",
"fields": {
"widget": 216,
"name": "Microarray Table",
"short_name": "ma",
"uid": "73b59971-1839-417c-a937-021ae2d12903",
"default": "",
"required": false,
"multi": false,
"parameter_type": null,
"variable": "microarrayTable",
"parameter": false,
"order": 1,
"description": "Orange data table"
}
},
{
"pk": 666,
"model": "workflows.abstractinput",
"fields": {
"widget": 216,
"name": "Number of neighbours",
"short_name": "k",
"uid": "96947efb-4df1-48f8-8802-ac6bc2e1984b",
"default": "10",
"required": false,
"multi": false,
"parameter_type": "text",
"variable": "k",
"parameter": true,
"order": 2,
"description": ""
}
},
{
"pk": 667,
"model": "workflows.abstractinput",
"fields": {
"widget": 216,
"name": "Reference examples (0 = all)",
"short_name": "m",
"uid": "11fd645a-cf41-4774-98aa-759478c94588",
"default": "0",
"required": false,
"multi": false,
"parameter_type": "text",
"variable": "m",
"parameter": true,
"order": 3,
"description": ""
}
},
{
"pk": 246,
"model": "workflows.abstractoutput",
"fields": {
"widget": 216,
"name": "Gene ranks",
"short_name": "rnk",
"variable": "geneRanks",
"uid": "e3cc4347-d80b-4dbe-9e2c-37f6b0f98671",
"order": 1,
"description": ""
}
},
{
"pk": 247,
"model": "workflows.abstractoutput",
"fields": {
"widget": 216,
"name": "tScores",
"short_name": "t",
"variable": "tScores",
"uid": "677d2177-8ee9-433d-920c-41b57293c601",
"order": 2,
"description": ""
}
},
{
"pk": 218,
"model": "workflows.abstractwidget",
"fields": {
"category": 49,
"treeview_image": "",
"name": "Resolve gene synonyms",
"is_streaming": false,
"uid": "7e60189f-5fb6-42aa-a541-0848b4c5c02d",
"interaction_view": "",
"image": "",
"package": "segmine",
"static_image": "",
"post_interact_action": "",
"user": null,
"visualization_view": "",
"action": "segmine_resolve_gene_synonyms",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"has_progress_bar": false,
"order": 1,
"description": ""
}
},
{
"pk": 672,
"model": "workflows.abstractinput",
"fields": {
"widget": 218,
"name": "gene ranks",
"short_name": "gnr",
"uid": "65250e36-d7e3-4d21-9546-f6a8a72319c6",
"default": "",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "gene_ranks",
"parameter": false,
"order": 1,
"description": "list of pairs (gene, rank)"
}
},
{
"pk": 250,
"model": "workflows.abstractoutput",
"fields": {
"widget": 218,
"name": "gene ranks",
"short_name": "gnr",
"variable": "gene_ranks",
"uid": "9bd0f46d-adec-4a71-8018-9369579083a1",
"order": 1,
"description": "list of pairs (entrez_id, rank)"
}
},
{
"pk": 215,
"model": "workflows.abstractwidget",
"fields": {
"category": 49,
"treeview_image": "",
"name": "T-test gene filter",
"is_streaming": false,
"uid": "90881bcb-4f56-4093-8354-76c2da153cc3",
"interaction_view": "segmine_ttest_gene_filter",
"image": "",
"package": "segmine",
"static_image": "",
"post_interact_action": "segmine_ttest_gene_filter_finished",
"user": null,
"visualization_view": "",
"action": "segmine_ttest_gene_filter",
"wsdl_method": "",
"wsdl": "",
"interactive": true,
"has_progress_bar": false,
"order": 1,
"description": "Filters the genes according to t-test p-value threshold."
}
},
{
"pk": 669,
"model": "workflows.abstractinput",
"fields": {
"widget": 215,
"name": "Orange dataset",
"short_name": "odt",
"uid": "0c22f321-13e3-47e1-b219-a300780570b1",
"default": "",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "dataset",
"parameter": false,
"order": 1,
"description": "Orange dataset"
}
},
{
"pk": 248,
"model": "workflows.abstractoutput",
"fields": {
"widget": 215,
"name": "Orange dataset",
"short_name": "odt",
"variable": "dataset",
"uid": "64cf1c47-7cc4-4c57-ad06-3ffd436cbbf0",
"order": 1,
"description": "Orange dataset with filtered genes"
}
}
]
\ No newline at end of file
'''
Segmine interaction viewes.
@author: Anze Vavpetic <anze.vavpetic@ijs.si>
'''
from django.shortcuts import render
def segmine_ttest_gene_filter(request, input_dict, output_dict, widget):
dataset = input_dict['dataset']
targets = dataset.domain.classVar.values
return render(request, 'interactions/segmine_ttest_gene_filter.html', {'widget':widget, 'targets' : targets, 'default_threshold' : 0.05})
def segmine_fc_gene_filter(request, input_dict, output_dict, widget):
dataset = input_dict['dataset']
targets = dataset.domain.classVar.values
return render(request, 'interactions/segmine_fc_gene_filter.html', {'widget':widget, 'targets' : targets, 'default_threshold' : 1.0})
'''
Segmine library.
@author: Anze Vavpetic <anze.vavpetic@ijs.si>
'''
#
# Visualization widgets:
#
def segmine_rank_plotter(input_dict):
return input_dict
def segmine_rule_browser(input_dict):
return input_dict
#
# Interactions widgets:
#
def segmine_fc_gene_filter_finished(postdata, input_dict, output_dict):
from orngBioinformatics import obiExpression as rankers
import orange
dataset = input_dict['dataset']
widget_id = postdata.get('widget_id')[0]
fc_threshold = float(postdata.get('fc_threshold%s' % widget_id)[0])
targets = map(str, postdata.get('target%s' % widget_id))
ranker = rankers.ExpressionSignificance_FoldChange(dataset, False)
ranks = ranker(target=targets if len(targets)>1 else targets[0])
new_domain = orange.Domain([att for att, fc in ranks if fc >= fc_threshold], dataset.domain.classVar)
reduced_dataset = orange.ExampleTable(new_domain, dataset)
return {'dataset' : reduced_dataset}
def segmine_ttest_gene_filter_finished(postdata, input_dict, output_dict):
from orngBioinformatics import obiExpression as rankers
import orange
dataset = input_dict['dataset']
widget_id = postdata.get('widget_id')[0]
pvalue_threshold = float(postdata.get('pvalue_threshold%s' % widget_id)[0])
targets = map(str, postdata.get('target%s' % widget_id))
ranker = rankers.ExpressionSignificance_TTest(dataset, False)
ranks = ranker(target=targets if len(targets)>1 else targets[0])
new_domain = orange.Domain([att for att, (t, pval) in ranks if pval <= pvalue_threshold], dataset.domain.classVar)
reduced_dataset = orange.ExampleTable(new_domain, dataset)
return {'dataset' : reduced_dataset}
#
# Regular widgets:
#
def segmine_ttest_gene_filter(input_dict):
return {'dataset' : None}
def segmine_fc_gene_filter(input_dict):
return {'dataset' : None}
def segmine_gene_ranker(input_dict):
import orange
from numpy import mean, var
from math import sqrt
CONTROL_GROUP_KEY = 'control group'
DATA_GROUP_KEY = 'data group'
CLASS_ATRR_NAME = 'group'
table = input_dict['microarrayTable']
k = int(input_dict['k'])
m = int(input_dict['m'])
if m == 0: # special value
m= -1 # all examples
ranks = []
# ReliefF parameters:
# - number of neighbours: 10
# - number of reference examples: all (-1)
# - checksum computation: none (the data do not change)
ranker = orange.MeasureAttribute_relief(k=k, m=m, checkCachedData=False)
for attr in table.domain.attributes:
ranks.append((ranker(attr, table), attr.name))
# tuples are sorted according to the first element,
# here, this is attribute's quality
ranks.sort(reverse=True)
# reverse order inside sorted tuples list in result
geneRanks = [(elt[1], elt[0]) for elt in ranks]
tScores = {}
control = table.selectref({CLASS_ATRR_NAME:CONTROL_GROUP_KEY})
data = table.selectref({CLASS_ATRR_NAME:DATA_GROUP_KEY})
nerrors = 0
for attr in table.domain.attributes:
geneID = attr.name
controlValues = [float(example[attr]) for example in control]
dataValues = [float(example[attr]) for example in data]
try:
tScores[geneID] = (mean(dataValues) - mean(controlValues)) / sqrt(var(controlValues)/len(controlValues) + var(dataValues)/len(dataValues))
except ZeroDivisionError:
tScores[geneID] = 0.0
sortedTScores = [(elt[1], elt[0]) for elt in sorted([(tScores[attr.name], attr.name) for attr in table.domain.attributes], reverse=True)]
return {'geneRanks':geneRanks,'tScores':sortedTScores}
def segmine_segs(input_dict):
# TODO
output_dict = {}
return output_dict
def segmine_resolve_gene_synonyms(input_dict):
from .data import mappings
gene_ranks = input_dict['gene_ranks']
unknown = 0
ndup = 0
mapped = []
genes = {}
for (i, (geneID, rank)) in enumerate(gene_ranks):
if i%100 == 0:
self.progressBar.advance()
# gene name can also be symbolic or synonym
geneID = geneID.lower()
try:
entrezID = int(geneID)
except ValueError:
if geneID in mappings.symbol2entrez:
entrezID = mappings.symbol2entrez[geneID]
elif geneID in mappings.synonyms2entrez:
entrezID = mappings.synonyms2entrez[geneID]
else:
unknown += 1
continue
if entrezID in genes:
ndup += 1
continue
else:
mapped.append((str(entrezID), rank))
genes[entrezID] = None
return {'gene_ranks' : mapped}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import os
# === STANDARD PACKAGE SETTINGS ===
PACKAGE_ROOT = os.path.dirname(__file__)
# === AUTO IMPORT OPTIONS ===
#If auto_import_package_data is true then given data file is automatically imported when ClowdFlows project is newly deployed or refreshed from git
AUTO_IMPORT_DB = True
#For auto_import_package_data_replace_option description see the 'replace' option in workflows/import_package command
AUTO_IMPORT_DB_REPLACE_OPTION = True
#If file(s) other than ./db/package_data.json should be imported, auto_import_package_data_files should be corrected
AUTO_IMPORT_DB_FILES = [os.path.join(PACKAGE_ROOT,'db/package_data.json')]
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} wants your input!" style="height: 200px; width: 200px">
<form id="interactionform-{{widget.pk}}" name="interactionform-{{widget.pk}}">
<label>Lower fold change threshold</label><input name="fc_threshold{{widget.pk}}" value="{{default_threshold}}" style="display:inline;width:auto;">
<label>Select target class values:</label>
<select multiple name="target{{widget.pk}}" style="min-width: 50px;">
{% for target in targets %}
<option value="{{target}}" {% if forloop.first %}selected="selected"{% endif %}>{{target}}</option>
{% endfor %}
</select multiple>
<input type="hidden" name="widget_id" value="{{widget.pk}}">
</form>
</div>
\ No newline at end of file
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} wants your input!" style="height: 200px; width: 200px">
<form id="interactionform-{{widget.pk}}" name="interactionform-{{widget.pk}}">
<label>Upper p-value threshold</label><input name="pvalue_threshold{{widget.pk}}" value="{{default_threshold}}" style="display:inline;width:auto;">
<label>Select target class values:</label>
<select multiple name="target{{widget.pk}}" style="min-width: 50px;">
{% for target in targets %}
<option value="{{target}}" {% if forloop.first %}selected="selected"{% endif %}>{{target}}</option>
{% endfor %}
</select multiple>
<input type="hidden" name="widget_id" value="{{widget.pk}}">
</form>
</div>
\ No newline at end of file
<div id="widgetvisualization-{{widget.pk}}" rel="{{widget.pk}}" class="widgetvisualizationdialog" title="{{widget.name}} visualization">
<div style="width:400px;font-family:monospace;">
<table style="width:auto; border-collapse:collapse;">
{% for i in input_dict.intList %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{% if forloop.first %} {% else %}+{% endif %}
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{{ i }}
</td>
</tr>
{% endfor %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px; padding-top: 4px; margin:2px;">
=
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px;margin:2px;">
{{ input_dict.sum }}
</td>
</tr>
</table>
<br/>
{{ check }}
</div>
</div>
\ No newline at end of file
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