-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Nichesort #16
Nichesort #16
Conversation
@mortonjt can you pull from upstream/master? |
@@ -0,0 +1,81 @@ | |||
import numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing license notice.
Some comments. Thanks @mortonjt |
np.float : | ||
The mean gradient that the organism lives in. | ||
""" | ||
if len(abundances) != len(gradient): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel strongly about this but normally we do something like this to minimize how many times you calculate the lenght of the iterables:
len_abundances = len(abundances)
len_gradient = len(gradient)
if len_abundances != len_gradient:
....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
some more comments. |
Thanks for taking the time to review this! All comments have been addressed. |
# normalizes the proportions of the organism across all of the | ||
# samples to add to 1. | ||
v = abundances / abundances.sum() | ||
m = np.dot(gradient, v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line really doing this:
E[g | x] = \frac{1}{\sum\limits_{j=1}^N x_j} \sum\limits_{i=1}^N x_i g_i
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup
On Jul 27, 2016 11:56 AM, "Antonio Gonzalez" notifications@github.com
wrote:
In gneiss/sort.py
#16 (comment):
- ValueError:
If the length of `gradient` contains nans.
- """
- len_abundances = len(abundances)
- len_gradient = len(gradient)
- if len_abundances != len_gradient:
raise ValueError("Length of `abundances` (%d) doesn't match the length"
" of the `gradient` (%d)" % (len_abundances,
len_gradient))
- if np.any(pd.isnull(gradient)):
raise ValueError("`gradient` cannot have any nans.")
normalizes the proportions of the organism across all of the
samples to add to 1.
- v = abundances / abundances.sum()
- m = np.dot(gradient, v)
Is this line really doing this:
E[g | x] = \frac{1}{\sum\limits_{j=1}^N x_j} \sum\limits_{i=1}^N x_i g_i—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/biocore/gneiss/pull/16/files/23acedfd2291c0b3716023c9867c2629b1c16dc4#r72501098,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AD_a3cfBc1UiQuuaW3PR3kUGYTYwh3Fcks5qZ6m_gaJpZM4JUnpZ
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pd.DataFrame : | ||
Sorted table according to the gradient of the samples, and the niches | ||
of the organisms along that gradient. | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing raises section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doh. Added
Thanks @mortonjt ! The comments really help to fully understand what is going on in the code! Just a minor comment about missing a section in the docs and I think this is good to go! |
Good to merge - I just realized that I don't have merge privileges here |
Thanks for your insights on this! This feedback is seriously improving the usability of this module. |
Depends on #12.
Used to generate band tables when the gradient is known.