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

ENH: Adding vector visualization for biplots #352

Merged
merged 12 commits into from
Mar 5, 2015

Conversation

mortonjt
Copy link
Contributor

@mortonjt mortonjt commented Mar 2, 2015

Adding in basic vector visualization of taxa. This will ultimately allow easier

  • Visualization of correlations between taxa
  • Visualizing which taxa explains the most variability amongst the samples
  • Visualizing the variance of the taxa

A couple of things will need to be addressed in the future

  1. When taxa are added, both the vectors and spheres are displayed at once. Should there be another toggle to toggle the display of the vectors? For example, the user may want to remove the spheres if they are too clustered, but would want to keep the vectors
  2. What would be a good way to color code the taxa? They are now by default white. It may be useful to color code each vector. For example, when making biplots, I find it useful to color code the phyla

@emperor-helper
Copy link

The test build for this pull request can be found here: http://emperor.colorado.edu/pull_352/make_emperor/

@@ -1,5 +1,5 @@
#!/usr/bin/env python
# File created on 06 Jul 2012
# File reated on 06 Jul 2012
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup ... That was dumb ...

@@ -735,6 +736,7 @@ function colorChanged(catValue,color) {
function colorChangedForTaxaSpheres(color){
for (index in g_plotTaxa){
g_plotTaxa[index].material.color.setHex(color)

Copy link
Member

Choose a reason for hiding this comment

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

Can you remove this extra white-space?

Copy link
Member

Choose a reason for hiding this comment

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

ping on this and the other extra whitespace.

Copy link
Member

Choose a reason for hiding this comment

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

Still this extra whitespace.

@ElDeveloper
Copy link
Member

I like this a lot, thanks!!

When taxa are added, both the vectors and spheres are displayed at once. Should there be another toggle to toggle the display of the vectors? For example, the user may want to remove the spheres if they are too clustered, but would want to keep the vectors.

👍 and I think we would need this as part of this PR (let me know if you need help, I'm super happy to Skpye/Hangouts), otherwise people who wanted to remove the vectors (and reproduce previous plots) would not be able to do it.

What would be a good way to color code the taxa? They are now by default white. It may be useful to color code each vector. For example, when making biplots, I find it useful to color code the phyla

This is something we have discussed a lot. There's #59, #61 and #75. If you don't think what you mean would be covered by any of this issues, please feel free to add a new issue.


Overall the PR looks great, I made a few minor comments and there's a few things that would be missing:

  • Mention on the ChangeLog.md.
  • Mention about these vectors in the make_emperor.py help.
  • A way to turn them off.

mortonjt added 3 commits March 3, 2015 16:41
Also modified toggleBiplotVisitbility function to condense visibility
functionality into a single function
"""Test correct formatting of the footer string"""
# footer for a jackknifed pcoa plot without biplots
out_string = format_emperor_html_footer_string(False, True)
self.assertEqual(out_string, EXPECTED_FOOTER_A)
self.assertItemsEqual(out_string.split('/'), EXPECTED_FOOTER_A.split('/'))
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand what this change is doing, would you mind elaborating?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its just a way to make debugging easier. Before, an entire HTML page would be dumped on the page. Using this will allow only portions of differing HTML to be displayed.

It isn't a big deal though - I can remove it.

Copy link
Member

Choose a reason for hiding this comment

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

I see, this makes sense! A follow-up question, why did you choose '/'?
'\n' makes more sense to me, but then again, I haven't yet used this in
a real-case scenario.

On (Mar-04-15|15:37), mortonjt wrote:

     """Test correct formatting of the footer string"""
     # footer for a jackknifed pcoa plot without biplots
     out_string = format_emperor_html_footer_string(False, True)
  •    self.assertEqual(out_string, EXPECTED_FOOTER_A)
    
  •    self.assertItemsEqual(out_string.split('/'), EXPECTED_FOOTER_A.split('/'))
    

Its just a way to make debugging easier. Before, an entire HTML page would be dumped on the page. Using this will allow only portions of differing HTML to be displayed.

It isn't a big though - I can remove it.


Reply to this email directly or view it on GitHub:
https://github.com/biocore/emperor/pull/352/files#r25826331

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a random common letter ('/' occurs before every major html header). I think '\n' would work just as well.

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer '\n' then. Also, since assertItemsEqual doesn't care
about the order of the elements, we would need to still have the
self.assertEqual check. The first would help developers identify the
lines that need to be updated and the second verifies there's a
consistently and correctly structured HTML string.

On (Mar-04-15|15:45), mortonjt wrote:

     """Test correct formatting of the footer string"""
     # footer for a jackknifed pcoa plot without biplots
     out_string = format_emperor_html_footer_string(False, True)
  •    self.assertEqual(out_string, EXPECTED_FOOTER_A)
    
  •    self.assertItemsEqual(out_string.split('/'), EXPECTED_FOOTER_A.split('/'))
    

Just a random common letter ('/' occurs before every major html header). I think '\n' would work just as well.


Reply to this email directly or view it on GitHub:
https://github.com/biocore/emperor/pull/352/files#r25826838

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@ElDeveloper
Copy link
Member

Looks great, I think we are only missing adding a description about these arrows somewhere in make_emperor.py and it should be ready to be merged!

Removing whitespace, adding semicolons and condensing toggle function
Also updating the changelog and adding additional documentation in the main emperor script
to ease interpretation of taxa vectors

Updating test script to split by newline
@ElDeveloper
Copy link
Member

@mortonjt, just a heads up, it seems like there's legitimate failures.

@mortonjt
Copy link
Contributor Author

mortonjt commented Mar 5, 2015

...

function toggleBiplotVisibility(){
/* Turn on and off the spheres representing the biplots on screen
If the toggleArrow variable is true, then only the visibility of the taxa vectors will be altered
Otherwise, only the visibility of the */
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove this line?

While we don't have any guidelines on this, we try to keep the comments formatted in the following way:

/* Turn on and off the spheres representing the biplots on screen

   If the toggleArrow variable is true, then only the visibility of the taxa vectors will be altered.
*/

@ElDeveloper
Copy link
Member

I think that's good as is, unless I'm missing something.

On (Mar-04-15|17:16), mortonjt wrote:

...

While I'm fixing those errors. Do you think that I should also modify the animate. Namely this line


Reply to this email directly or view it on GitHub:
#352 (comment)

/* Turn on and off the spheres representing the biplots on screen

If the toggleArrow variable is true, then only the visibility of the taxa vectors will be altered
Otherwise, only the visibility of the */
Copy link
Member

Choose a reason for hiding this comment

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

This line should still be removed. And the line above should be aligned with the word Turn that's at the beginning of this block of comments.

@ElDeveloper
Copy link
Member

There's just one minor (nano-comment) comment and this is ready to be merged!

g_mainScene.add(g_plotTaxa[index])
}
}
toggleArrow = typeof toggleArrow !== 'undefined' ? toggleArrow : false;
Copy link
Member

Choose a reason for hiding this comment

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

huh, well, I guess it didn't reduce the LOC, but at least the forloop is much simpler :)

@ElDeveloper
Copy link
Member

Thanks @mortonjt, this is ready to be merged, though there are merge conflicts, would you mind solving them?

@mortonjt
Copy link
Contributor Author

mortonjt commented Mar 5, 2015

I think that should do it

ElDeveloper added a commit that referenced this pull request Mar 5, 2015
ENH: Adding vector visualization for biplots
@ElDeveloper ElDeveloper merged commit ccd8581 into biocore:master Mar 5, 2015
@ElDeveloper
Copy link
Member

Thanks a lot @mortonjt!!

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