-
Notifications
You must be signed in to change notification settings - Fork 4
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
microbiomestat ts.levels not plotting correctly in generate_taxa_areaplot_long #24
Comments
Hello @carmennns2, Thank you for reaching out and providing detailed information about the issue you're facing with the
Please try these suggestions and let me know if they help in resolving the issue. Your feedback is crucial for improving the tool, and I appreciate your contribution to making it better. Wishing you success with your analysis and a great year ahead in 2024! Best regards, Chen YANG |
Hello again, Thank you for your response. To further assist you, I want to share an example from my work that might be similar to your situation. This example uses the # Load necessary libraries
library(ggh4x)
library(vegan)
# Load example data
data(ecam.obj)
# Generate the taxa area plot
generate_taxa_areaplot_long(
data.obj = ecam.obj,
subject.var = "studyid", # Using 'studyid' as the subject variable
time.var = "month_num", # Time variable set to 'month_num'
group.var = "studyid", # Grouping by 'studyid'
strata.var = "antiexposedall", # Stratification variable
feature.level = c("Class"), # Feature level set to 'Class'
feature.dat.type = "proportion", # Data type for features
feature.number = 20, # Number of features to display
t0.level = NULL, # Initial time level
ts.levels = NULL, # Time levels
base.size = 10, # Base size for the plot
theme.choice = "bw", # Theme choice for the plot
palette = NULL, # Palette settings
pdf = TRUE, # Output as PDF
pdf.wid = 40, # PDF width set to 40
file.ann = NULL # File annotation
) In this example, the time points are displayed correctly in the resulting plot. The key aspects to note here are the settings for Please try adjusting your parameters similar to this example and see if it resolves the issue with your visualization. If the problem persists, feel free to share more details, and I'll be happy to assist further. Best regards, |
Thank you @cafferychen777 for your quick response! I have changed to code to the following but still have some issues. In response to your suggestions/comments:
After changing the subject.var to "sample_id" and pdf.wid = 49, nothing changed. My plot looks exactly the same as it did in the previous post. Do you have any other suggestions? Thank you so much! |
Hello Carmen, Thank you for providing detailed information about your situation. I have two requests that could help me assist you better:
Looking forward to your response and more details so that we can further investigate and resolve the visualization issue. Best regards. |
Hello @carmennns2, I've thought of a potential solution to the issue you've been experiencing with visualizing the change in taxa across multiple timepoints using the Best regards. |
Hi @cafferychen777, Thank you for your suggestions. Thank you so much for your guidance! All the best, |
Hi @carmennns2, Thank you for reaching out with your question. I'm glad to help you with an example of how to use # Loading the data
data(subset_T2D.obj)
# Extracting unique subject IDs
unique.subject.id <- subset_T2D.obj$meta.dat$subject_id
# Looping over each subject ID
plot.list <- lapply(unique.subject.id, function(subject.id){
# Identifying sample IDs for the current subject
sample.ids <- rownames(subset_T2D.obj$meta.dat[subset_T2D.obj$meta.dat$subject_id == subject.id, ])
# Subsetting data for the current subject
sub_subset_T2D.obj <- mStat_subset_data(subset_T2D.obj, sample.ids)
# Generating taxa area plot for the current subset
generate_taxa_areaplot_long(sub_subset_T2D.obj,
subject.var = "subject_id",
time.var = "visit_number_num",
feature.level = c("Genus"),
feature.dat.type = "count",
file.ann = subject.id)
})
# Further processing or saving the plots can be done here In this example, Please let me know if you have any further questions or need additional clarification. |
Hi @cafferychen777, Thank you for your suggestions. I tried mStat_subset_data, however, because I preferred the figures to all be in one plot, I chose to use generate_taxa_areaplot_long without it. However, in the end, my other issue was that because they all had different starting times (some started at 0, some at 1, 2, etc), So in the end, I decided to completely remove the time in numbers and instead used a categorical variable ("Timepoint0", "Timepoint1", "Timepoint2" etc) so the initial timepoint for all of them was "Timepoint0", and that solved my issue. Thank you so much for all of your kind suggestions and great tool. Carmen |
Dear Carmen, I'm glad to hear you were able to resolve the issue with the timepoints in generate_taxa_areaplot_long! Converting the numeric timepoints to categorical factors makes sense as a workaround given the inconsistencies in start times across samples. Thank you for reporting back on the solution. I appreciate you taking the time to provide those details - it's helpful for me to learn where users are running into problems or limitations using MicrobiomeStat. I'm happy I could provide some initial troubleshooting suggestions. Please feel free to reach out if any other questions come up as you continue your analysis. Best regards, |
Hello,
Thank you for the great tool!
I am trying to visualise the change in taxas across multiple timepoints using generate_taxa_areaplot_long. However, in the visualisation, I am missing some (1)timepoints listed in ts.levels and (2) subject.var (please see screenshot included).
My initial timepoint is "0", and the following timepoints are "1", "2" , "3" , "5" ,"6" , "7", "8" , "10", "12", "18" ,"24". However not all timepoints are present in all samples, and I think this is where the problem lies. For example, one sample might have months 6, 10, 12, 18, 24 and another has 0, 6, 12, 18, etc.
Here are the binary breakdown of the presence/absence of timepoints in each sample_donation.
sample_donation - each sample which has repeated measurements
sample_id - each sample_donation comes from an individual; not balanced, some individuals may have more sample_donations
My code is as follows:
I expected an areaplot with all the different time (months) on the x-axis for each subject.var
Instead, I see only times 10. 12, 18, or 24 shown. Additionally, only the first 6 sample_donations can be seen. The others are blank.
Attempted Solutions
I have tried to enter the values into a vector and use ts.levels = later_tp, but it did not work.
later_tp <- c("1", "2" , "3" , "5" ,"6" , "7", "8" , "10", "12", "18" ,"24")
I have tried to convert the values to numeric, but that also did not work (c(1, 2 , 3 , 5 ,6 , 7, 8, 10, 12, 18 ,24) )
I tried to save the image wider,as I thought there was not enough space.
If you have any suggestions, please let me know. Thank you so much (:
Wishing you a wonderful 2024 !
The text was updated successfully, but these errors were encountered: