-
Notifications
You must be signed in to change notification settings - Fork 80
Download bulk raw data #2104
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
Download bulk raw data #2104
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
dc254ba
fix #2086
antgonza b6eb3bd
flak8
antgonza 6ad9a35
addressing @ElDeveloper comments + fixes
antgonza 17341a0
adding the final changes
antgonza cc7f0d0
fix failures
antgonza 2b8d608
get_qiita_version -> generate_biom_and_metadata_release
antgonza 4765055
download raw data
antgonza 0f0be35
adding missing empty files
antgonza c31ea7d
fixing conflicts
antgonza 324a385
addressing @wasade comments and fix errors
antgonza f7b61e7
fix error?
antgonza 5c598c7
rm vfabu + addressing @wasade and @josenavas comments + fix errors
antgonza 7d1ea83
just being dumb!
antgonza 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
Binary file added
BIN
+58 Bytes
qiita_db/support_files/test_data/raw_data/1_s_G1_L001_sequences.fastq.gz
Binary file not shown.
Binary file added
BIN
+58 Bytes
qiita_db/support_files/test_data/raw_data/1_s_G1_L001_sequences_barcodes.fastq.gz
Binary file not shown.
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
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
from qiita_pet.test.tornado_test_base import TestHandlerBase | ||
from qiita_pet.handlers.base_handlers import BaseHandler | ||
from qiita_db.user import User | ||
from qiita_db.study import Study | ||
from qiita_db.artifact import Artifact | ||
from qiita_db.software import Parameters, Command | ||
|
||
|
@@ -77,8 +78,6 @@ def test_download_study(self): | |
with open(tgz, 'w') as f: | ||
f.write('\n') | ||
|
||
self._clean_up_files.append(tmp_dir) | ||
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. rm cause it's twice, see line 65 |
||
|
||
files_biom = [(biom_fp, 'biom'), (smr_dir, 'directory'), (tgz, 'tgz')] | ||
|
||
params = Parameters.from_default_params( | ||
|
@@ -156,5 +155,53 @@ def test_download(self): | |
"is located at", response.body) | ||
|
||
|
||
class TestDownloadRawData(TestHandlerBase): | ||
|
||
def setUp(self): | ||
super(TestDownloadRawData, self).setUp() | ||
self._clean_up_files = [] | ||
|
||
def tearDown(self): | ||
super(TestDownloadRawData, self).tearDown() | ||
for fp in self._clean_up_files: | ||
if exists(fp): | ||
if isdir(fp): | ||
rmtree(fp) | ||
else: | ||
remove(fp) | ||
|
||
def test_download_raw_data(self): | ||
# it's possible that one of the tests is deleting the raw data | ||
# so we will make sure that the files exists so this test passes | ||
all_files = [fp for a in Study(1).artifacts() | ||
for _, fp, _ in a.filepaths] | ||
for fp in all_files: | ||
if not exists(fp): | ||
with open(fp, 'w') as f: | ||
f.write('') | ||
response = self.get('/download_raw_data/1') | ||
self.assertEqual(response.code, 200) | ||
|
||
exp = ( | ||
'- 0 /protected/raw_data/1_s_G1_L001_sequences.fastq.gz ' | ||
'raw_data/1_s_G1_L001_sequences.fastq.gz\n' | ||
'- 0 /protected/raw_data/1_s_G1_L001_sequences_barcodes.fastq.gz ' | ||
'raw_data/1_s_G1_L001_sequences_barcodes.fastq.gz\n' | ||
'- 36615 /protected/templates/1_prep_1_qiime_[0-9]*-[0-9]*.txt ' | ||
'mapping_files/1_mapping_file.txt\n' | ||
'- 36615 /protected/templates/1_prep_2_qiime_[0-9]*-[0-9]*.txt ' | ||
'mapping_files/7_mapping_file.txt\n') | ||
self.assertRegexpMatches(response.body, exp) | ||
|
||
response = self.get('/download_study_bioms/200') | ||
self.assertEqual(response.code, 405) | ||
|
||
# changing user so we can test the failures | ||
BaseHandler.get_current_user = Mock( | ||
return_value=User("demo@microbio.me")) | ||
response = self.get('/download_study_bioms/1') | ||
self.assertEqual(response.code, 405) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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
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.
where is the file created?
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.
Nowhere, is created on the fly by nginx. Basically, we send a list of filepaths to nginx using the "protected" filepath (only nginx has access) and the zip is created during download.
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.
Ah, thought that might be the case. Can you add a comment since it's implicit?
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.
eh?