Giter Club home page Giter Club logo

Comments (5)

RubD avatar RubD commented on July 30, 2024

Hi Stefano,

I have been trying to reproduce this bug, but it actually works fine on my end.

Here is a small example you can run in less than a minute. It did use the development version, which has a couple of other bug fixes but is otherwise completely the same as the current version.

remotes::install_github("RubD/Giotto@cless") 
library(Giotto)

temp_dir = '~/Temp/'
myinstructions = createGiottoInstructions(save_dir = temp_dir,
                                          save_plot = FALSE, 
                                          return_plot = TRUE,
                                          show_plot = FALSE)

expr_path = system.file("extdata", "seqfish_field_expr.txt.gz", package = 'Giotto')
loc_path = system.file("extdata", "seqfish_field_locs.txt", package = 'Giotto')
seqfish_mini <- createGiottoObject(raw_exprs = expr_path,
                                   spatial_locs = loc_path,
                                   instructions = myinstructions)

# processing
seqfish_mini <- filterGiotto(gobject = seqfish_mini, 
                             expression_threshold = 0.5, 
                             gene_det_in_min_cells = 20, 
                             min_det_genes_per_cell = 0)
seqfish_mini <- normalizeGiotto(gobject = seqfish_mini, scalefactor = 6000, verbose = T)
seqfish_mini <- addStatistics(gobject = seqfish_mini)
seqfish_mini <- adjustGiottoMatrix(gobject = seqfish_mini, 
                                   expression_values = c('normalized'),
                                   covariate_columns = c('nr_genes', 'total_expr'))

# dimension reduction
seqfish_mini <- calculateHVG(gobject = seqfish_mini)
seqfish_mini <- runPCA(gobject = seqfish_mini)
seqfish_mini <- runUMAP(seqfish_mini, dimensions_to_use = 1:5, n_threads = 2)
seqfish_mini <- createNearestNetwork(gobject = seqfish_mini, dimensions_to_use = 1:5, k = 5)
seqfish_mini <- doLeidenCluster(gobject = seqfish_mini, resolution = 0.4, n_iterations = 1000)


## provide annotation for the leiden identified groups
clusters_cell_types = c('cell A', 'cell B', 'cell C', 'cell D',
                        'cell E', 'cell F', 'cell G', 'cell H')
names(clusters_cell_types) = 1:8
seqfish_mini = annotateGiotto(gobject = seqfish_mini, 
                              annotation_vector = clusters_cell_types, 
                              cluster_column = 'leiden_clus', 
                              name = 'cell_types')

## default colors
spatPlot2D(gobject = seqfish_mini, point_shape = 'border', cell_color = 'cell_types')
spatPlot2D(gobject = seqfish_mini, point_shape = 'no_border', cell_color = 'cell_types')
spatPlot2D(gobject = seqfish_mini, point_shape = 'voronoi', cell_color = 'cell_types')

## identify your own colors
my_color_code = c('blue', 'pink', 'green', 'yellow', 
                  'purple', 'black', 'orange', 'brown')
names(my_color_code) = clusters_cell_types

spatPlot2D(gobject = seqfish_mini, point_shape = 'border', cell_color = 'cell_types', cell_color_code = my_color_code, point_size = 3)
spatPlot2D(gobject = seqfish_mini, point_shape = 'no_border', cell_color = 'cell_types',  cell_color_code = my_color_code, point_size = 3)
spatPlot2D(gobject = seqfish_mini, point_shape = 'voronoi', cell_color = 'cell_types',  cell_color_code = my_color_code)

from giotto.

stefanonard85 avatar stefanonard85 commented on July 30, 2024

from giotto.

RubD avatar RubD commented on July 30, 2024

Ok, no problem. Let me know if you can't figure it out.

The current Giotto object is currently not directly compatible with the new Giotto Suite object, but it shouldn't be that hard for us to make a conversion function. Thanks for the idea!

Best,
Ruben

from giotto.

stefanonard85 avatar stefanonard85 commented on July 30, 2024

from giotto.

RubD avatar RubD commented on July 30, 2024

Hi Stefano,
No worries and I'm happy you figured it out! Looking forward to see what your viewer can do.
Best,
Ruben

from giotto.

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.