Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
568 commits
Select commit Hold shift + click to select a range
47598a2
Addressing @ElDeveloper comments
josenavas Mar 12, 2016
5be562a
Merge branch 'artifact-study-pages-artifact-creation' into artifact-s…
josenavas Mar 12, 2016
e7591f4
Pep8ing
josenavas Mar 12, 2016
fa10ecc
Modifying database
josenavas Mar 13, 2016
4c05c38
Fixing type
josenavas Mar 13, 2016
d5aa103
Forking off the QiitaClient as it's own 'project' and update the targ…
josenavas Mar 13, 2016
d68049c
Merge branch 'artifact-study-page-qiita-client-package' into artifact…
josenavas Mar 13, 2016
1279ed5
Fixing setup.py
josenavas Mar 13, 2016
7c3135b
Merge branch 'artifact-study-page-qiita-client-package' into artifact…
josenavas Mar 13, 2016
ca52a5b
Adding type propery to software
josenavas Mar 14, 2016
0afb571
Adapting the job complete function to the type plugins
josenavas Mar 14, 2016
ccc1e8f
Cleaning env
josenavas Mar 14, 2016
ef83464
Merge pull request #1680 from josenavas/artifact-study-pages-artifact…
ElDeveloper Mar 14, 2016
990dc14
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 14, 2016
6347d21
initial commit
antgonza Mar 14, 2016
4d153e4
Limiting new user defined terms to alphanumeric + space
josenavas Mar 14, 2016
6f86470
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 14, 2016
1c4c347
Merge branch 'artifact-study-pages-prep-artifact-integration' into ar…
josenavas Mar 14, 2016
efe3415
Merge branch 'artifact-study-pages-prep-artifact-integration' into ar…
josenavas Mar 14, 2016
39c36ba
Merge branch 'artifact-study-page-qiita-client-package' into artifact…
josenavas Mar 14, 2016
4b3f9ce
Creating the biom type plugin and stubbing out the html summary gener…
josenavas Mar 14, 2016
2838e2e
Merge pull request #1684 from antgonza/fix-patch-37
ElDeveloper Mar 14, 2016
01a3ad3
Fixing typo
josenavas Mar 15, 2016
28bb3f9
Adding target gene type plugin
josenavas Mar 15, 2016
aefb908
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 15, 2016
8ea2653
Addressing @ElDeveloper's comments
josenavas Mar 15, 2016
4b2454d
Merge upstream/artifact-study-pages
josenavas Mar 15, 2016
f28f331
Merge pull request #1683 from josenavas/artifact-study-pages-prep-art…
ElDeveloper Mar 15, 2016
f35fcf0
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 15, 2016
4b22aa4
Fixing travis to install the qiita_client
josenavas Mar 15, 2016
d8bf07f
Fixing setup typo
josenavas Mar 15, 2016
fce4c30
Addressing @mortonjt's comment
josenavas Mar 15, 2016
9c97f59
Merge pull request #1685 from josenavas/artifact-study-page-qiita-cli…
antgonza Mar 15, 2016
8503746
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 15, 2016
8eaf5dd
Addressing @antgonza's comments
josenavas Mar 16, 2016
4c84a90
Merge branch 'artifact-study-pages-type-plugins-biom' of https://gith…
antgonza Mar 16, 2016
50a0eb3
Addressing @ElDeveloper's comments
josenavas Mar 16, 2016
2ee35d7
Adding patch method to the QiitaClient
josenavas Mar 16, 2016
6bfd6e2
Fixing docs
josenavas Mar 16, 2016
73cfbd4
Fixing tests due to nomenclature change
josenavas Mar 17, 2016
2379862
Merge pull request #1686 from josenavas/artifact-study-pages-type-plu…
antgonza Mar 17, 2016
0b220dc
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 17, 2016
0bd7d0f
Modify retrieve_filepaths to add an extra parameter 'fp_type'
josenavas Mar 17, 2016
ff3e2fb
Adding artifact.html_summary_fp property
josenavas Mar 17, 2016
7bb82e0
Adding html summary setter
josenavas Mar 17, 2016
d73f43b
Merge pull request #1692 from josenavas/artifact-study-pages-qiita-cl…
antgonza Mar 17, 2016
48238d9
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 17, 2016
2cc5459
Adding html_summary_fp to filepath_type table
josenavas Mar 17, 2016
a55379f
Adding patch method to the ArtifactFilepathsHandler
josenavas Mar 17, 2016
c289715
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 17, 2016
302e0b5
Addressing @antgonza's comment and adding a test
josenavas Mar 17, 2016
221894b
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 17, 2016
7a18077
initial commit
antgonza Mar 17, 2016
3cdd107
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 17, 2016
d67a3ab
Addressing @wasade's comments
josenavas Mar 18, 2016
9c99068
Doing small modifications in the patch due to the method name change
josenavas Mar 18, 2016
78c7ea0
Merge pull request #1687 from josenavas/artifact-study-pages-type-plu…
antgonza Mar 18, 2016
a6d9fed
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 18, 2016
72f863a
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 18, 2016
7d2b4c8
Fixing failing test
josenavas Mar 18, 2016
4f1d9fd
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 18, 2016
02e3644
Adapting the plugin to the new nomenclature
josenavas Mar 18, 2016
4eb0221
Fixing bug and adding test
josenavas Mar 19, 2016
c9db473
Finishing up validation
josenavas Mar 19, 2016
69b1c66
Adding one more test
josenavas Mar 19, 2016
7ddb855
addressing @josenavas comments
antgonza Mar 19, 2016
447e5ef
fixing flake8
antgonza Mar 19, 2016
ee31795
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 19, 2016
61e159c
Merge branch 'artifact-study-pages-type-plugins-tgene' of https://git…
antgonza Mar 19, 2016
191da2c
initial commit
antgonza Mar 20, 2016
af371b0
Merge branch 'artifact-study-pages-adding-biom' into artifact-study-p…
josenavas Mar 20, 2016
3a0eb6e
Merge branch 'artifact-study-pages-type-plugins-tgene' into artifact-…
josenavas Mar 20, 2016
8b0d578
Merge branch 'artifact-study-pages-type-plugins-tgene-summaries' into…
josenavas Mar 20, 2016
4f61979
adding demux summary
antgonza Mar 20, 2016
7b19ea9
Addressing comments
josenavas Mar 21, 2016
2f6fa27
Merge pull request #1694 from josenavas/artifact-study-pages-patch-fi…
antgonza Mar 21, 2016
2823205
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 21, 2016
afc250b
adding get_html_generator classmethod to command
josenavas Mar 21, 2016
419cd21
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 21, 2016
1ba7fbc
Adding artifact_summary_get_request and tests
josenavas Mar 21, 2016
6aee0d5
addressing @ElDeveloper comments
antgonza Mar 21, 2016
903f2e0
Change scripts permissions
josenavas Mar 21, 2016
322c84c
Fixing bug on qiita-plugin-launcher that prevented to log an error on…
josenavas Mar 21, 2016
953e862
Adding artifact_summary_post_request and tests
josenavas Mar 21, 2016
9ba931f
Adding minimal Artifact summary interface
josenavas Mar 21, 2016
1147180
Merge pull request #1696 from antgonza/artifact-study-pages-adding-biom
ElDeveloper Mar 21, 2016
9c5516f
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 21, 2016
b2addd2
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 22, 2016
c119b16
Fixing returns to be the object payload
josenavas Mar 22, 2016
d818a8b
Making the call to generate the artifact
josenavas Mar 22, 2016
e04f478
Fixing return payload
josenavas Mar 22, 2016
b8817c6
doing something with the post output
josenavas Mar 22, 2016
1abf01e
Adding visibility
josenavas Mar 22, 2016
e783180
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 22, 2016
286fd7e
Addressing comments
josenavas Mar 22, 2016
b69fe48
Merge pull request #1697 from josenavas/artifact-study-pages-type-plu…
antgonza Mar 22, 2016
c8c1fbd
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 22, 2016
04e7769
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 22, 2016
96f36d4
addressing @josenavas and @ElDeveloper comments
antgonza Mar 22, 2016
19181de
adding labels, RE: @ElDeveloper
antgonza Mar 22, 2016
b957d4a
Connecting artifact summary with processing
josenavas Mar 22, 2016
47fc001
Merge pull request #1698 from antgonza/artifact-study-pages-type-plug…
josenavas Mar 22, 2016
fa73eb1
displaying processing graph
josenavas Mar 23, 2016
225d9b2
Adding classmethod to command to retrieve commands that process given…
josenavas Mar 23, 2016
4043e9a
Adding outputs property to commands
josenavas Mar 23, 2016
c83d40c
Retrieving correct commands
josenavas Mar 23, 2016
35ddff3
Solgin merge conflicts
josenavas Mar 23, 2016
14aff19
Changin button styles - thanks @ElDeveloper
josenavas Mar 23, 2016
05de2db
Adding comments
josenavas Mar 23, 2016
a81f6a0
changing to **res
josenavas Mar 23, 2016
ce8725c
Removing console.log calls
josenavas Mar 23, 2016
8984c28
Adding list_options_handler_get_req
josenavas Mar 23, 2016
964952a
Forgot to change __init__.py
josenavas Mar 23, 2016
37711a4
Merge branch 'artifact-study-pages-type-plugins-connections' into art…
josenavas Mar 23, 2016
6f42168
for to list comp
josenavas Mar 23, 2016
6015a8c
Adding better way to choose parameters
josenavas Mar 23, 2016
d8db841
Merge pull request #1702 from josenavas/artifact-study-pages-type-plu…
ElDeveloper Mar 23, 2016
a0cb72e
Finishing up load artifact type gui
josenavas Mar 23, 2016
30c578d
Adding workflow_handler_post_req
josenavas Mar 23, 2016
d82c901
Adding type information to the required parameters
josenavas Mar 23, 2016
555156b
Adding required options to the returne objs
josenavas Mar 24, 2016
8f62384
Adding handler for creating a workflow
josenavas Mar 24, 2016
542fe6d
Adding endpoint to create the workflow
josenavas Mar 24, 2016
e398d9c
Completing workflow creation
josenavas Mar 24, 2016
946aef3
Adding patch request to the workflow
josenavas Mar 24, 2016
c360729
Finishing up interface for adding commands
josenavas Mar 24, 2016
a9b8822
Fixing add function in workflow to be able to add a new root job
josenavas Mar 24, 2016
050c1f4
Fixing patch call
josenavas Mar 24, 2016
5725b2e
Fixing a test
josenavas Mar 24, 2016
0dff918
Update JS to successfully be able to add any job
josenavas Mar 24, 2016
ba7ba48
Initial hook-yp to retrieve job info
josenavas Mar 24, 2016
61e5950
Showing processing job information
josenavas Mar 24, 2016
30987c9
Adding test
josenavas Mar 24, 2016
50e1507
Improving documentation
josenavas Mar 24, 2016
14e39cd
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 24, 2016
5207d8c
Hooking up workflow submission
josenavas Mar 24, 2016
f01a357
Allowing cascade removal
josenavas Mar 24, 2016
5c238bc
Hooking up interface and backend
josenavas Mar 24, 2016
5e40cd8
Updating the GUI accordingly after removal
josenavas Mar 24, 2016
dd69406
Fix submission enabling/disabling
josenavas Mar 24, 2016
1119fd6
Addressing @antgonza's comments
josenavas Mar 24, 2016
936098c
Adding JS docs
josenavas Mar 24, 2016
0e0866b
Fixing small bug
josenavas Mar 24, 2016
7f148fe
Show running jobs in the artifact page
josenavas Mar 24, 2016
50504b4
Fixing test
josenavas Mar 24, 2016
3958298
Addressing @antgonza's comments
josenavas Mar 24, 2016
b5686b5
setting not null property later so we can apply the patch
josenavas Mar 24, 2016
80be11e
Fixing bug in patch - and adding test to catch the bug
josenavas Mar 24, 2016
9f53e01
Adding missing var
josenavas Mar 24, 2016
246f619
Adding more missing vars
josenavas Mar 24, 2016
2fd8740
Addressing @ElDeveloper's comments
josenavas Mar 24, 2016
447e7ba
Merge pull request #1707 from josenavas/artifact-study-pages-fix-patches
antgonza Mar 25, 2016
898ffab
Merge pull request #1705 from josenavas/artifact-study-pages-type-plu…
antgonza Mar 25, 2016
22c5743
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 25, 2016
b7aeaa1
Merge pull request #1706 from josenavas/artifact-study-pages-show-procs
antgonza Mar 25, 2016
a6067ee
Making lab person optional
josenavas Mar 25, 2016
0f6d37f
Updating job status at submission
josenavas Mar 25, 2016
e3673e5
Adding download buttons
josenavas Mar 25, 2016
cc70ae3
Fixing tests
josenavas Mar 25, 2016
dbfe1c9
Merge pull request #1708 from josenavas/artifact-study-pages-opt-lab-…
antgonza Mar 25, 2016
f175495
Limiting study edit access to admin, owner and shared users
josenavas Mar 25, 2016
fcde985
Solving merge conflicts - ouch
josenavas Mar 25, 2016
0298f10
Create can_edit function in study so we can re-use
josenavas Mar 25, 2016
00de78d
Limiting edit permissions in the prep template summary
josenavas Mar 25, 2016
2cacd69
Merge pull request #1710 from josenavas/artifact-study-pages-download…
antgonza Mar 25, 2016
07aabe2
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 25, 2016
853acab
Limiting edition privileges in the artifact summary
josenavas Mar 25, 2016
7b02f76
Limit pt visibility for public studies
josenavas Mar 25, 2016
fa9130d
Adding a test
josenavas Mar 25, 2016
017fd89
Propagating the visibility up the parents
josenavas Mar 26, 2016
835fd2a
Filtering graph for public only
josenavas Mar 26, 2016
037e567
Refactoring the sample summary page and limiting edition privileges
josenavas Mar 26, 2016
dc80314
Fixing graph generation
josenavas Mar 26, 2016
61d1e2b
Merge pull request #1711 from josenavas/artifact-study-pages-limit-ac…
antgonza Mar 26, 2016
fac9d70
Addig the data type on the prep template summary
josenavas Mar 26, 2016
a5f6702
Changing default name in the artifact
josenavas Mar 26, 2016
21706e0
Moving edit and delete study to the study information page
josenavas Mar 26, 2016
6f5cdfb
Asking for the title instead of the alias when deleting and improving…
josenavas Mar 26, 2016
c179b68
Adding message when no prep templates has been added, instead of the …
josenavas Mar 26, 2016
23bf2ef
Redirecting to the study listing page when deleting a study
josenavas Mar 26, 2016
1587098
Showing the sample summary link only if there is a sample template fo…
josenavas Mar 26, 2016
fc57793
Fixing bug in default value
josenavas Mar 26, 2016
28554d8
Fix bug preventing to upload a qiime mapping file
josenavas Mar 26, 2016
6798c1e
Disable button if file is not selected
josenavas Mar 26, 2016
49f858f
In the edit page, it was assume that lab person existed
josenavas Mar 26, 2016
6effa7c
Redirecting once the workflow is submitted
josenavas Mar 26, 2016
e1173e2
Merge pull request #1712 from josenavas/artifact-study-pages-misc
antgonza Mar 26, 2016
f9aa2a7
Asking for confirmation before deleting a sample template
josenavas Mar 26, 2016
5820b44
Removing boostrap alert timeout
josenavas Mar 26, 2016
6467a4d
Fixing interface to show/hide the sample summary button accordingly
josenavas Mar 26, 2016
fb569bb
Not showing jobs completed succesfully and showing the error message …
josenavas Mar 26, 2016
0f76906
Merge pull request #1713 from josenavas/artifact-study-pages-misc2
antgonza Mar 26, 2016
f2aa041
Fixing artifact tests
josenavas Mar 26, 2016
4e054f1
Fixing prep template tests
josenavas Mar 26, 2016
6ee1f68
Fixing test processing
josenavas Mar 26, 2016
4a6dd5e
Fixing handler tests
josenavas Mar 26, 2016
1f9dccc
fixing prep template handlers tests
josenavas Mar 26, 2016
6dd28b0
Fixing search tests
josenavas Mar 26, 2016
bed50a4
Fixing software tests
josenavas Mar 26, 2016
6be4450
Fixing test study
josenavas Mar 26, 2016
ce64620
Adding patch operation to the artifact handler
josenavas Mar 26, 2016
4150efc
fixing API
josenavas Mar 26, 2016
9351dbb
Enabling user to change the artifact name
josenavas Mar 27, 2016
203b8ba
Changing buttons color
josenavas Mar 27, 2016
d724dfd
Show the add prep menu item only if there is a sample template added
josenavas Mar 27, 2016
dcb4a51
Merge pull request #1714 from josenavas/artifact-study-pages-assert-i…
antgonza Mar 27, 2016
3277917
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 27, 2016
25891f8
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 27, 2016
9cec1f2
Addressing @antgonza
josenavas Mar 28, 2016
7014f68
Merge branch 'artifact-study-pages-rename-artifacts' into artifact-st…
josenavas Mar 28, 2016
df9ddec
Merge pull request #1715 from josenavas/artifact-study-pages-rename-a…
antgonza Mar 28, 2016
6aed1f3
Adding user artifacts method to the user object
josenavas Mar 28, 2016
d92f4ba
Allow importing artifacts from other studies
josenavas Mar 28, 2016
8365dce
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 28, 2016
9325676
Addressing @ElDeveloper's and @antgonza's comments
josenavas Mar 29, 2016
94017de
initial commit
antgonza Mar 29, 2016
00d110a
Addressing failing test
josenavas Mar 29, 2016
588f63c
Merge pull request #1716 from josenavas/artifact-study-pages-import-a…
antgonza Mar 29, 2016
8664d43
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 29, 2016
2d21661
adding code to tgz
antgonza Mar 29, 2016
684c503
fix #1132, fix #877, fix #16
antgonza Mar 29, 2016
2797a55
Adding safe_submit
josenavas Mar 29, 2016
5175cf7
Offloading sample template processing from the server
josenavas Mar 29, 2016
1057a5e
fixing error
antgonza Mar 30, 2016
3f08333
Offloading prep template update
josenavas Mar 30, 2016
a94d35f
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
josenavas Mar 30, 2016
eb34439
Fixing sample template tests
josenavas Mar 30, 2016
5906c98
Fixin prep template tests
josenavas Mar 30, 2016
f017c03
Adding qiita ware tests
josenavas Mar 30, 2016
ddd16ae
Fixing race condition errors
josenavas Mar 30, 2016
873624a
Addressing @antgonza's comments
josenavas Mar 30, 2016
0ce37cc
Adding missing comment
josenavas Mar 30, 2016
6d8674a
addressing @josenavas comments
antgonza Mar 30, 2016
249e402
initial commit
antgonza Mar 30, 2016
a630f33
fixing error
antgonza Mar 30, 2016
ace249a
addressing @ElDeveloper comments
antgonza Mar 30, 2016
6dcbd5b
fixing conflicts
antgonza Mar 30, 2016
5cc2d7a
Addressing @ElDeveloper's comments
josenavas Mar 30, 2016
0ea7c56
Merge pull request #1718 from antgonza/downlaod-tgz
josenavas Mar 30, 2016
2ca44cc
Merge pull request #1720 from josenavas/artifact-study-pages-offload-…
antgonza Mar 30, 2016
1ee4399
Merge branch 'artifact-study-pages' of https://github.com/biocore/qii…
antgonza Mar 30, 2016
df9e788
Merge pull request #1721 from antgonza/reducing-patches
josenavas Mar 30, 2016
0a38725
rm 40.py
antgonza Mar 30, 2016
26642f5
Merge pull request #1722 from antgonza/removing-40
josenavas Mar 30, 2016
5a23f64
Limit download of raw data
josenavas Mar 30, 2016
16dfc37
Removing directory form the list of files to download
josenavas Mar 30, 2016
b751301
Addressing @ElDeveloper's comments
josenavas Mar 31, 2016
ebfad82
Merge pull request #1725 from josenavas/download-raw-only-owner
antgonza Mar 31, 2016
2edca30
Disabling sorting and reducing font
josenavas Mar 31, 2016
486a63f
Merge pull request #1726 from josenavas/artifact-study-pages-summary
antgonza Mar 31, 2016
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
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ install:
# install a few of the dependencies that pip would otherwise try to install
# when intalling scikit-bio
- travis_retry conda create --yes -n env_name python=$PYTHON_VERSION pip nose flake8
pyzmq networkx pyparsing natsort mock future libgfortran
pyzmq networkx pyparsing natsort mock future libgfortran seaborn
'pandas>=0.15' 'matplotlib>=1.1.0' 'scipy>0.13.0' 'numpy>=1.7' 'h5py>=2.3.1'
- source activate env_name
- pip install sphinx sphinx-bootstrap-theme coveralls ipython[all]==2.4.1
- travis_retry pip install .
- pushd qiita_plugins/target_gene
- travis_retry pip install .
- popd
- pushd qiita_plugins/qiita_client
- travis_retry pip install .
- popd
script:
- export MOI_CONFIG_FP=`pwd`/qiita_core/support_files/config_test.cfg
- if [ ${TRAVIS_PULL_REQUEST} == "false" ]; then
Expand All @@ -42,7 +45,7 @@ script:
- qiita-env make --no-load-ontologies
- if [ ${TEST_ADD_STUDIES} == "True" ]; then test_data_studies/commands.sh ; fi
- if [ ${TEST_ADD_STUDIES} == "False" ]; then qiita-test-install ; fi
- if [ ${TEST_ADD_STUDIES} == "False" ]; then nosetests --with-doctest --with-coverage; fi
- if [ ${TEST_ADD_STUDIES} == "False" ]; then nosetests --with-doctest --with-coverage -v; fi
- flake8 qiita_* setup.py scripts/qiita scripts/qiita-env scripts/qiita-test-install
- ls -R /home/travis/miniconda3/envs/env_name/lib/python2.7/site-packages/qiita_pet/support_files/doc/
- qiita pet webserver
Expand Down
265 changes: 177 additions & 88 deletions qiita_db/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------
from __future__ import division
from itertools import product, chain
from os.path import join
from itertools import product
from os.path import join, basename
from tarfile import open as taropen

from future.utils import viewitems
from biom import load_table
Expand Down Expand Up @@ -467,22 +468,23 @@ def biom_tables(self):
dict
Dictonary in the form {data_type: full BIOM filepath}
"""
with qdb.sql_connection.TRN:
fptypeid = qdb.util.convert_to_id("biom", "filepath_type")
sql = """SELECT data_type, filepath
FROM qiita.filepath
JOIN qiita.analysis_filepath USING (filepath_id)
JOIN qiita.data_type USING (data_type_id)
WHERE analysis_id = %s AND filepath_type_id = %s"""
qdb.sql_connection.TRN.add(sql, [self._id, fptypeid])
tables = qdb.sql_connection.TRN.execute_fetchindex()
if not tables:
return {}
ret_tables = {}
_, base_fp = qdb.util.get_mountpoint(self._table)[0]
for fp in tables:
ret_tables[fp[0]] = join(base_fp, fp[1])
return ret_tables
fps = [(_id, fp) for _id, fp, ftype in qdb.util.retrieve_filepaths(
"analysis_filepath", "analysis_id", self._id)
if ftype == 'biom']

if fps:
fps_ids = [f[0] for f in fps]
with qdb.sql_connection.TRN:
sql = """SELECT filepath_id, data_type FROM qiita.filepath
JOIN qiita.analysis_filepath USING (filepath_id)
JOIN qiita.data_type USING (data_type_id)
WHERE filepath_id IN %s"""
qdb.sql_connection.TRN.add(sql, [tuple(fps_ids)])
data_types = dict(qdb.sql_connection.TRN.execute_fetchindex())

return {data_types[_id]: f for _id, f in fps}
else:
return {}

@property
def mapping_file(self):
Expand All @@ -493,19 +495,34 @@ def mapping_file(self):
str or None
full filepath to the mapping file or None if not generated
"""
with qdb.sql_connection.TRN:
fptypeid = qdb.util.convert_to_id("plain_text", "filepath_type")
sql = """SELECT filepath
FROM qiita.filepath
JOIN qiita.analysis_filepath USING (filepath_id)
WHERE analysis_id = %s AND filepath_type_id = %s"""
qdb.sql_connection.TRN.add(sql, [self._id, fptypeid])
mapping_fp = qdb.sql_connection.TRN.execute_fetchindex()
if not mapping_fp:
return None
fp = [fp for _, fp, fp_type in qdb.util.retrieve_filepaths(
"analysis_filepath", "analysis_id", self._id)
if fp_type == 'plain_text']

