Coder Social home page Coder Social logo

Comments (6)

cbravo93 avatar cbravo93 commented on July 1, 2024

Hi @ccruizm !

You can create a combined cisTopicObject by merging the count matrices of your samples; for example, you can create the independent cisTopicObjects and then extract the matrices to combine from [email protected]; if needed, you can also extract the metadata from [email protected]. Then you can use the combined matrix as input for createcisTopicObject().

Hope this is useful!

C

from cistopic.

ccruizm avatar ccruizm commented on July 1, 2024

Hello @cbravo93

Thanks for the suggestion. I have merged the matrices, as you suggested. It seems to work, but now I have a problem when I want to plot the tsne and heatmap:

Error in scales::hue_pal(l = 60:100): length(l) == 1 is not TRUE
Traceback:

1. plotFeatures(cisTopicObject, method = "tSNE", target = "cell", 
 .     topic_contr = NULL, colorBy = c("nCounts", "nAcc", "densityClust", 
 .         "orig.ident"), cex.legend = 0.8, factor.max = 0.75, dim = 2, 
 .     legend = TRUE, intervals = 10)
2. .plotFactor(coordinates, variable, feature.names, main = columnName, 
 .     dim = dim, colVars = colVars, plot_ly = plot_ly, legend = legend, 
 .     cex.legend = cex.legend, factor.min = factor.min, factor.max = factor.max, 
 .     cex.dot = cex.dot)
3. setNames(.distinctColorPalette(k = length(levels)), levels)
4. .distinctColorPalette(k = length(levels))
5. t(unique(col2rgb((scales::hue_pal(l = 60:100))(2000))))
6. unique(col2rgb((scales::hue_pal(l = 60:100))(2000)))
7. col2rgb((scales::hue_pal(l = 60:100))(2000))
8. as.character(col) %in% "0"
9. scales::hue_pal(l = 60:100)
10. stopifnot(length(l) == 1)
Error in scales::hue_pal(l = 60:100): length(l) == 1 is not TRUE
Traceback:

1. cellTopicHeatmap(cisTopicObject, method = "Probability", colorBy = c("densityClust"))
2. setNames(.distinctColorPalette(length(unique([email protected][, 
 .     variable]))), as.vector(sort(unique([email protected][, variable]))))
3. .distinctColorPalette(length(unique([email protected][, variable])))
4. t(unique(col2rgb((scales::hue_pal(l = 60:100))(2000))))
5. unique(col2rgb((scales::hue_pal(l = 60:100))(2000)))
6. col2rgb((scales::hue_pal(l = 60:100))(2000))
7. as.character(col) %in% "0"
8. scales::hue_pal(l = 60:100)
9. stopifnot(length(l) == 1)

It seems an issue with the predetermined scale on hue_pal. Do you know how I could solve this issue? Besides, I would like to use UMAP instead of tsne. Have you implemented it in your tool?

Thanks!

from cistopic.

JBreunig avatar JBreunig commented on July 1, 2024

Would you mind sharing your code for merging the 2 - [email protected] and 2 [email protected] objects? I can try on my end to do the UMAP as well.

from cistopic.

ccruizm avatar ccruizm commented on July 1, 2024

Sure @JBreunig

After creating an independent object for each sample, I extracted the count matrix:

matrix_ctr7d <-  [email protected]
matrix_ctr28d <-  [email protected]

Then using Seuratv3, I create a SeuratObject and merge the data, this to append the sampleID to each cell and later, one extract the raw count matrix:

seurat_ctr7d <- CreateSeuratObject(counts = matrix_ctr7d, )
seurat_ctr28d <- CreateSeuratObject(counts = matrix_ctr28d)
control.combined <- merge(seurat_ctr7d, y = seurat_ctr28d,  add.cell.ids = c("ctr7d", "ctr28d"))
control.raw.data <- GetAssayData(control.combined, slot = "counts")

With this combined matrix I create a new cisTopicObject:

cisTopicObject <- createcisTopicObject(control.raw.data, project.name = 'control')

So far, I have not merged the cell.data generated by cellranger into the object.

My concern its how the peaks are handled by cisTopic since the calling is performed separately on different objects, therefore the peaks do not overlap perfectly, and they might be treated as completely different features. I am having issues plotting tSNE to visually asses what is the contribution of each sample per cluster. I am not expecting a big shift or new clusters after the treatment.

I hope this might help you. I expect to solve the issue with the plotting as well so I can have a look at the handling of the merged matrix by cisTopic.

from cistopic.

cbravo93 avatar cbravo93 commented on July 1, 2024

Hi @ccruizm !

  • The hue_pal error should be solved now, it was related to an update in the scales package.
  • There is a wrap function called runUmap to run Umap from a cisTopicObject (on the topic-cell, or the region-topic matrix, you will have to specify).
  • For merging the matrices, it would be better if you used the same region set for all data sets before merging (e.g. do peak calling on the aggregate of all samples, or merge/intersect the peaks). If they are the same peak (with different start/end coordinates) they shouldn't be treated as a different feature.

Let me know if you have more questions!

C

from cistopic.

ccruizm avatar ccruizm commented on July 1, 2024

Thank you very much for your help!

from cistopic.

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.