Skip to content

Commit 0826895

Browse files
committed
Addressing some comments
1 parent 1258155 commit 0826895

File tree

5 files changed

+81
-82
lines changed

5 files changed

+81
-82
lines changed

qiita_db/test/test_data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ def test_delete(self):
263263
# Clear the files so we can actually remove the RawData
264264
study_id = rd.studies[0]
265265
path_for_removal = join(get_mountpoint("uploads")[0][1], str(study_id))
266-
self._clean_up_files = [join(path_for_removal,
266+
self._clean_up_files.extend([join(path_for_removal,
267267
basename(f).split('_', 1)[1])
268-
for _, f, _ in rd.get_filepaths()]
268+
for _, f, _ in rd.get_filepaths()])
269269
rd.clear_filepaths()
270270

271271
RawData.delete(rd.id, self.pt1.id)
@@ -550,7 +550,7 @@ def test_get_filepaths(self):
550550
"preprocessed_fastq"),
551551
(5, join(self.db_test_ppd_dir, '1_seqs.demux'),
552552
"preprocessed_demux")]
553-
self.assertEqual(sorted(obs), sorted(exp))
553+
self.assertItemsEqual(obs, exp)
554554

555555
def test_processed_data(self):
556556
"""Correctly returns the processed data id"""

qiita_db/test/test_util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,8 @@ def test_move_upload_files_to_trash(self):
576576
# create file to move to trash
577577
fid, folder = get_mountpoint("uploads")[0]
578578
test_fp = join(folder, '1', test_filename)
579-
open(test_fp, 'w').write('test')
579+
with open(test_fp, 'w') as f:
580+
f.write('test')
580581

581582
self.files_to_remove.append(test_fp)
582583

qiita_pet/handlers/compute.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ def _split(x):
5555
fps.append((_split(reverse_reads_str), 'raw_reverse_seqs'))
5656
fps.append((_split(sff_str), 'raw_sff'))
5757

58+
# We need to retrieve the full path for all the files, as the
59+
# arguments only contain the file name. Since we don't know in which
60+
# mountpoint the data lives, we retrieve all of them and we loop
61+
# through all the files checking if they exist or not.
5862
for _, f in get_mountpoint("uploads", retrieve_all=True):
5963
f = join(f, str(study_id))
6064
for fp_set, filetype in fps:

qiita_pet/templates/study_description.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
}
216216

