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

Restore prior efficiency by making matching a ton faster (also make -x filtering faster) #174

Merged
merged 3 commits into from
Jul 4, 2019

Conversation

fedarko
Copy link
Collaborator

@fedarko fedarko commented Jul 4, 2019

tl;dr—taking the transpose of a huge feature table in pandas is super intensive, as is calling .loc[] on said huge feature table.

Fortunately, there's the DataFrame.align() method, which lets us delegate most of this work to pandas. This is much, much faster than matchdf().

(And we get around the transpose issue now by temporarily transposing the sample metadata instead of the feature table—generally, the sample metadata should be a lot smaller. I think this might be a pandas bug, actually? see pandas-dev/pandas#22630 -- will try to report on something there)

In any case, it's now pretty fast again to run the EMP dataset (with poisson-cat differentials) through Qurro (assuming -x 2000 is passed, as before).

This should represent a pretty decent performance boost (#172)
Turns out this is a ton more efficient. Added bonus of now relying
on pandas' implementation of this instead of ours.

Turns out transposing huge dataframes is a pretty significant
endeavor, so calling .T on the feature table for like the EMP dataset
was taking a super long time. Fortunately, we can finesse our way
around this by instead transposing the sample metadata and then
aligning on the columns.

I'm glad that we reached a solution for this that preserved
all of the matching-up-front niceness re: testing. Solid stuff.

Uh, next up are #171 and then #58? But we can def merge this back
into master now.
@fedarko fedarko merged commit ed46b68 into master Jul 4, 2019
@codecov-io
Copy link

Codecov Report

Merging #174 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #174      +/-   ##
==========================================
+ Coverage   91.92%   91.95%   +0.03%     
==========================================
  Files          15       15              
  Lines        1040     1044       +4     
  Branches      180      180              
==========================================
+ Hits          956      960       +4     
  Misses         69       69              
  Partials       15       15
Impacted Files Coverage Δ
qurro/_rank_utils.py 93.93% <100%> (ø) ⬆️
qurro/_df_utils.py 96.87% <100%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 339f102...b8c90ba. Read the comment docs.

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.

2 participants