Skip to content

Commit

Permalink
Hotfix createGiottoVisiumObject with custom h5 path
Browse files Browse the repository at this point in the history
  • Loading branch information
mattobny committed May 15, 2023
1 parent 22241fb commit 88ca31f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions R/data_evaluation.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ evaluate_cell_metadata = function(metadata,
Setting temporary NA values'))
# set temporary NA values
metadata[, cell_ID := NA_character_]
# re-order so that cell_ID is the first column
data.table::setcolorder(metadata, neworder = "cell_ID")

}

Expand Down
6 changes: 5 additions & 1 deletion R/giotto.R
Original file line number Diff line number Diff line change
Expand Up @@ -1856,13 +1856,17 @@ createGiottoVisiumObject = function(visium_dir = NULL,
} else {
visium_png_list = NULL
}

# Create cell_ID column for metadata
cell_ID = NULL
colnames(spatial_results)[colnames(spatial_results) == "barcode"] = "cell_ID"

# create Giotto object
giotto_object = createGiottoObject(expression = raw_matrix,
expression_feat = 'rna',
spatial_locs = spatial_locs,
instructions = instructions,
cell_metadata = list('cell' = list('rna' = spatial_results[,.(in_tissue, array_row, array_col)])),
cell_metadata = list('cell' = list('rna' = spatial_results[,.(cell_ID, in_tissue, array_row, array_col)])),
images = visium_png_list)
return(giotto_object)

Expand Down

0 comments on commit 88ca31f

Please sign in to comment.