Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion qtp_sequencing/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,19 @@ def generate_html_summary(qclient, job_id, parameters, out_dir):
"""
# Step 1: gather file information from qiita using REST api
artifact_id = parameters['input_data']
# we are going to use the "raw" code for retrieving artifact_info vs. the
# qiita_client.artifact_and_preparation_files method because fqtools
# returns 0 (vs. failing, which is nice) on an empty file
# $ touch x.fastq
# $ gzip x.fastq
# $ fqtools count x.fastq.gz
# 0
qclient_url = "/qiita_db/artifacts/%s/" % artifact_id
artifact_info = qclient.get(qclient_url)

# 1a. getting the file paths
filepaths = artifact_info['files']
filepaths = {k: [vv['filepath'] for vv in v]
for k, v in artifact_info['files'].items()}
# 1.b get the artifact type_info
artifact_type = artifact_info['type']

Expand Down
4 changes: 2 additions & 2 deletions qtp_sequencing/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ def test_plugin_summary(self):
files = self.qclient.get(
'/qiita_db/artifacts/%s/' % artifact_id)['files']

bcds_fp = files['raw_barcodes'][0]
bcds_fp = files['raw_barcodes'][0]['filepath']
self._clean_up_files.append(bcds_fp)
with GzipFile(bcds_fp, mode='w', mtime=1) as fh:
fh.write(BARCODES.encode())
fwd_fp = files['raw_forward_seqs'][0]
fwd_fp = files['raw_forward_seqs'][0]['filepath']
self._clean_up_files.append(fwd_fp)
with GzipFile(fwd_fp, mode='w', mtime=1) as fh:
fh.write(READS.encode())
Expand Down
10 changes: 5 additions & 5 deletions qtp_sequencing/tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def test_generate_html_summary_no_demux(self):
files = self.qclient.get(
'/qiita_db/artifacts/%s/' % artifact_id)['files']

bcds_fp = files['raw_barcodes'][0]
bcds_fp = files['raw_barcodes'][0]['filepath']
self._clean_up_files.append(bcds_fp)
with GzipFile(bcds_fp, mode='w', mtime=1) as fh:
fh.write(BARCODES.encode())
fwd_fp = files['raw_forward_seqs'][0]
fwd_fp = files['raw_forward_seqs'][0]['filepath']
self._clean_up_files.append(fwd_fp)
with GzipFile(fwd_fp, mode='w', mtime=1) as fh:
fh.write(READS.encode())
Expand All @@ -71,7 +71,7 @@ def test_generate_html_summary_no_demux(self):

# asserting content of html
res = self.qclient.get("/qiita_db/artifacts/%s/" % artifact_id)
html_fp = res['files']['html_summary'][0]
html_fp = res['files']['html_summary'][0]['filepath']
self._clean_up_files.append(html_fp)
with open(html_fp) as html_f:
html = html_f.read()
Expand All @@ -92,7 +92,7 @@ def test_generate_html_summary_demux(self):
# files fo not exist create them
files = self.qclient.get(
'/qiita_db/artifacts/%s/' % artifact_id)['files']
demux_fp = files['preprocessed_demux'][0]
demux_fp = files['preprocessed_demux'][0]['filepath']
copyfile(join(dirname(__file__), 'test_data', '101_seqs.demux'),
demux_fp)
self._clean_up_files.append(demux_fp)
Expand All @@ -107,7 +107,7 @@ def test_generate_html_summary_demux(self):

# asserting content of html
res = self.qclient.get("/qiita_db/artifacts/%s/" % artifact_id)
html_fp = res['files']['html_summary'][0]
html_fp = res['files']['html_summary'][0]['filepath']
self._clean_up_files.append(html_fp)

with open(html_fp) as html_f:
Expand Down