217217
function add_raw_data(prep_id) {
218-
raw_data_id = $("#previous-raw-data-" + prep_id).val()
218+
raw_data_id = $("#previous-raw-data-" + prep_id).val();
219219
if (raw_data_id === null){
220220
bootstrapAlert("You need to select a raw data used in a previous study");
221221
} else {

qiita_pet/templates/study_description_templates/prep_template_info_tab.html

Lines changed: 71 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -104,87 +104,81 @@ <h4 class="modal-title" id="myModalLabel">Choose preprocessing parameters</h4>
104104
<!-- There is no raw data associated with the prep template, show options for adding raw data -->
105105
<tr>
106106
<td style="padding: 5px;">
107-
<button class="btn btn-primary glyphicon glyphicon-plus" type="button" data-toggle="collapse" data-target="#add-raw-data-{{pt_id}}" aria-expanded="false" aria-controls="add-raw-data-{{pt_id}}" style="word-spacing: -10px;">Add raw data</button>
108-
</td>
109-
</tr>
110-
<tr>
111-
<td style="padding: 5px;">
112-
<div class="collapse" id="add-raw-data-{{pt_id}}">
113-
<div class="panel-group" id="accordion-add-raw-{{pt_id}}" role="tablist" aria-multiselectable="true">
114-
<!-- Panel for creating a new raw data -->
115-
<div class="panel panel-default">
116-
<div class="panel-heading" role="tab" id="create-raw-{{pt_id}}">
117-
<h4 class="panel-title">
118-
<a class="collapsed" data-toggle="collapse" data-parent="#accordion-add-raw-{{pt_id}}" href="#collapse-new-{{pt_id}}" aria-expanded="false" aria-controls="collapse-new-{{pt_id}}">
119-
Add new raw data
120-
</a>
121-
</h4>
122-
</div>
123-
<div id="collapse-new-{{pt_id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="create-raw-{{pt_id}}">
124-
<div class="panel-body">
125-
What file type is your raw data?
126-
<select id="filetype-{{pt_id}}" onchange="$('.filesgroup').hide(); $('#files-{{pt_id}}-'+$('#filetype-{{pt_id}}').val()).show();">
127-
<option value="0">Not selected...</option>
128-
{% for name, value, _ in filetypes %}
129-
<option value="{{value}}">{{name}}</option>
130-
{% end %}
131-
</select>
132-
<div id="files-{{pt_id}}-0" class="filesgroup"></div>
133-
{% for _, value, filepath_types in filetypes %}
134-
<div id="files-{{pt_id}}-{{value}}" class="filesgroup">
135-
<table border="0">
136-
<tr><td><b>Choose the files to link to the raw data</b></td></tr>
107+
<div class="panel-group" id="accordion-add-raw-{{pt_id}}" role="tablist" aria-multiselectable="true">
108+
<!-- Panel for creating a new raw data -->
109+
<div class="panel panel-default">
110+
<div class="panel-heading" role="tab" id="create-raw-{{pt_id}}">
111+
<h4 class="panel-title">
112+
<a class="collapsed" data-toggle="collapse" data-parent="#accordion-add-raw-{{pt_id}}" href="#collapse-new-{{pt_id}}" aria-expanded="false" aria-controls="collapse-new-{{pt_id}}">
113+
Add new raw data
114+
</a>
115+
</h4>
116+
</div>
117+
<div id="collapse-new-{{pt_id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="create-raw-{{pt_id}}">
118+
<div class="panel-body">
119+
What file type is your raw data?
120+
<select id="filetype-{{pt_id}}" onchange="$('.filesgroup').hide(); $('#files-{{pt_id}}-'+$('#filetype-{{pt_id}}').val()).show();">
121+
<option value="0">Not selected...</option>
122+
{% for name, value, _ in filetypes %}
123+
<option value="{{value}}">{{name}}</option>
124+
{% end %}
125+
</select>
126+
<div id="files-{{pt_id}}-0" class="filesgroup"></div>
127+
{% for _, value, filepath_types in filetypes %}
128+
<div id="files-{{pt_id}}-{{value}}" class="filesgroup">
129+
<table border="0">
130+
<tr><td><b>Choose the files to link to the raw data</b></td></tr>
131+
<tr>
132+
<th>File</th>
133+
<th>&nbsp;&nbsp;&nbsp;</th>
134+
<th>File type</th>
135+
</tr>
136+
{% for f in files %}
137137
<tr>
138-
<th>File</th>
139-
<th>&nbsp;&nbsp;&nbsp;</th>
140-
<th>File type</th>
138+
<td>{{f}}</td>
139+
<td>&nbsp;</td>
140+
<td>
141+
<select id="{{f}}" name="upload_file_{{pt_id}}_{{value}}">
142+
<option value="">Ignore ...</option>
143+
{% for fp_type in filepath_types %}
144+
<option value="{{fp_type}}">{{fp_type}}</option>
145+
{% end %}
146+
</select>
147+
</td>
141148
</tr>
142-
{% for f in files %}
143-
<tr>
144-
<td>{{f}}</td>
145-
<td>&nbsp;</td>
146-
<td>
147-
<select id="{{f}}" name="upload_file_{{pt_id}}_{{value}}">
148-
<option value="">Ignore ...</option>
149-
{% for fp_type in filepath_types %}
150-
<option value="{{fp_type}}">{{fp_type}}</option>
151-
{% end %}
152-
</select>
153-
</td>
154-
</tr>
155-
{% end %}
156-
<tr><td><a class="btn btn-primary" onclick="create_raw_data({{pt_id}}, {{value}});">Add</a></td></tr>
157-
</table>
158-
</div>
159-
{% end %}
160-
</div>
149+
{% end %}
150+
<tr><td><a class="btn btn-primary" onclick="create_raw_data({{pt_id}}, {{value}});">Add</a></td></tr>
151+
</table>
152+
</div>
153+
{% end %}
161154
</div>
162155
</div>
163-
<!-- Panel for adding an existent raw data to the prep template -->
164-
<div class="panel panel-default">
165-
<div class="panel-heading" role="tab" id="use-existing-{{pt_id}}">
166-
<h4 class="panel-title">
167-
<a class="collapsed" data-toggle="collapse" data-parent="#accordion-add-raw-{{pt_id}}" href="#collapse-existing-{{pt_id}}" aria-expanded="false" aria-controls="collapse-existing-{{pt_id}}">
168-
Use existing raw data
169-
</a>
170-
</h4>
171-
</div>
172-
<div id="collapse-existing-{{pt_id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="use-existing-{{pt_id}}">
173-
<div class="panel-body">
174-
{% if other_studies_rd %}
175-
Choose raw data from studies that you have access to:
176-
<br/>
177-
<select class="chosen-select" id="previous-raw-data-{{pt_id}}" data-placeholder=" ">
178-
{% for rd_id, study_name in other_studies_rd %}
179-
<option value="{{rd_id}}">id: {{rd_id}}, study: {{study_name}}</option>
180-
{% end %}
181-
</select>
182-
<br/>
183-
<a class="btn btn-primary" onclick="add_raw_data({{pt_id}});">Add</a>
184-
{% else %}
185-
There is no existent raw data available.
186-
{% end %}
187-
</div>
156+
</div>
157+
<!-- Panel for adding an existent raw data to the prep template -->
158+
<div class="panel panel-default">
159+
<div class="panel-heading" role="tab" id="use-existing-{{pt_id}}">
160+
<h4 class="panel-title">
161+
<a class="collapsed" data-toggle="collapse" data-parent="#accordion-add-raw-{{pt_id}}" href="#collapse-existing-{{pt_id}}" aria-expanded="false" aria-controls="collapse-existing-{{pt_id}}">
162+
Use existing raw data
163+
</a>
164+
</h4>
165+
</div>
166+
<div id="collapse-existing-{{pt_id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="use-existing-{{pt_id}}">
167+
<div class="panel-body">
168+
{% if other_studies_rd %}
169+
Choose raw data from studies that you have access to:
170+
<br/>
171+
<select class="chosen-select" id="previous-raw-data-{{pt_id}}" data-placeholder=" ">
172+
{% for rd_id, study_name in other_studies_rd %}
173+
<option value="{{rd_id}}">id: {{rd_id}}, study: {{study_name}}</option>
174+
{% end %}
175+
</select>
176+
<br/>
177+
<br/>
178+
<a class="btn btn-primary" onclick="add_raw_data({{pt_id}});">Add</a>
179+
{% else %}
180+
There is no existent raw data available.
181+
{% end %}
188182
</div>
189183
</div>
190184
</div>

0 commit comments

Comments
 (0)