aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/templates/correlation_page.html
blob: 88f6d65a0dd93f31f04e0dd47b817ea44ce4cd14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{% extends "base.html" %}
{% block css %}
    <link rel="stylesheet" type="text/css" href="/static/new/packages/DataTables/css/jquery.dataTables.css" />
    <link rel="stylesheet" type="text/css" href="/static/packages/DT_bootstrap/DT_bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/static/packages/TableTools/media/css/TableTools.css" />
{% endblock %}
{% block content %}
    
    {{ header("Correlation", 'Trait: {} Dataset: {}'.format(this_trait.name, dataset.name)) }}

    <div class="container">
        <div class="page-header">
            <h1>Correlation Table</h1>
        </div>

        <p>Values of record {{ this_trait.name }} in the <a href="/dbdoc/{{dataset.fullname}}">{{ dataset.fullname }}</a>
        dataset were compared to all records in the <a href="/dbdoc/{{target_dataset.fullname}}">{{ target_dataset.fullname }}</a>
        dataset. The top {{ return_number }} correlations ranked by the {{ formatted_corr_type }} are displayed.
        You can resort this list by clicking the headers. Select the Record ID to open the trait data
        and analysis page.
        </p>    

        <div>
            <table id="corr_results" class="table table-hover table-striped table-bordered">
                <thead>
                    <tr>
                    {% if dataset.type == 'ProbeSet' %}
                        <th>Trait</th>
                        <th>Symbol</th>
                        <th>Description</th>
                        <th>Location</th>
                        <th>Mean Expr</th>
                        <th>Max LRS</th>
                        <th>Max LRS Location</th>
                        {% if corr_method == 'pearson' %}
                        <th>Sample r</th>
                        <th>N Cases</th>
                        <th>Sample p(r)</th>
                        <th>Lit Corr</th>
                        <th>Tissue r</th>
                        <th>Tissue p(r)</th>
                        {% else %}
                        <th>Sample rho</th>
                        <th>N Cases</th>
                        <th>Sample p(rho)</th>
                        <th>Lit Corr</th>
                        <th>Tissue rho</th>
                        <th>Tissue p(rho)</th>
                        {% endif %}
                    {% elif dataset.type == "Publish" %}
                        <th>Record ID</th>
                        <th>Phenotype</th>
                        <th>Authors</th>
                        <th>Year</th>
                        {% if corr_method == 'pearson' %}
                        <th>Sample r</th>
                        <th>N Cases</th>
                        <th>Sample p(r)</th>
                        {% else %}
                        <th>Sample rho</th>
                        <th>N Cases</th>
                        <th>Sample p(rho)</th>
                        {% endif %}
                    {% endif %}
                    </tr>
                </thead>
                <tbody>
                {% for trait in correlation_results %}
                    <tr>
                    {% if dataset.type == 'ProbeSet' %}
                        <td><a href="/show_trait?trait_id={{trait.name}}&amp;dataset={{trait.dataset.name}}">{{ trait.name }}</a></td>
                        <td>{{ trait.symbol }}</td>
                        <td>{{ trait.description }} <br><br> <b>Aliases</b>: {{ trait.alias }}</td>
                        <td>Chr{{ trait.chr }}: {{'%0.3f'|format(trait.mb) }}</td>
                        <td>{{'%0.3f'|format(trait.mean)}}</td>
                        <td>{{'%0.3f'|format(trait.lrs)}}</td>
                        <td>Chr{{ trait.locus_chr }}: {{'%0.3f'|format(trait.locus_mb) }}</td>
                        <td><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></td>
                        <td>{{ trait.num_overlap }}</td>
                        <td>{{'%0.3e'|format(trait.sample_p)}}</td>
                        <td>{{'%0.3f'|format(trait.lit_corr)}}</td>
                        <td>{{'%0.3f'|format(trait.tissue_corr)}}</td>
                        <td>{{'%0.3e'|format(trait.tissue_pvalue)}}</td>
                    {% elif dataset.type == "Publish" %}
                        <td><a href="/show_trait?trait_id={{trait.name}}&amp;dataset={{trait.dataset.name}}">{{ trait.name }}</a></td>
                        <td>{{ trait.post_publication_description }}</td>
                        <td>{{ trait.authors }}</td>
                        <td>{{ trait.year }}</td>
                        <td><a target="_blank" href="corr_scatter_plot?dataset_1={{dataset.name}}&dataset_2={{trait.dataset.name}}&trait_1={{this_trait.name}}&trait_2={{trait.name}}">{{'%0.3f'|format(trait.sample_r)}}</a></td>
                        <td>{{ trait.num_overlap }}</td>
                        <td>{{'%0.3e'|format(trait.sample_p)}}</td>
                    {% endif %}
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
{% endblock %}

{% block js %}  
    <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="/static/new/packages/DataTables/js/jquery.dataTables.min.js"></script>
    <script language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script>
    <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script>
    <script language="javascript" type="text/javascript" src="/static/packages/underscore/underscore-min.js"></script>
    <script type="text/javascript" charset="utf-8">
        $(document).ready( function () {
            console.time("Creating table");
            $('#corr_results').dataTable( {
                //"sDom": "<<'span3'l><'span3'T><'span4'f>'row-fluid'r>t<'row-fluid'<'span6'i><'span6'p>>",
                "sDom": "lTftipr",
                "oTableTools": {
                    "aButtons": [
                        "copy",
                        "print",
                        {
                            "sExtends":    "collection",
                            "sButtonText": 'Save <span class="caret" />',
                            "aButtons":    [ "csv", "xls", "pdf" ]
                        }
                    ],
                    "sSwfPath": "/static/packages/TableTools/media/swf/copy_csv_xls_pdf.swf"
                },
                "iDisplayLength": 50,
                "bLengthChange": true,
                "bDeferRender": true,
                "bSortClasses": false
            } );
            console.timeEnd("Creating table");
        });
    </script>
{% endblock %}