Skip to content

Commit

Permalink
Merge pull request #45 from jiajic/master
Browse files Browse the repository at this point in the history
🧹
  • Loading branch information
jiajic authored Nov 29, 2023
2 parents fa2ea87 + 25150f6 commit d3c0ace
Showing 1 changed file with 30 additions and 26 deletions.
56 changes: 30 additions & 26 deletions inst/Mini_datasets/Vizgen/mini_vizgen_script.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ tx_dt = data.table::fread(tx_path)

boundary_path = paste0(data_path, '/cell_boundaries/')

z0_polygon_DT = fread(paste0(boundary_path, '/', 'z0_polygons.gz'))
z0_polygon_DT = data.table::fread(paste0(boundary_path, '/', 'z0_polygons.gz'))
z0_polygons = createGiottoPolygonsFromDfr(name = 'z0',
segmdfr = z0_polygon_DT)

z1_polygon_DT = fread(paste0(boundary_path, '/', 'z1_polygons.gz'))
z1_polygon_DT = data.table::fread(paste0(boundary_path, '/', 'z1_polygons.gz'))
z1_polygons = createGiottoPolygonsFromDfr(name = 'z1',
segmdfr = z1_polygon_DT)

Expand All @@ -76,10 +76,12 @@ showGiottoSpatialInfo(vizsubc)

# calculate centroid for each polygon ( = cell)
# this can/will be used when aggregating for example counts to cells
vizsubc = addSpatialCentroidLocations(gobject = vizsubc,
poly_info = paste0('z',0:1),
provenance = list('z0', 'z1'),
return_gobject = TRUE)
vizsubc = addSpatialCentroidLocations(
gobject = vizsubc,
poly_info = paste0('z',0:1),
provenance = list('z0', 'z1'),
return_gobject = TRUE
)
showGiottoSpatLocs(vizsubc)


Expand All @@ -106,23 +108,27 @@ vizsubc = addGiottoImage(gobject = vizsubc,
showGiottoImageNames(vizsubc)

# visualize
spatPlot2D(gobject = vizsubc,
spat_unit = 'z0',
show_image = T,
largeImage_name = 'dapi_z0',
point_shape = 'no_border',
point_size = 2.5,
point_alpha = 0.4,
save_param = list(base_width = 7, base_height = 7))

spatPlot2D(gobject = vizsubc,
spat_unit = 'z1',
show_image = T,
largeImage_name = 'polyT_z1',
point_shape = 'no_border',
point_size = 2.5,
point_alpha = 0.4,
save_param = list(base_width = 7, base_height = 7))
spatPlot2D(
gobject = vizsubc,
spat_unit = 'z0',
show_image = T,
largeImage_name = 'dapi_z0',
point_shape = 'no_border',
point_size = 2.5,
point_alpha = 0.4,
save_param = list(base_width = 7, base_height = 7)
)

spatPlot2D(
gobject = vizsubc,
spat_unit = 'z1',
show_image = T,
largeImage_name = 'polyT_z1',
point_shape = 'no_border',
point_size = 2.5,
point_alpha = 0.4,
save_param = list(base_width = 7, base_height = 7)
)


spatInSituPlotPoints(vizsubc,
Expand Down Expand Up @@ -473,8 +479,7 @@ spatInSituPlotHex(vizsubc,
format(object.size(vizsubc), units = 'Mb')

# you need to use your local GiottoData repo
# giottodata_repo = '/Users/rubendries/Packages/R_Packages/GiottoData/inst/Mini_datasets/'
giottodata_repo = '/Users/rubendries/r_packages/GiottoData//inst/Mini_datasets/'
giottodata_repo = './inst/Mini_datasets/'

saveGiotto(vizsubc,
foldername = 'VizgenObject',
Expand All @@ -483,7 +488,6 @@ saveGiotto(vizsubc,
overwrite = TRUE)

pDataDT(vizsubc, spat_unit = 'aggregate')
pDataDT(vizsubc, spat_unit = 'aggregate')



Expand Down

0 comments on commit d3c0ace

Please sign in to comment.