a b/qiita_pet/templates/workflows.html
1
{% extends sitebase.html %}
2
{% block head %}
3
{% from qiita_core.qiita_settings import qiita_config %}
4
5
<script type="text/javascript">
6
var layout = {
7
  name: 'dagre',
8
  rankDir: 'LR',
9
  directed: true,
10
  grid: true,
11
  nodeDimensionsIncludeLabels: true,
12
};
13
var style = [{
14
  selector: 'node',
15
  style: {
16
    'content': 'data(label)',
17
    'background-color': 'data(color)',
18
    'text-opacity': 0.7,
19
    'text-wrap': "wrap",
20
    'border-color': '#333',
21
    'border-width': '3px'
22
  }}, {
23
  selector: 'edge',
24
  style: {
25
    'curve-style': 'bezier',
26
    'target-arrow-shape': 'triangle'
27
  }},
28
];
29
var panzoom_options =   {
30
  zoomOnly: true,
31
  sliderHandleIcon: 'fa fa-minus',
32
  zoomInIcon: 'fa fa-plus',
33
  zoomOutIcon: 'fa fa-minus',
34
  resetIcon: 'fa fa-expand'
35
};
36
37
var colorScheme =  {
38
  'command': {border: '#00cc00', background: '#7FE57F', highlight: {border: '#00cc00', background: '#a5eda5'}, 'color': '#333333'},
39
  'artifact': {border: '#BBBBBB', background: '#FFFFFF', highlight: {border: '#999999', background: '#FFFFFF'}, 'color': '#333333'}
40
}
41
42
function format_title(name, params) {
43
  var title = '<b>Name: ' + name + '</b></br>';
44
  for (var key in params) {
45
    title += '<b>' + key + '</b>: ' + params[key] + '</br>';
46
  }
47
  return title;
48
}
49
50
function makePopper(node) {
51
  node.tippy = tippy(node.popperRef(), {
52
    content: () => {
53
      let content = document.createElement('div');
54
      content.innerHTML = node.data('tooltip');
55
      return content;
56
    }
57
  });
58
}
59
60
</script>
61
62
{% end %}
63
64
{% block content %}
65
  {% if workflows %}
66
    <h3>Recommended Default Workflows</h3>
67
    <div class="row">
68
      <div class="col-sm-10">
69
        In this page you will find our recommendations on how to processes each data type available in Qiita and the minimum processing requirements to make your data public.
70
        <br/><br/>
71
        For convenience, there is an "Add Default Workflow" button for each preparation that will add the recommended workflow steps for your raw data which then you can process.
72
        It is important to note however that some steps in this default workflow will not work with all raw data; for example, for target gene the workflow is based on the
73
        default Earth Microbiome Project protocol and so assumes the uploaded data are multiplexed sequences with the reversed barcodes in your mapping file and index sequence
74
        file (<a href="https://earthmicrobiome.org/protocols-and-standards/" target="_blank">see here</a> for more details). Thus, if the protocol does not apply to your data
75
        you can still use the Default Workflow, however, you should first manually process your data using the appropriate steps until you have a defined step; in our example,
76
        demultiplex your reads. After demultiplexing, the Default Workflow is safe to use with any protocol.
77
        <br/><br/>
78
        If you have already manually performed one of the processing steps in the Default Workflow pipeline, the "Add Default Workflow" button will not re-select those steps but
79
        instead will only select any remaining steps that have not been completed. You can also add additional workflows on top of the recommended Default Workflow at any time.
80
        <br/><br/>
81
        Note that this is not a full inclusive list of data types accepted by Qiita but only those that have a defined workflow.
82
      </div>
83
    </div>
84
    <h5>Hover on the spheres to get more information</h5>
85
86
      {% for i, w in enumerate(workflows) %}
87
        <div class="row">
88
          <div class="col-sm-7" style="background-color: #DCDCDC; height: 650px" id="workflow_{{i}}"></div>
89
          <div class="col-sm-5">
90
            {% if not w['active'] %}
91
              <h3 style="color:red">
92
                ~~ NOT ACTIVE ~~
93
              </h3>
94
            {% end %}
95
            <h4>
96
              Application: {{', '.join(w['data_types'])}} ->
97
              {% if w['parameters_sample'] or w['parameters_prep'] %}
98
                  parameter restrictions:
99
                  <br/>
100
                  <ul>
101
                  {% if w['parameters_sample'] %}
102
                    <li>Sample Information</li>
103
                    <ul>
104
                    {% for k, v in w['parameters_sample'].items() %}
105
                      <li>{{k}}: {{v}}</li>
106
                    {% end %}
107
                    </ul>
108
                  {% end %}
109
                  {% if w['parameters_prep'] %}
110
                    <li>Prep Information</li>
111
                    <ul>
112
                    {% for k, v in w['parameters_prep'].items() %}
113
                      <li>{{k}}: {{v}}</li>
114
                    {% end %}
115
                    </ul>
116
                  {% end %}
117
                  </ul>
118
              {% else %}
119
                NO parameters restrictions
120
              {% end %}
121
              <hr/>
122
              {{w['name']}}
123
            </h4>
124
            <br/>
125
            <div id="workflow_text_{{i}}">
126
              {% raw w['description'] %}
127
            </div>
128
          </div>
129
          <script type="text/javascript">
130
            var cy_network_{{i}} = cytoscape({
131
              container: document.getElementById('workflow_{{i}}'),
132
              wheelSensitivity: .3,
133
              layout: layout, style: style,
134
              elements: {
135
                nodes: [
136
                  {% for node in w['nodes'] %}
137
                    {% if node[0].startswith('params') %}
138
                      {data: {id: "{{node[0]}}", shape: "dot", color: colorScheme['command']['background'], label: "{% raw node[2].replace(' | ', '\\n') %}", tooltip: format_title("{{node[3]}}", {% raw node[4] %})}},
139
                    {% else %}
140
                      {data: {id: "{{node[0]}}", shape: "dot", color: colorScheme['artifact']['background'], label: "{% raw node[2].replace(' | ', '\\n') %}", tooltip: "Artifact: {{node[2]}}"}},
141
                    {% end %}
142
                  {% end %}
143
                ],
144
                edges: [
145
                  {% for f, t in w['edges'] %}
146
                    {data: { source: "{{f}}", target: "{{t}}"}},
147
                  {% end %}
148
                ]
149
              }
150
            });
151
            cy_network_{{i}}.panzoom(panzoom_options);
152
            cy_network_{{i}}.nodes().lock();
153
154
            cy_network_{{i}}.ready(function() {
155
              cy_network_{{i}}.nodes().forEach(function(node) {
156
                makePopper(node);
157
              });
158
            });
159
160
            cy_network_{{i}}.nodes().unbind('mouseover');
161
            cy_network_{{i}}.nodes().bind('mouseover', (event) => event.target.tippy.show());
162
163
            cy_network_{{i}}.nodes().unbind('mouseout');
164
            cy_network_{{i}}.nodes().bind('mouseout', (event) => event.target.tippy.hide());
165
          </script>
166
        </div>
167
        <hr/>
168
      {% end %}
169
  {% else %}
170
      <div id="jumbotron" class="jumbotron">
171
          <h1><span class="glyphicon glyphicon-thumbs-down"></span> There are no workflows in this system. </h1>
172
      </div>
173
  {% end %}
174
{% end %}