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

Generate alpha diversity graphs for each metadata category of interest #209

Closed
wants to merge 20 commits into from

Conversation

squirrelo
Copy link
Contributor

This generates the highlighted category alpha diversity graphs, allowing comparison on the interactive page.

Requires #208

@squirrelo squirrelo changed the title Generate alpha diversity graphs for each metadata category of interest WIP: Generate alpha diversity graphs for each metadata category of interest Apr 21, 2016
@squirrelo
Copy link
Contributor Author

Ready for review

@squirrelo
Copy link
Contributor Author

One test passed one failed due to timeout. Should still be good to review.

@squirrelo squirrelo changed the title WIP: Generate alpha diversity graphs for each metadata category of interest Generate alpha diversity graphs for each metadata category of interest Apr 25, 2016
@squirrelo
Copy link
Contributor Author

ping @EmbrietteH @ekopylova

3 similar comments
@squirrelo
Copy link
Contributor Author

ping @EmbrietteH @ekopylova

@squirrelo
Copy link
Contributor Author

ping @EmbrietteH @ekopylova

@squirrelo
Copy link
Contributor Author

ping @EmbrietteH @ekopylova

filename = '-'.join([name, cleaned_col]) + '.txt'

with open(join(out_dir, filename), 'w') as f:
for otu, val in zip(ids, table.data(col)):
if val == 0.0:
continue
f.write('%s\t%s\n' % (otu, str(val)))


def cat_alpha_plots():

Choose a reason for hiding this comment

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

no unit test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This generates images, and the core function generating the image is tested, so I'm not sure how to unit test this. Do you have suggestions?

Choose a reason for hiding this comment

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

Hmm how about computing the md5 (ex. self.assertFileMD5() in this package)? Otherwise simply verifying your output file (shannon_path, pd_path) exists as you expect?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hesitant to do MD5 because it could be sliiiightly rendered differently depending on the system tests are run on. Checking file is output would work though, and also makes sure the proper naming for files is there so the website can use them. Adding that.

@ekopylova
Copy link

lualatex seems to be a dependency but don't see it mentioned anywhere

@ekopylova
Copy link

@squirrelo a few comments

@squirrelo
Copy link
Contributor Author

The lualatex is needed for rendering the barcode results PDFs.

@squirrelo
Copy link
Contributor Author

Test added for file names, but there is not a way to actually test the graph itself.

@squirrelo squirrelo force-pushed the generate-alpha-diversity-per-sample branch 7 times, most recently from 02a524b to 8b65db1 Compare June 14, 2016 22:58
@squirrelo squirrelo force-pushed the generate-alpha-diversity-per-sample branch from 8b65db1 to cf6cc45 Compare June 14, 2016 23:04
@squirrelo
Copy link
Contributor Author

squirrelo commented Jun 15, 2016

Travis is not behaving for testing the rendering, and given that there are no other tests for rendering in the codebase, how much of a priority/how imperative is it that we have the render tests, given we're not checking the figure that is rendered and instead just the filename.

@josenavas
Copy link
Member

Just checked the error really fast. It looks like the error is saying that the label "70+" is not in the axis. I'm unsure on how the figure is generated and I understand that systems can change the output figure a bit. However, I think that changing the axis is not a small change and it should be ensure that the axis are as we expect. It may be a bit more helpful to see an example of the image generated attached in here.

@squirrelo
Copy link
Contributor Author

That error is the latest in a long string of errors, mostly having to do with the latex not rendering correctly or at all. Only the latest non-working commit is in the PR for brevity's sake.

@squirrelo
Copy link
Contributor Author

Here is an example graph:
pd_stool-age-30s

@squirrelo
Copy link
Contributor Author

Aaaand now tests are passing. Ok, cool.

@josenavas
Copy link
Member

Code looks good - however, before merging, I'm gonna pulldown this code and test it using the latest AG round

@squirrelo squirrelo force-pushed the generate-alpha-diversity-per-sample branch from 2108b73 to 1f24ca0 Compare June 21, 2016 18:31
@squirrelo
Copy link
Contributor Author

ping @josenavas mergable?

@josenavas
Copy link
Member

No it's not:

Exception: Traceback (most recent call last):
  File "/home/jona1883/software/American-Gut/americangut/parallel.py", line 27, in run_functor
    return functor(*args, **kwargs)
  File "/home/jona1883/software/American-Gut/americangut/per_sample.py", line 117, in sample_type_processor
    return merge_error_reports(*[f(opts, ids) for f in functions])
  File "/home/jona1883/software/American-Gut/americangut/per_sample.py", line 307, in alpha_plot
    fp=shannon_path)
  File "/home/jona1883/software/American-Gut/americangut/results_utils.py", line 730, in plot_alpha
    sample_alpha, group_alpha.mean()).expandtabs()
AttributeError: 'tuple' object has no attribute 'expandtabs'

I though you told me that you did not modify the plot alpha function?

@squirrelo squirrelo closed this Jun 23, 2016
@squirrelo squirrelo reopened this Jun 23, 2016
@squirrelo
Copy link
Contributor Author

The only change is to prepend the alpha diversity type, which we discussed offline. Investigating now.

On Jun 23, 2016, at 09:42, Jose Navas notifications@github.com wrote:

No it's not:

Exception: Traceback (most recent call last):
File "/home/jona1883/software/American-Gut/americangut/parallel.py", line 27, in run_functor
return functor(_args, _kwargs)
File "/home/jona1883/software/American-Gut/americangut/per_sample.py", line 117, in sample_type_processor
return merge_error_reports(
[f(opts, ids) for f in functions])
File "/home/jona1883/software/American-Gut/americangut/per_sample.py", line 307, in alpha_plot
fp=shannon_path)
File "/home/jona1883/software/American-Gut/americangut/results_utils.py", line 730, in plot_alpha
sample_alpha, group_alpha.mean()).expandtabs()
AttributeError: 'tuple' object has no attribute 'expandtabs'
I though you told me that you did not modify the plot alpha function?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub #209 (comment), or mute the thread https://github.com/notifications/unsubscribe/AC77mqRD1GneoieEJ3DADL60ob3x8blpks5qOrd8gaJpZM4IMMnD.

@squirrelo
Copy link
Contributor Author

Fixed the issue. Was missing parenthesis.

@squirrelo squirrelo closed this Apr 10, 2018
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.

None yet

3 participants