Skip to content

Commit

Permalink
fix scripts (#9)
Browse files Browse the repository at this point in the history
* fix scripts

* qiime2-2019.1-py36-linux-conda.yml
  • Loading branch information
antgonza authored and serenejiang committed May 2, 2019
1 parent 1a4c9d9 commit 599b897
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 35 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -10,10 +10,10 @@ before_install:
- ./miniconda.sh -b
- export PATH=/home/travis/miniconda3/bin:$PATH
install:
- wget https://data.qiime2.org/distro/core/qiime2-2018.11-py35-linux-conda.yml
- travis_retry conda env create -n qiime2-2018.11 -q --file qiime2-2018.11-py35-linux-conda.yml
- rm qiime2-2018.11-py35-linux-conda.yml
- source activate qiime2-2018.11
- wget https://data.qiime2.org/distro/core/qiime2-2019.1-py36-linux-conda.yml
- travis_retry conda env create -n qiime2 -q --file qiime2-2019.1-py36-linux-conda.yml
- rm qiime2-2019.1-py36-linux-conda.yml
- source activate qiime2
- pip install flake8
- pip install joblib
- pip install .
Expand Down
6 changes: 5 additions & 1 deletion evident/summarize_mdfdr.py
Expand Up @@ -66,7 +66,7 @@ def summarize(input_fp, output_fp, check_pval):
all_effect_sizes.append((1, (
row.column_name, max_effect_size[0],
np.square(max_effect_size[0]), max_effect_size[1],
pval_corrected, max_effect_size[2])))
pval_corrected, pval)))

if bool(all_effect_sizes):
effect_sizes = pd.DataFrame.from_items(
Expand Down Expand Up @@ -101,6 +101,10 @@ def summarize(input_fp, output_fp, check_pval):
"%s-effect_size_square.pdf" % '.'.join(name)),
bbox_inches='tight')
fig.clf()
else:
raise ValueError("Nothing was found significant. The corrected "
"pvalue should be under %f. For more details "
"try --no-pval-check" % pval_corrected)


if __name__ == '__main__':
Expand Down
9 changes: 8 additions & 1 deletion evident/tests/test-effect-size.py
Expand Up @@ -73,8 +73,15 @@ def test_effect_size_alpha(self):
na_values=na_values,
overwrite=True)

# this should raise a value error
with self.assertRaisesRegex(ValueError, 'Nothing was found '
'significant. The corrected pvalue should '
'be under '):
_mdfdr.summarize(
input_fp=output, output_fp=output, check_pval=True)

# adjusted p-values
_mdfdr.summarize(input_fp=output, output_fp=output, check_pval=True)
_mdfdr.summarize(input_fp=output, output_fp=output, check_pval=False)

# check effect size calculation for gender (two-group categorical)
pfp = partial(join, output)
Expand Down
33 changes: 4 additions & 29 deletions scripts/evident
Expand Up @@ -66,38 +66,13 @@ def summarize_group():
help='output filepath')
@click.option('--check-pval/--no-pval-check', default=True)
@summarize_group.command()
def summarize(input_fp, output_fp, alpha_files, check_pval):
pass
_summarize(input_fp, output_fp, alpha_files, check_pval)


@click.group()
def beta_group():
pass


@click.option('--metadata-fp', type=click.Path(exists=True),
help='metadata filepath')
@click.option('--subject-column', type=str, help='the metadata column that '
'has the subject information')
@click.option('--input_biom', type=click.Path(exists=True),
help='the biom file to process')
@click.option('--rarefaction-level', type=click.Path(exists=True),
help='the biom file to process')
@click.option('--samples-per-subject', type=click.IntRange(1, 1000), default=3,
help='how many samples per subject we should use')
@click.option('--iterations', type=click.IntRange(1, 1000), default=10,
help='how many iterations we should run')
@click.option('--output_folder', type=click.Path(exists=False),
help='output folder')
@beta_group.command()
def beta(metadata_fp, subject_column, input_biom, rarefaction_level,
samples_per_subject, iterations, output_folder):
pass
def summarize(input_fp, output_fp, check_pval):
_summarize(input_fp, output_fp, check_pval)


commands = click.CommandCollection(sources=[
effect_size_group, summarize_group, beta_group])
effect_size_group, summarize_group])


if __name__ == '__main__':
commands()

0 comments on commit 599b897

Please sign in to comment.