-
Notifications
You must be signed in to change notification settings - Fork 13
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
pathway_heatmap can't extract columns past the end #118
Comments
Dear l.gallucci, Thank you for reporting this issue with the pathway_heatmap function in the ggpicrust2 package. To better assist you, I'll need some additional information:
Once I have this information, I'll be able to reproduce the issue and work on a solution more effectively. Thank you for your patience and cooperation in resolving this issue. Best regards, |
Dear l.gallucci, Thank you for reporting this issue with the pathway_heatmap function in the ggpicrust2 package. I believe I understand the problem now: The column names in your abundance_file don't match the sample IDs in your metadata file. Specifically:
This mismatch is likely causing the error you're seeing. To resolve this, you need to modify the column names in your abundance_file to match the sample IDs in your metadata file. Here's a suggested solution:
You can do this using the # Assuming your abundance_file is loaded into a dataframe called 'abundance_df'
# and your metadata is loaded into a dataframe called 'metadata_df'
# Get the sample IDs from your metadata
sample_ids <- metadata_df$sample_id # or whatever column contains your sample IDs
# Make sure the number of samples matches
if(length(sample_ids) == ncol(abundance_df) - 1) { # -1 because the first column is likely feature IDs
# Set the column names of abundance_df
colnames(abundance_df)[-1] <- sample_ids
} else {
stop("The number of samples in metadata doesn't match the number of columns in abundance file")
} After making this change, try running your original code again: annotated_kegg <- pathway_annotation(file = abundance_df, pathway = "KO", ko_to_kegg = TRUE)
heat <- pathway_heatmap(annotated_kegg, metadata_df, "Type") If you're still encountering issues after making these changes, please let me know and provide:
This should help resolve the "Can't extract columns past the end" error you were experiencing. Let me know if you need any further assistance! Best regards, |
Dear @cafferychen777 , thank you for the reply. This is what I performed. Sorry I forgot to specify that I'm using dada_id as names for sampleID. Unlikely, even changing this the result is still the same. Apparently, the problems seems to be related to this:
|
Hi @luigallucci , Could you sent the data file to [email protected]? Best, |
I have the same problem. I made sure that the row names in the sample.id column of my metadata and the column names in the abundance file match, but I’m still getting the same error. Sorry if something isn’t clear; I’m not very fluent in English, and I’m a bioinformatics enthusiast. Thanks, and great work! Backtrace:
|
Hi @l.gallucci and @Niyuh04, Thank you for reporting this issue. Based on the error messages and screenshots you've provided, I can help resolve the sample name matching problem in the The error occurs because the function cannot find matching sample names between your abundance data and metadata. Here's how to fix it:
# Check your data
head(colnames(annotated_kegg)) # These should match your metadata sample IDs
head(metadata$sample_id) # Or whatever column contains your sample IDs
# Metadata format
metadata <- data.frame(
sample_id = c("sample1", "sample2", "sample3"), # Must match abundance colnames
Type = c("control", "treatment", "treatment")
)
# Then call the function
pathway_heatmap(
abundance = annotated_kegg,
metadata = metadata,
group = "Type"
) If you're still experiencing issues, please share:
I'll be implementing a fix in the next package update to make the sample name matching more robust and provide clearer error messages. Best regards, P.S. @Niyuh04 - Your English is perfectly clear, no worries! Thank you for providing the detailed error information. |
Describe the Bug
Hi, I'm trying to make the heatmap directly from picrust2 file. I tried to modify the sample column to sample_name or other modification, but nothing worked.
Error in
pull()
:! Can't extract columns past the end.
ℹ Location 1 doesn't exist.
ℹ There are only 0 columns.
Reproducible Example
Environment Information:
The text was updated successfully, but these errors were encountered: