-
Notifications
You must be signed in to change notification settings - Fork 34
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
Logoplots #534
Logoplots #534
Conversation
The conda tests are failing because the dependency for the conda tests needs to be declared separately here: Line 23 in 6160f37
If you add palmotif in that list it shoud be ok. |
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.
Regarding the function signature, I'm not a big fan of one function that tries to do different things by accepting different, mutually exclusive parameters.
I'd prefer to split it up and have
logoplot_cdr3_motif_length
logoplot_cdr3_motif_gene_segment
logoplot_cdr3_motif_clonotype
where each has only the corresponding parameters. If you want to reuse code between those functions, you can do so by factoring it out into a helper function.
Alternatively, the function could just make a motif of all sequences in the anndata object and we could leave filtering to the user entirely, e.g.
# clonotype
logoplot_cdr3_motif(mdata[mdata.obs["clone_id"] == "42", :]
# length
logoplot_cdr3_motif(mdata[ir.get.airr(mdata, "VJ_1", "junction_aa").str.len() == 15, :])
...
We could also have a combintation of the two where there's one implementation that makes a plot with all sequences in the AnnData object, and the length
, clonotype
and gene_segment
versions are wrappers around the former that do the filtering for the user.
What do you think?
Actually, I was also not a big fan of my solution here, but I wasn't sure if including several similar functions is preferable. I will adapt it accordingly once I rewrote the code so that it properly returns matplotlib plots instead of SVG. I will experiment a little bit, but I am afraid that it's not possible to plot a logo of all sequences as they need to be aligned and this is just the case for junction sequences that have the same length. |
Unless you use the hamming distance, this wouldn't even be guaranteeded for a clonotype I think? I see two options
|
this might be something that palmotif is doing for us (while logomaker does not) and the reason why it requires parasail. |
…Removed AnnData filter functionality
for more information, see https://pre-commit.ci
This will become an issue with future pandas releases. There's even an issue here: Unfortunately, logomaker seems quite unmaintained (last commit 5 years ago), but I couldn't find any better alternatives. If the package really breaks eventually, we can still consider copying the code to scirpy, or forking the repo to scverse or something like that. |
for more information, see https://pre-commit.ci
I've seen one example in a paper where they
See #12 (comment) What do you think of these ideas? |
I have also encountered this many times and I think it would be a nice functionality as the information usually complements each other quite well. However, I am not sure if and how it could work with our current logomaker implementation |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #534 +/- ##
==========================================
- Coverage 81.43% 81.38% -0.06%
==========================================
Files 49 50 +1
Lines 4213 4367 +154
==========================================
+ Hits 3431 3554 +123
- Misses 782 813 +31 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Gregor Sturm <mail@gregor-sturm.de>
Co-authored-by: Gregor Sturm <mail@gregor-sturm.de>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Thanks @MKanetscheider, I think I can take it from here! I'll apply some final cosmetic touches and then merge it :) |
Closes #12
Added the file for sequence motif analysis via logoplots. It works as a wrapper function to the palmotif package. Also added palmotif now to the dependencies together with IPython. The latter was used to help with SVG visualization