From 2803a9d34a6ed1595cc423b21bc269a2119758de Mon Sep 17 00:00:00 2001 From: Joshua Shorenstein Date: Tue, 26 May 2015 14:50:57 -0700 Subject: [PATCH 1/7] Use short form for private too. Fix #1164 --- qiita_pet/handlers/study_handlers/edit_handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiita_pet/handlers/study_handlers/edit_handlers.py b/qiita_pet/handlers/study_handlers/edit_handlers.py index 953b6cdd4..896f6234e 100644 --- a/qiita_pet/handlers/study_handlers/edit_handlers.py +++ b/qiita_pet/handlers/study_handlers/edit_handlers.py @@ -198,8 +198,8 @@ def post(self, study=None): if study: # Check study and user access the_study = self._check_study_exists_and_user_access(study) - # If the study is public, we use the short version of the form - if the_study.status == 'public': + # If the study is public or private, we use the short version + if the_study.status in {'public', 'private'}: form_factory = StudyEditorForm # Get the form data from the request arguments From ec275f41f735fb14b3c1f389bf50cd1e5ed4dfb8 Mon Sep 17 00:00:00 2001 From: Joshua Shorenstein Date: Tue, 26 May 2015 14:53:09 -0700 Subject: [PATCH 2/7] more explicit; non-sandbox uses short form --- qiita_pet/handlers/study_handlers/edit_handlers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiita_pet/handlers/study_handlers/edit_handlers.py b/qiita_pet/handlers/study_handlers/edit_handlers.py index 896f6234e..ac766bcbe 100644 --- a/qiita_pet/handlers/study_handlers/edit_handlers.py +++ b/qiita_pet/handlers/study_handlers/edit_handlers.py @@ -198,8 +198,8 @@ def post(self, study=None): if study: # Check study and user access the_study = self._check_study_exists_and_user_access(study) - # If the study is public or private, we use the short version - if the_study.status in {'public', 'private'}: + # If the study is not sandbox, we use the short version + if study.status != 'sandbox': form_factory = StudyEditorForm # Get the form data from the request arguments From d686dfa03efe0c2bde4da07d28299675a52ba410 Mon Sep 17 00:00:00 2001 From: Joshua Shorenstein Date: Tue, 26 May 2015 15:20:08 -0700 Subject: [PATCH 3/7] fix variable name --- qiita_pet/handlers/study_handlers/edit_handlers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiita_pet/handlers/study_handlers/edit_handlers.py b/qiita_pet/handlers/study_handlers/edit_handlers.py index ac766bcbe..23bccddf8 100644 --- a/qiita_pet/handlers/study_handlers/edit_handlers.py +++ b/qiita_pet/handlers/study_handlers/edit_handlers.py @@ -199,7 +199,7 @@ def post(self, study=None): # Check study and user access the_study = self._check_study_exists_and_user_access(study) # If the study is not sandbox, we use the short version - if study.status != 'sandbox': + if the_study.status != 'sandbox': form_factory = StudyEditorForm # Get the form data from the request arguments From 099278b0f9899fcff1f5cf69c8af5336711de534 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Wed, 27 May 2015 16:35:13 -0600 Subject: [PATCH 4/7] TST: test that recreates the bug --- qiita_ware/test/test_demux.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/qiita_ware/test/test_demux.py b/qiita_ware/test/test_demux.py index 2ded52874..a1d8e1d35 100644 --- a/qiita_ware/test/test_demux.py +++ b/qiita_ware/test/test_demux.py @@ -331,6 +331,25 @@ def test_fetch(self): # implicitly tested with test_to_ascii pass + def test_fetch_qual_length_bug(self): + # fetch was not trimming qual to the length of the sequence resulting + # in qual scores for positions beyond the length of the sequence. + with tempfile.NamedTemporaryFile('r+', suffix='.fq', + delete=False) as f: + f.write(fqdata_variable_length) + + self.to_remove.append(f.name) + to_hdf5(f.name, self.hdf5_file) + + exp = [('a', [(b"@a_0 orig_bc=abc new_bc=abc bc_diffs=0\nxyz\n+\n" + "ABC\n")]), + ('b', [(b"@b_0 orig_bc=abw new_bc=wbc bc_diffs=4\nqwe\n+\n" + "DFG\n"), + (b"@b_1 orig_bc=abw new_bc=wbc bc_diffs=4\nqwexx\n+\n" + "DEF#G\n")])] + + obs = [(s[0], list(s[1])) for s in to_per_sample_ascii(self.hdf5_file)] + self.assertEqual(obs, exp) seqdata = """>a_1 orig_bc=abc new_bc=abc bc_diffs=0 x @@ -370,5 +389,19 @@ def test_fetch(self): DEF """ +fqdata_variable_length = """@a_1 orig_bc=abc new_bc=abc bc_diffs=0 +xyz ++ +ABC +@b_1 orig_bc=abw new_bc=wbc bc_diffs=4 +qwe ++ +DFG +@b_2 orig_bc=abw new_bc=wbc bc_diffs=4 +qwexx ++ +DEF#G +""" + if __name__ == '__main__': main() From 454446bd72d1176bfc0c462c6fbfe9c5d26aef84 Mon Sep 17 00:00:00 2001 From: Daniel McDonald Date: Wed, 27 May 2015 16:42:47 -0600 Subject: [PATCH 5/7] BUG: properly slices qual scores --- qiita_ware/demux.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/qiita_ware/demux.py b/qiita_ware/demux.py index 0938ba696..f26c05f11 100644 --- a/qiita_ware/demux.py +++ b/qiita_ware/demux.py @@ -438,7 +438,7 @@ def to_ascii(demux, samples=None): for samp, idx, seq, qual, bc_ori, bc_cor, bc_err in fetch(demux, samples): seq_id = id_fmt % {'sample': samp, 'idx': idx, 'bc_ori': bc_ori, 'bc_cor': bc_cor, 'bc_diff': bc_err} - if qual is not None: + if qual != []: qual = qual.astype(np.uint8) yield formatter(seq_id, seq, qual) @@ -516,7 +516,7 @@ def fetch(demux, samples=None, k=None): seqs = demux[pjoin(dset_paths['sequence'])][indices] # only yield qual if we have it - quals = repeat(None) + quals = repeat([]) if demux.attrs['has-qual']: if len(indices) == 1: if indices[0]: @@ -531,8 +531,8 @@ def fetch(demux, samples=None, k=None): iter_ = zip(repeat(sample), np.arange(indices.size)[indices], seqs, quals, bc_original, bc_corrected, bc_error) - for item in iter_: - yield item + for samp, idx, seq, qual, bc_ori, bc_cor, bc_err in iter_: + yield (samp, idx, seq, qual[:len(seq)], bc_ori, bc_cor, bc_err) def stats(demux): From 8093a47074cfa0e83405f5118a8b401b18c53743 Mon Sep 17 00:00:00 2001 From: Jose Navas Date: Fri, 29 May 2015 09:29:23 -0700 Subject: [PATCH 6/7] Adding comments to the changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58d2c21f0..4d7076863 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ Qiita 0.1.0-dev (changes since Qiita 0.1.0 go here) --------------------------------------------------- +* Creating an empty RawData is no longer need in order to add a PrepTemplate. Now, the PrepTemplate is required in order to add a RawData to a study. This is the normal flow of an study, as the PrepTemplate information is available before the RawData information is available. +* A user can upload a QIIME mapping file instead of a SampleTemplate. The system will create a SampleTemplate and a PrepTemplate from the information present in the QIIME mapping file. + Version 0.1.0 (2015-04-30) -------------------------- From f0dddeb66d40e09a266dd66af9732b3d196db993 Mon Sep 17 00:00:00 2001 From: Jose Navas Date: Fri, 29 May 2015 16:15:15 -0700 Subject: [PATCH 7/7] Addressing comments --- CHANGELOG.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d7076863..bde11e70b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,16 @@ Qiita 0.1.0-dev (changes since Qiita 0.1.0 go here) --------------------------------------------------- -* Creating an empty RawData is no longer need in order to add a PrepTemplate. Now, the PrepTemplate is required in order to add a RawData to a study. This is the normal flow of an study, as the PrepTemplate information is available before the RawData information is available. -* A user can upload a QIIME mapping file instead of a SampleTemplate. The system will create a SampleTemplate and a PrepTemplate from the information present in the QIIME mapping file. +* Creating an empty RawData is no longer needed in order to add a PrepTemplate. +Now, the PrepTemplate is required in order to add a RawData to a study. This is +the normal flow of a study, as the PrepTemplate information is usually +available before the RawData information is available. +* A user can upload a QIIME mapping file instead of a SampleTemplate. The +system will create a SampleTemplate and a PrepTemplate from the information +present in the QIIME mapping file. The QIIME required columns for this +functionality to work are 'BarcodeSequence', 'LinkerPrimerSequence' and +'Description'. For more information about QIIME mapping files, visit +http://qiime.org/documentation/file_formats.html#mapping-file-overview. Version 0.1.0 (2015-04-30) --------------------------