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 in invert option #83

Merged
merged 7 commits into from
Nov 18, 2019
Merged

ENH: Adding in invert option #83

merged 7 commits into from
Nov 18, 2019

Conversation

mortonjt
Copy link
Contributor

@mortonjt mortonjt commented Aug 23, 2019

This PR accomplishes 2 things

  1. Renames samples/features -> points/arrows
  2. Adds an inversion flag to allow for points to be swapped with arrows.

This resolves the following issues

qiime2/q2-diversity#258
biocore/emperor#732
#82

See the following screenshot

image

CC @ElDeveloper @thermokarst @nbokulich

@ElDeveloper
Copy link
Member

This looks good to me overall, although I would be interested to hear from @thermokarst, @nbokulich and @ebolyen on how we should proceed with this backwards incompatible change. Is there a preferred method to deprecate/change user-facing things like these?

@ebolyen
Copy link
Member

ebolyen commented Aug 26, 2019

So we don't have a good mechanism to handle parameter deprecation (yet!). So avoiding that may be best for now. (FWIW, the rename here is incomplete as number_of_features is now "vocabularistically" stranded.)

We also have an transpose action for feature tables now, so I think inverting samples/feature isn't the worst thing, but I totally get the motivation behind this rename, and in the future I am all for it. In the meanwhile having just invert seems like enough to me.

@mortonjt
Copy link
Contributor Author

Terms have been reverted, just the inversion option is added

@mortonjt mortonjt changed the title ENH: Adding in invert option in addition to swapping the samples/feat… ENH: Adding in invert option Aug 29, 2019
@mortonjt
Copy link
Contributor Author

mortonjt commented Oct 2, 2019

Hi @ElDeveloper @ebolyen is there anything outstanding on this?

Comment on lines 86 to 89
features = biplot.features.copy()
samples = biplot.samples.copy()
biplot.samples = features
biplot.features = samples
Copy link
Member

Choose a reason for hiding this comment

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

This is one of those Pythonic patterns that can be done like:

biplot.samples, biplot.features = biplot.features, biplot.samples

@ElDeveloper
Copy link
Member

Let's wait to see if @ebolyen can have a look.

Comment on lines 88 to 89
biplot.samples = features
biplot.features = samples
Copy link
Contributor Author

@mortonjt mortonjt Oct 2, 2019

Choose a reason for hiding this comment

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

@ElDeveloper like this?

Suggested change
biplot.samples = features
biplot.features = samples
biplot.features, biplot.samples = samples, features

Copy link
Member

Choose a reason for hiding this comment

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

I think you can even bypass the intermediate assignment to samples and features.

if invert:
features = biplot.features.copy()
samples = biplot.samples.copy()
biplot.samples = features
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
biplot.samples = features

@mortonjt
Copy link
Contributor Author

mortonjt commented Oct 2, 2019 via email

@ElDeveloper
Copy link
Member

ElDeveloper commented Oct 2, 2019 via email

@mortonjt
Copy link
Contributor Author

mortonjt commented Oct 2, 2019 via email

@ebolyen ebolyen assigned ebolyen and unassigned ebolyen Oct 10, 2019
Copy link
Member

@ebolyen ebolyen left a comment

Choose a reason for hiding this comment

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

This looks good to me! Want me to push a commit with the assignment-swap?

@ebolyen
Copy link
Member

ebolyen commented Oct 12, 2019

Usability question:

Right now, using the invert flag forces us to swap the sample and feature metadata inputs, which isn't quite what I was expecting when I was testing the assignment-swap. Should we assume the orientation is consistent between the ordination and the metadata and it's only the plot that is being inverted, or does the inversion change the semantics of the other parameters?

I think arguments can be made both ways, but I kind of prefer just changing a single flag.

image

@ElDeveloper
Copy link
Member

@ebolyen thanks for bringing this up. The error is particularly confusing since it always refers to samples even if the mismatch is in features. In a recent PR I made a few changes to make this type dependent i.e. by feature or sample. See this PR: biocore/emperor#734

@ebolyen
Copy link
Member

ebolyen commented Nov 8, 2019

Hey all, I played with this in the new emperor just before last release to see if the situation was any different, but same deal as before.

I think passing feature metadata to --m-sample-metadata-file is confusing (and it makes sense why the options were originally renamed). Would it be possible to leave the association between the arguments and parameters alone, and instead just flip the arrows/points internally?

@mortonjt
Copy link
Contributor Author

mortonjt commented Nov 8, 2019

yea - the naming scheme is rather unfortunate; changing the names to something more abstract (i.e. points / arrows) would be preferable.

@ebolyen what do you mean by flip the arrows / points internally? Would this nullify the use case for the invert option?

@ebolyen
Copy link
Member

ebolyen commented Nov 8, 2019

Sorry I mean that the samples are always samples and features are always features, but when you set invert you are choosing to draw the samples as arrows instead of points. So by internal, I mean from the outside nothing looks different (other than passing the single flag).

I think this makes more sense as now the arguments are always matched with their parameters, and you can just ask them to be drawn different from the default.

@ebolyen
Copy link
Member

ebolyen commented Nov 8, 2019

@mortonjt @ElDeveloper, does that last commit seem like a reasonable way to do this?

@ebolyen ebolyen removed their assignment Nov 8, 2019
@thermokarst
Copy link
Contributor

Pinging @mortonjt & @ElDeveloper (please see @ebolyen's request above)

Copy link
Member

@ElDeveloper ElDeveloper left a comment

Choose a reason for hiding this comment

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

This looks good to me!

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