Git Product home page Git Product logo

Comments (8)

johannesostner avatar johannesostner commented on June 12, 2024

Hi! Thanks for reporting this bug!

From what I can tell from your description, the issue arises due to the indices of data_scanpy_1.X and data_scanpy_1.obs being misaligned. This could happen in dat.from_scanpy because anndata does not check automatically if indices align. I just pushed a fix for this in the branch update_0.1.6. I hope that this solves the problem!

from sccoda.

mhulke avatar mhulke commented on June 12, 2024

Thanks. I'm working in Terra with scCODA installed via pip. How do I go about pulling the fix?

from sccoda.

johannesostner avatar johannesostner commented on June 12, 2024

You can install an exact branch from github with pip: pip install git+https://github.com/theislab/scCODA.git@update_0.1.6.

The version number of your scCODA installation should then be 0.1.6. If not, you can try uninstalling scCODA (pip uninstall sccoda) before installing with the same command as above.

from sccoda.

mhulke avatar mhulke commented on June 12, 2024

I was able to download it and I can see version 0.1.6 in my packages folder, but I am still getting the same mismatched output. Could something else be causing the problem?

from sccoda.

johannesostner avatar johannesostner commented on June 12, 2024

Hmm, then there seems to be another issue that causes this problem. Could you please help me pinning down the cause of it by checking whether the rows in your data_scanpy_1.X (cell counts) and in data_scanpy_1.obs (covariates) are correctly matched (e.g. does row 10 in data_scanpy_1.X contain lots of cell type 5 or is it row 20)?

Also, you could plot viz.stacked_barplot(data_scanpy_1, feature_name="samples",cmap=umap_cmap) to plot the data with the index of data_scanpy_1.obs as the x-axis labels, if you are more familiar with these labels than with the numbers 1-20.

Thanks in advance!

from sccoda.

mhulke avatar mhulke commented on June 12, 2024

viz.stacked_barplot(data_scanpy_1, feature_name="samples",cmap=umap_cmap)

image

data_scanpy_1.obs:
image

Now it seems like the samples are lined up correctly. Sample WR_4396_AS4 is the correct sample containing cell type 5. But now it looks like I can't put the data in the order I assign in cov_df. If I assign the samples numbers 1-20 based on the treatment, it mixes them up as such:

viz.stacked_barplot(data_scanpy_1, feature_name="Cond",cmap=umap_cmap)
image

from sccoda.

johannesostner avatar johannesostner commented on June 12, 2024

I'm glad that the samples and metadata are aligned now. This is the bug that I tried to fix with the new version.

The plotting function uses per default the same order as the data, which is the order in data_scanpy_1.X (the cov_df was shuffled in order to match the order of samples there). To order the x-axis in the plot, you can set the desired order in the level_order argument, in your case: viz.stacked_barplot(data_scanpy_1, feature_name="Cond",cmap=umap_cmap, level_order=['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20']).

I hope that this gives you the desired plot!

from sccoda.

mhulke avatar mhulke commented on June 12, 2024

Awesome. Thank you. Everything is looking good now.

from sccoda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.