-
Notifications
You must be signed in to change notification settings - Fork 79
1084 qiita pet #1207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
1084 qiita pet #1207
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
36c01b0
Change RawDataTab to PrepTemplateTab
josenavas d51b299
Hooking all related with raw data creation
josenavas 2720331
Adding all bits for raw data deletion
josenavas c85e180
Adding bits for adding an existing raw data to a prep template
josenavas 7394084
Adding bits for updating investigation type
josenavas f174eef
Adding preprocessing bits
josenavas 5035ba0
Merge branch '1084-qiita-ware' into 1084-qiita-pet
josenavas 8488071
Merge branch '1084-prep-template' into 1084-qiita-pet
josenavas 40043e6
Removing left out print code
josenavas 412046c
Making sure that all return pages go to the 'prep_template_tab' inste…
josenavas 5feb3d9
Removing leftover code
josenavas 07b7e65
Adding ability to (un)link raw data files
josenavas 308ce03
Solving merge conflicts
josenavas fdaa7e7
Disabling processing if raw data has no files attached
josenavas 8378311
Merge branch '1084-data' into 1084-qiita-pet
josenavas 900a391
Fixing qiita_pet tests
josenavas ecd494e
Fixing test_data_studies/commands.sh
josenavas 66f72c6
Making sure tests clean the environment
josenavas ee9183d
Fixing tests in travis
josenavas f65e9da
My ~~friend~~ PEP8...
josenavas 1258155
Merge branch 'fix-1084' of https://github.com/biocore/qiita into 1084…
josenavas 0826895
Addressing some comments
josenavas 94ca93e
Fixing accordions width
josenavas 10a69d8
Addressing more comments
josenavas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,11 +7,13 @@ | |
| from .util import check_access | ||
|
|
||
| from qiita_ware.context import submit | ||
| from qiita_ware.dispatchable import add_files_to_raw_data, unlink_all_files | ||
| from qiita_ware.dispatchable import (add_files_to_raw_data, unlink_all_files, | ||
| create_raw_data) | ||
|
|
||
| from qiita_db.study import Study | ||
| from qiita_db.exceptions import QiitaDBUnknownIDError | ||
| from qiita_db.util import get_mountpoint | ||
| from qiita_db.metadata_template import PrepTemplate | ||
|
|
||
| from os.path import join, exists | ||
|
|
||
|
|
@@ -28,13 +30,61 @@ def get(self, job_id): | |
| self.redirect('/') | ||
|
|
||
|
|
||
| class CreateRawData(BaseHandler): | ||
| @authenticated | ||
| def post(self): | ||
| pt_id = self.get_argument('prep_template_id') | ||
| raw_data_filetype = self.get_argument('filetype') | ||
| barcodes_str = self.get_argument('barcodes') | ||
| forward_reads_str = self.get_argument('forward') | ||
| sff_str = self.get_argument('sff') | ||
| fasta_str = self.get_argument('fasta') | ||
| qual_str = self.get_argument('qual') | ||
| reverse_reads_str = self.get_argument('reverse') | ||
|
|
||
| pt = PrepTemplate(pt_id) | ||
| study_id = pt.study_id | ||
|
|
||
| def _split(x): | ||
| return x.split(',') if x else [] | ||
| filepaths, fps = [], [] | ||
| fps.append((_split(barcodes_str), 'raw_barcodes')) | ||
| fps.append((_split(fasta_str), 'raw_fasta')) | ||
| fps.append((_split(qual_str), 'raw_qual')) | ||
| fps.append((_split(forward_reads_str), 'raw_forward_seqs')) | ||
| fps.append((_split(reverse_reads_str), 'raw_reverse_seqs')) | ||
| fps.append((_split(sff_str), 'raw_sff')) | ||
|
|
||
| # We need to retrieve the full path for all the files, as the | ||
| # arguments only contain the file name. Since we don't know in which | ||
| # mountpoint the data lives, we retrieve all of them and we loop | ||
| # through all the files checking if they exist or not. | ||
| for _, f in get_mountpoint("uploads", retrieve_all=True): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind adding a comment describing this block, it took me a while to understand it 👓
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| f = join(f, str(study_id)) | ||
| for fp_set, filetype in fps: | ||
| for t in fp_set: | ||
| ft = join(f, t) | ||
| if exists(ft): | ||
| filepaths.append((ft, filetype)) | ||
|
|
||
| job_id = submit(self.current_user.id, create_raw_data, | ||
| raw_data_filetype, pt, filepaths) | ||
|
|
||
| self.render('compute_wait.html', | ||
| job_id=job_id, title='Adding raw data', | ||
| completion_redirect=( | ||
| '/study/description/%s?top_tab=prep_template_tab' | ||
| '&sub_tab=%s' % (study_id, pt_id))) | ||
|
|
||
|
|
||
| class AddFilesToRawData(BaseHandler): | ||
| @authenticated | ||
| def post(self): | ||
|
|
||
| # vars to add files to raw data | ||
| study_id = self.get_argument('study_id') | ||
| raw_data_id = self.get_argument('raw_data_id') | ||
| prep_template_id = self.get_argument('prep_template_id') | ||
| barcodes_str = self.get_argument('barcodes') | ||
| forward_reads_str = self.get_argument('forward') | ||
| sff_str = self.get_argument('sff') | ||
|
|
@@ -75,8 +125,8 @@ def _split(x): | |
| self.render('compute_wait.html', | ||
| job_id=job_id, title='Adding files to your raw data', | ||
| completion_redirect=( | ||
| '/study/description/%s?top_tab=raw_data_tab&sub_tab=%s' | ||
| % (study_id, raw_data_id))) | ||
| '/study/description/%s?top_tab=prep_template_tab' | ||
| '&sub_tab=%s' % (study_id, prep_template_id))) | ||
|
|
||
|
|
||
| class UnlinkAllFiles(BaseHandler): | ||
|
|
@@ -85,6 +135,7 @@ def post(self): | |
| # vars to remove all files from a raw data | ||
| study_id = self.get_argument('study_id', None) | ||
| raw_data_id = self.get_argument('raw_data_id', None) | ||
| prep_template_id = self.get_argument('prep_template_id', None) | ||
|
|
||
| study_id = int(study_id) if study_id else None | ||
|
|
||
|
|
@@ -101,5 +152,5 @@ def post(self): | |
| self.render('compute_wait.html', job_id=job_id, | ||
| title='Removing files from your raw data', | ||
| completion_redirect=( | ||
| '/study/description/%s?top_tab=raw_data_tab&sub_tab=%s' | ||
| % (study_id, raw_data_id))) | ||
| '/study/description/%s?top_tab=prep_template_tab&' | ||
| 'sub_tab=%s' % (study_id, prep_template_id))) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'assertItemsEqual' would be better here, since it would eliminate the sorting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other checks in this tests depend on these 2 lists being in the same order. Leaving the sort.