_, base_fp = qdb.util.get_mountpoint(self._table)[0]
return join(base_fp, mapping_fp[0][0])
if fp:
# returning the actual path vs. an array
return fp[0]
else:
return None

@property
def tgz(self):
"""Returns the tgz file of the analysis

Returns
-------
str or None
full filepath to the mapping file or None if not generated
"""
fp = [fp for _, fp, fp_type in qdb.util.retrieve_filepaths(
"analysis_filepath", "analysis_id", self._id)
if fp_type == 'tgz']

if fp:
# returning the actual path vs. an array
return fp[0]
else:
return None

@property
def step(self):
Expand Down Expand Up @@ -768,6 +785,34 @@ def remove_samples(self, artifacts=None, samples=None):
qdb.sql_connection.TRN.add(sql, args, many=True)
qdb.sql_connection.TRN.execute()

def generate_tgz(self):
fps_ids = self.all_associated_filepath_ids
with qdb.sql_connection.TRN:
sql = """SELECT filepath, data_directory_id FROM qiita.filepath
WHERE filepath_id IN %s"""
qdb.sql_connection.TRN.add(sql, [tuple(fps_ids)])

full_fps = [join(qdb.util.get_mountpoint_path_by_id(mid), f)
for f, mid in
qdb.sql_connection.TRN.execute_fetchindex()]

_, analysis_mp = qdb.util.get_mountpoint('analysis')[0]
tgz = join(analysis_mp, '%d_files.tgz' % self.id)
try:
with taropen(tgz, "w:gz") as tar:
for f in full_fps:
tar.add(f, arcname=basename(f))
error_txt = ''
return_value = 0
except Exception as e:
error_txt = str(e)
return_value = 1

if return_value == 0:
self._add_file(tgz, 'tgz')

return '', error_txt, return_value

def build_files(self,
rarefaction_depth=None,
merge_duplicated_sample_ids=False):
Expand Down Expand Up @@ -808,81 +853,125 @@ def build_files(self,
# make testing much harder as we will need to have analyses at
# different stages and possible errors.
samples = self.samples

# figuring out if we are going to have duplicated samples, again
# doing it here cause it's computational cheaper
all_ids = list(chain.from_iterable([
samps for _, samps in viewitems(samples)]))
rename_dup_samples = ((len(all_ids) != len(set(all_ids))) and
merge_duplicated_sample_ids)
# 1. merge samples per data_type, reference used and the command id
# if not one of the tables is not 'Pick closed-reference OTUs'
# it's safer to always rename. Note that grouped_samples is
# basically how many biom tables we are going to create
rename_dup_samples = False
grouped_samples = {}
for k, v in viewitems(samples):
a = qdb.artifact.Artifact(k)
p = a.processing_parameters
c = p.command
if c.name != 'Pick closed-reference OTUs':
rename_dup_samples = True
break
l = "%s.%d.%d" % (a.data_type, p.values['reference'], c.id)
if l not in grouped_samples:
grouped_samples[l] = []
grouped_samples[l].append((k, v))
# 2. if rename_dup_samples is still False, make sure that we don't
# need to rename samples by checking that there are not
# duplicated samples per group
if not rename_dup_samples:
for _, t in viewitems(grouped_samples):
# this element only has one table, continue
if len(t) == 1:
continue
dup_samples = set()
for _, s in t:
# this set is not to make the samples unique, cause
# they already are, but cast it as a set so we can
# perform the following operations
s = set(s)
if dup_samples & s:
rename_dup_samples = merge_duplicated_sample_ids
break
dup_samples = dup_samples | s

self._build_mapping_file(samples, rename_dup_samples)
self._build_biom_tables(samples, rarefaction_depth,
self._build_biom_tables(grouped_samples, rarefaction_depth,
rename_dup_samples)

def _build_biom_tables(self, samples, rarefaction_depth=None,
def _build_biom_tables(self, grouped_samples, rarefaction_depth=None,
rename_dup_samples=False):
"""Build tables and add them to the analysis"""
with qdb.sql_connection.TRN:
base_fp = qdb.util.get_work_base_dir()

# this assumes that there is only one reference/pipeline for each
# data_type issue #164
new_tables = {dt: None for dt in self.data_types}
for aid, samps in viewitems(samples):
artifact = qdb.artifact.Artifact(aid)
# this is not checking the reference used for picking
# issue #164
biom_table_fp = None
for _, fp, fp_type in artifact.filepaths:
if fp_type == 'biom':
biom_table_fp = fp
break
if not biom_table_fp:
raise RuntimeError(
"Artifact %s do not have a biom table associated"
% aid)
biom_table = load_table(biom_table_fp)
# filtering samples to keep those selected by the user
biom_table_samples = set(biom_table.ids())
selected_samples = biom_table_samples.intersection(samps)
biom_table.filter(selected_samples, axis='sample',
inplace=True)

if rename_dup_samples:
ids_map = {_id: "%d.%s" % (aid, _id)
for _id in biom_table.ids()}
biom_table.update_ids(ids_map, 'sample', True, True)
_, base_fp = qdb.util.get_mountpoint(self._table)[0]
for label, tables in viewitems(grouped_samples):
data_type, reference_id, command_id = label.split('.')
new_table = None
artifact_ids = []
for aid, samples in tables:
artifact = qdb.artifact.Artifact(aid)
artifact_ids.append(str(aid))

# the next loop is assuming that an artifact can have only
# one biom, which is a safe assumption until we generate
# artifacts from multiple bioms and even then we might
# only have one biom
biom_table_fp = None
for _, fp, fp_type in artifact.filepaths:
if fp_type == 'biom':
biom_table_fp = fp
break
if not biom_table_fp:
raise RuntimeError(
"Artifact %s does not have a biom table associated"
% aid)

# loading the found biom table
biom_table = load_table(biom_table_fp)
# filtering samples to keep those selected by the user
biom_table_samples = set(biom_table.ids())
selected_samples = biom_table_samples.intersection(samples)
biom_table.filter(selected_samples, axis='sample',
inplace=True)
if len(biom_table.ids()) == 0:
raise RuntimeError(
"All samples filtered out from Artifact %s due "
"to selected samples" % aid)

if rename_dup_samples:
ids_map = {_id: "%d.%s" % (aid, _id)
for _id in biom_table.ids()}
biom_table.update_ids(ids_map, 'sample', True, True)

if new_table is None:
new_table = biom_table
else:
new_table = new_table.merge(biom_table)

# add the metadata column for study the samples come from,
# this is useful in case the user download the bioms
study_md = {'Study': artifact.study.title, 'Artifact_id': aid}
samples_md = {sid: study_md for sid in selected_samples}
biom_table.add_metadata(samples_md, axis='sample')
data_type = artifact.data_type

# this is not checking the reference used for picking
# issue #164
if new_tables[data_type] is None:
new_tables[data_type] = biom_table
else:
new_tables[data_type] = \
new_tables[data_type].merge(biom_table)
study_md = {'study': artifact.study.title,
'artifact_ids': ', '.join(artifact_ids),
'reference_id': reference_id,
'command_id': command_id}
samples_md = {sid: study_md for sid in new_table.ids()}
new_table.add_metadata(samples_md, axis='sample')

# add the new tables to the analysis
_, base_fp = qdb.util.get_mountpoint(self._table)[0]
for dt, biom_table in viewitems(new_tables):
if biom_table is None:
continue
# rarefy, if specified
if rarefaction_depth is not None:
biom_table = biom_table.subsample(rarefaction_depth)
new_table = new_table.subsample(rarefaction_depth)
if len(new_table.ids()) == 0:
raise RuntimeError(
"All samples filtered out due to rarefacion level")

# write out the file
biom_fp = join(base_fp, "%d_analysis_%s.biom" % (self._id, dt))
fn = "%d_analysis_dt-%s_r-%s_c-%s.biom" % (
self._id, data_type, reference_id, command_id)
biom_fp = join(base_fp, fn)
with biom_open(biom_fp, 'w') as f:
biom_table.to_hdf5(f, "Analysis %s Datatype %s" %
(self._id, dt))
self._add_file("%d_analysis_%s.biom" % (self._id, dt),
"biom", data_type=dt)
new_table.to_hdf5(
f, "Generated by Qiita. Analysis %d Datatype %s "
"Reference %s Command %s" % (self._id, data_type,
reference_id, command_id))
self._add_file(fn, "biom", data_type=data_type)

def _build_mapping_file(self, samples, rename_dup_samples=False):
"""Builds the combined mapping file for all samples
Expand Down Expand Up @@ -916,7 +1005,7 @@ def _build_mapping_file(self, samples, rename_dup_samples=False):
qm['original_SampleID'] = qm.index
qm['#SampleID'] = "%d." % aid + qm.index
qm['qiita_aid'] = aid
samps = ['%d.%s' % (aid, _id) for _id in samps]
samps = set(['%d.%s' % (aid, _id) for _id in samps])
qm.set_index('#SampleID', inplace=True, drop=True)
else:
samps = set(samps) - all_ids
Expand Down
Loading