Skip to content
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

adding rarefy #3

Merged
merged 10 commits into from
Jun 7, 2017
Merged

adding rarefy #3

merged 10 commits into from
Jun 7, 2017

Conversation

antgonza
Copy link
Member

This adds the first command of Q2, rarefy (note that we are using the direct biom call), and all the setup for tests and install to run fine.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling bb62be7 on antgonza:rarefy into ** on qiita-spots:master**.

@antgonza
Copy link
Member Author

Ready for review!


# Initialize the plugin
plugin = QiitaPlugin(
'qiime2', '4.2017', 'QIIME 2')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change the version string? will this be compatible with 2017.4.x? also, note, 2017.5 will be coming out this week

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. Gonna swap values. I guess we need to update the string based on when the final plugin is merged and released in main qiita ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to import the version from qiime2 directly, so we don't have to manually update it? This way it will work with whatever version of q2 is installed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea ...

# Define the rarefy command
req_params = {'i-table': ('artifact', ['BIOM'])}
opt_params = {
'p-sampling-depth': ['integer', '10000']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be 1000 given the dflt_param_set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works.

if not exists(out_dir):
mkdir(out_dir)

rarefied = b.subsample(rarefy_level)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should the function return False if the resulting table is empty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, gonna add a test ...

setup.py Outdated

from setuptools import setup

__version__ = "1.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I think this is the default value we are using on all the plugins, @josenavas, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is a default value for all plugins (in fact, I think it is only used in the deblur plugin because it is matching the deblur version that it implements). Probably using the versioning from Q2 would be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k

setup.py Outdated
Topic :: Software Development :: Libraries :: Application Frameworks
Topic :: Software Development :: Libraries :: Python Modules
Programming Language :: Python
Programming Language :: Python :: 2.7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing ...

Copy link
Member Author

@antgonza antgonza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @wasade, addressed your comments. @josenavas, could you review?


# Initialize the plugin
plugin = QiitaPlugin(
'qiime2', '4.2017', 'QIIME 2')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. Gonna swap values. I guess we need to update the string based on when the final plugin is merged and released in main qiita ...

# Define the rarefy command
req_params = {'i-table': ('artifact', ['BIOM'])}
opt_params = {
'p-sampling-depth': ['integer', '10000']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works.

if not exists(out_dir):
mkdir(out_dir)

rarefied = b.subsample(rarefy_level)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, gonna add a test ...

setup.py Outdated
Topic :: Software Development :: Libraries :: Application Frameworks
Topic :: Software Development :: Libraries :: Python Modules
Programming Language :: Python
Programming Language :: Python :: 2.7
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing ...

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling ca97949 on antgonza:rarefy into ** on qiita-spots:master**.

Copy link
Contributor

@josenavas josenavas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments, in general looks good. My question is why is this added to the qiime2 plugin if this is not using qiime2 at all?

.travis.yml Outdated
- conda install --yes -n qiime2 -c anaconda flake8
- pip install coveralls
- pip install https://github.com/qiita-spots/qiita_client/archive/master.zip
- pip install https://github.com/qiita-spots/qiita-files/archive/master.zip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a dependency, remove.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, thanks.


# Initialize the plugin
plugin = QiitaPlugin(
'qiime2', '4.2017', 'QIIME 2')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to import the version from qiime2 directly, so we don't have to manually update it? This way it will work with whatever version of q2 is installed.


# Define the rarefy command
req_params = {'i-table': ('artifact', ['BIOM'])}
opt_params = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put p-sampling-depth as a required parameter and not provide a default value - I think users should decide this value since it is really study dependent. Having a default value may mislead users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k

}
qiime_cmd = QiitaCommand(
"Rarefy", "Rarefy",
rarefy, req_params, opt_params, outputs, dflt_param_set)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add analysis_only=True since we want this to be available only in the analysis pipeline.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried but I think this in the latest version of the qiita_client:

Traceback (most recent call last):
  File "qp_qiime2/tests/test_qiime2.py", line 21, in <module>
    from qp_qiime2 import plugin
  File "/Users/antoniog/svn_programs/qp-qiime2/qp_qiime2/__init__.py", line 35, in <module>
    analysis_only=True)
TypeError: __init__() got an unexpected keyword argument 'analysis_only'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh - I see. I though the PR was merged. Just checked and there was a test failure on py3 (everything passes on py2). Give me a few minutes and I will update that PR.

setup.py Outdated
scripts=['scripts/configure_qiime2', 'scripts/start_qiime2'],
extras_require={'test': ["nose >= 0.10.1", "pep8"]},
install_requires=['click >= 3.3', 'future'],
dependency_links=[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove since qiita-files is not a dependency.

setup.py Outdated

from setuptools import setup

__version__ = "1.0.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that is a default value for all plugins (in fact, I think it is only used in the deblur plugin because it is matching the deblur version that it implements). Probably using the versioning from Q2 would be better.

Copy link
Member Author

@antgonza antgonza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @josenavas

.travis.yml Outdated
- conda install --yes -n qiime2 -c anaconda flake8
- pip install coveralls
- pip install https://github.com/qiita-spots/qiita_client/archive/master.zip
- pip install https://github.com/qiita-spots/qiita-files/archive/master.zip
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, thanks.


# Initialize the plugin
plugin = QiitaPlugin(
'qiime2', '4.2017', 'QIIME 2')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea ...


# Define the rarefy command
req_params = {'i-table': ('artifact', ['BIOM'])}
opt_params = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k

}
qiime_cmd = QiitaCommand(
"Rarefy", "Rarefy",
rarefy, req_params, opt_params, outputs, dflt_param_set)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k

setup.py Outdated

from setuptools import setup

__version__ = "1.0.2"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k

}
qiime_cmd = QiitaCommand(
"Rarefy", "Rarefy",
rarefy, req_params, opt_params, outputs, dflt_param_set)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried but I think this in the latest version of the qiita_client:

Traceback (most recent call last):
  File "qp_qiime2/tests/test_qiime2.py", line 21, in <module>
    from qp_qiime2 import plugin
  File "/Users/antoniog/svn_programs/qp-qiime2/qp_qiime2/__init__.py", line 35, in <module>
    analysis_only=True)
TypeError: __init__() got an unexpected keyword argument 'analysis_only'

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 0e80429 on antgonza:rarefy into ** on qiita-spots:master**.


from setuptools import setup

from qiime2 import __version__ as qiime2_version
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my only concern about having this like it is right now is that this package assumes that q2 is already installed in order to install this package. Are we ok given that q2 is not pip installable and the recommended installation procedure is conda? If so, can you add a note on the README stating that this package assumes that Q2 is already installed on the active environment, and add a link to q2's installation instructions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that just note that we are doing this based on your suggestion ... pr in a second ...

README.rst Outdated
@@ -0,0 +1,4 @@
# qp-qiime2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that by changing the file format from markdown (md) to rst, the formatting of the file has been lost (check on your branch). Can you either leave it as an md file or format it correctly?

Thanks

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 2aafdea on antgonza:rarefy into ** on qiita-spots:master**.

@antgonza
Copy link
Member Author

k, thanks. change made.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 83dd7ed on antgonza:rarefy into ** on qiita-spots:master**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 83dd7ed on antgonza:rarefy into ** on qiita-spots:master**.

@wasade
Copy link
Contributor

wasade commented Jun 7, 2017

I'm 👍

@josenavas josenavas merged commit fa67440 into qiita-spots:master Jun 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants