Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using reader functio to import VisiumHD data #1084

Open
jade-minzlaff opened this issue Dec 24, 2024 · 4 comments
Open

Error using reader functio to import VisiumHD data #1084

jade-minzlaff opened this issue Dec 24, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jade-minzlaff
Copy link

Describe the Error

Hi, I am attempting to follow the workflow demonstrated for VisiumHD analysis in Giotto here: https://drieslab.github.io/Giotto_website/articles/VisiumHD_Human_Colorectal_Cancer.html
To analyze my VisiumHD data with Giotto.

However, despite using the correct Visium HD output folder specified, I get an error when I try to import the Visium HD data. My code:

provide path to visium folder

data_path <- "C:/Users/jadem/OneDrive/Desktop/Batch1_Reanalysis_112524/analysis/spaceranger/FN691/H1-34J9CJZ_A1_FN691_mGEXv2HD/outs/binned_outputs/square_008um"

readerHD <- importVisiumHD()

readerHD$data_path <- data_path

...

Error Message

readerHD$data_path <- data_path
Error in $<-(*tmp*, data_path, value = "C:/Users/jadem/OneDrive/Desktop/Batch1_Reanalysis_112524/analysis/spaceranger/FN691/H1-34J9CJZ_A1_FN691_mGEXv2HD/outs/binned_outputs/square_008um") :
Only items in 'visiumHD_dir', 'expression_source', 'gene_column_index', 'barcodes', 'array_subset_row', 'array_subset_col', 'pxl_subset_row', 'pxl_subset_col' can be set

# Your error message here

To Reproduce

Steps to reproduce the behavior, i.e.:

  1. Following tutorial file '...'
  2. Download data '...'
  3. Run function(s) '...'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.
NOTE: Screenshots of the attempted function call and full error message(s) are helpful for troubleshooting!

System Information
Please replace the following according to your machine:

platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 4.2
year 2024
month 10
day 31
svn rev 87279
language R
version.string R version 4.4.2 (2024-10-31 ucrt)
nickname Pile of Leaves
[1] ‘4.1.6’
Additional context

Add any other context about the problem here.

@jade-minzlaff jade-minzlaff added the bug Something isn't working label Dec 24, 2024
@iqraAmin
Copy link
Contributor

Hi @jade-minzlaff,

Apologies for the inconvenience. I will update the vignette as the data_path argument has been replaced by visiumHD_dir. Please use readerHD$visiumHD_dir instead. To create a Giotto object, you can use the following code:

visiumHD <- readerHD$create_gobject(
    visiumHD_dir = data_path,
    png_name = "tissue_lowres_image.png",
    gene_column_index = 2)

@jade-minzlaff
Copy link
Author

Hi Iqra Amin,

Thank you for your reply, but unfortunately when I use the code chunk you sent, I receive the error: "Error: attempt to apply non-function"

When I add in the other arguments in the Giotto tutorial to what you sent above, I get a similar error message:

For the code:

createGiottoVisiumHDObject(
visiumHD <- readerHD$create_gobject(
visiumHD_dir = data_path,
png_name = "tissue_lowres_image.png",
gene_column_index = 2,
instructions = NULL,
expression_matrix_class = c("dgCMatrix", "DelayedArray"),
cores = NA,
verbose = FALSE)
)

I get the error: "Error in createGiottoVisiumHDObject(visiumHD <- readerHD$create_gobject(visiumHD_dir = data_path, :
attempt to apply non-function"

@iqraAmin
Copy link
Contributor

Hi @jade-minzlaff, createGiottoVisiumHDObject() takes visiumHD directory path as input. You can check the arguments for the function using ?createGiottoVisiumHDObject(). You can use createGiottoVisiumHDObject() as following:

Giotto::createGiottoVisiumHDObject(visiumHD_dir = "path_to_data", 
                                   expr_data = c("raw", "filter"),
                                   gene_column_index = 1)

To use visium HD reader function, use the following.

visiumHD_dir <- "/path/to/data/"
readerHD <- importVisiumHD()
readerHD$visiumHD_dir <- visiumHD_dir
visiumHD <- readerHD$create_gobject(
  visiumHD_dir = visiumHD_dir,
  png_name = 'tissue_lowres_image.png',
  gene_column_index = 2
)

You can use any of the above approaches. Let me know if they work or if you still encounter any issues.

@jade-minzlaff
Copy link
Author

Hi @iqraAmin,

Thank you again for responding. Unfortunately, both of those options still result in errors for me.

Using the createGiottoVisiumHDObject:

provide path to visium folder

data_path <- "C:/Users/jadem/OneDrive/Desktop/Batch1_Reanalysis_112524/analysis/spaceranger/FN691/H1-34J9CJZ_A1_FN691_mGEXv2HD/outs/binned_outputs/square_008um"
Giotto::createGiottoVisiumHDObject(visiumHD_dir = "data_path",
expr_data = c("raw", "filter"),
gene_column_index = 1)

Error:
Warning: filtered_feature_bc_matrix not detected in visiumHD directoryWarning: raw_feature_bc_matrix not detected in visiumHD directoryWarning: spatial not detected in visiumHD directoryA structured visium directory will be used
Error: [Giotto]
path needs to be a path to a visium directory

The path I am giving it to the Visium outout folder which contains filtered_feature_bc_matrix.h5 and raw_feature_bc_matrix.h5 files, despite this error message.

Using the visium HD reader function:

visiumHD_dir <- "C:/Users/jadem/OneDrive/Desktop/Batch1_Reanalysis_112524/analysis/spaceranger/FN691/H1-34J9CJZ_A1_FN691_mGEXv2HD/outs/binned_outputs/square_008um"
readerHD <- importVisiumHD()
readerHD$visiumHD_dir <- visiumHD_dir
visiumHD <- readerHD$create_gobject(
visiumHD_dir = visiumHD_dir,
png_name = 'tissue_lowres_image.png',
gene_column_index = 2
)

Error:
Error in data.table::fread(input = paste0(path_to_data, "/", features_file), :
input= must be a single character string containing a file name, a system command containing at least one space, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or, the input data itself containing at least one \n or \r

Do you have any further suggestions? Thank you again for your responsiveness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants