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

Using the test dataset: Error in x[, ii] : subscript out of bounds. #127

Open
Lacona opened this issue Nov 28, 2024 · 2 comments
Open

Using the test dataset: Error in x[, ii] : subscript out of bounds. #127

Lacona opened this issue Nov 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Lacona
Copy link

Lacona commented Nov 28, 2024

Hello Dr. Yang, how are you?

MacOS Sequoia 15.1.1
R 4.4.2
ggpicrust2 1.7.4

I am having difficulties running ggpicrust2() on my own data but also on your test-datasets. The error message is:
Error in x[, ii] : subscript out of bounds.

The code was cp from here:

library(readr)
library(ggpicrust2)
library(tibble)
library(tidyverse)
library(ggprism)
library(patchwork)
library(ggplot2)
data(ko_abundance)
data(metadata)
results_file_input <- ggpicrust2(data = ko_abundance,
                                 metadata = metadata,
                                 group = "Environment",
                                 pathway = "KO",
                                 daa_method = "LinDA",
                                 ko_to_kegg = TRUE,
                                 order = "pathway_class",
                                 p_values_bar = TRUE,
                                 x_lab = "pathway_name")

This is the output:
Starting the ggpicrust2 analysis...
Converting KO to KEGG...
Processing provided data frame...
Loading KEGG reference data. This might take a while...
Performing KO to KEGG conversion. Please be patient, this might take a while...
|===========================================================================================| 100%
KO to KEGG conversion completed. Time elapsed: 0.02 seconds.
Removing KEGG pathways with zero abundance across all samples...
KEGG abundance calculation completed successfully.
Performing pathway differential abundance analysis...
Using column 'sample_name' as sample identifier
Running LinDA analysis...
Error in x[, ii] : subscript out of bounds

To find out more about the problem I started to run it step by step on the test dataset.

data(ko_abundance)
kegg_abundance <- ko2kegg_abundance(data = ko_abundance) 

successfuly generates the variable kegg_abundance but with 0 observations of 50 variables, which is basically an empty dataframe:
Processing provided data frame...
Loading KEGG reference data. This might take a while...
Performing KO to KEGG conversion. Please be patient, this might take a while...
|===========================================================================================| 100%
KO to KEGG conversion completed. Time elapsed: 0.10 seconds.
Removing KEGG pathways with zero abundance across all samples...
KEGG abundance calculation completed successfully.

Running the next step

daa_results_df <- pathway_daa(kegg_abundance, metadata = metadata, group = "Environment", daa_method = "LinDA")

generates the error:
Using column 'sample_name' as sample identifier
Running LinDA analysis...
Error in x[, ii] : subscript out of bounds

Could you please help me fixing this?

@Lacona Lacona added the bug Something isn't working label Nov 28, 2024
@cafferychen777
Copy link
Owner

Dear Lacona,

Thank you for reporting this issue and providing such detailed information about the error you're encountering. I recently resolved a similar issue about an hour ago and pushed an update to address this problem.

Could you please try the following steps:

  1. Update your ggpicrust2 package to the latest version:
remotes::install_github("cafferychen777/ggpicrust2")
  1. Restart your R session and try running your analysis again.

If you're still experiencing the "subscript out of bounds" error after updating, please let me know, and I'll conduct additional testing to identify the root cause.

For reference, could you also confirm your package version after updating by running:

packageVersion("ggpicrust2")

Please don't hesitate to reach out if the issue persists.

Best regards,
Chen

@Lacona
Copy link
Author

Lacona commented Dec 2, 2024

Thank you so much, that solved the problem and ggpicrust2 runs without errors now.

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