I wanted to do this step " There is not a strong chnage over time in this example. However, we could explore the distance_matrix to test the differences by IBD by looking at pairwise distances with a Mixed Effects Model. How to use and evaluate the q2-longitudinal commands is covered in depth in their tutorial here ."
However, I'm struggling with what to put in the command for the mixed effects model command. The command in the LME tutorial is below, but I don't know how to change it to make it make sense with a distance matrix.
I put question marks next to the parameters that I do not know what to put for.
Do I need to manipulate the distance matrix in any way prior to putting it in here?
Thanks so much for any help you can offer!
Hi @clairewill22 ,
It looks like the CTF tutorial gives some examples for using the outputs with q2-longitudinal further down in the tutorial, and using a distance matrix is not one of these.
Specifically, it looks like the sample trajectory artifact can be used as a metadata input (for volatility) so the same could probably be done with linear-mixed-effects. The PCA coordinates could also be used in the same way... and it looks like there is a specific example of using some downstream results in linear-mixed-effects near the end of that tutorial.
This would be any of those outputs mentioned above (see the CTF tutorial for more details)
This depends on what you use as input. Any of these inputs can be viewed with qiime metadata tabulate, so you can look at the actual column names to use as input.
It looks like the CTF tutorial does not describe how to use the distance matrix... the recommendation seems to be the sample trajectory. If you do want to use a distance matrix, though, you could use the first-distances action in q2-longitudinal to look at the interval distances within each subject.
I hope that gets you on the right track! I can't really answer specifics about CTF, but if you have additional questions just let us know!
Great! Thanks, @Nicholas_Bokulich, this is helpful.
So I decided that I do want to use the "SampleData[SampleTrajectory]" file for the LME, but I tried to visualize this using the metadata tabulate command to find the name of the column and I get the following error:
There was an issue with loading the file state_subject_ordination.qza as metadata:
Metadata file must be encoded as UTF-8 or ASCII. The following error occurred when decoding the file:
'utf-8' codec can't decode byte 0xfe in position 14: invalid start byte
There may be more errors present in the metadata file. To get a full report, sample/feature metadata files can be validated with Keemei: https://keemei.qiime2.org
Find details on QIIME 2 metadata requirements here: https://docs.qiime2.org/2021.4/tutorials/metadata/
I also took a shot in the dark and plugged it into the linear-mixed-effects command specifying the metric as trajectory and also got an error related to encoding saying that there were non-ASCII characters.
Verify the correct quotes or dashes (ASCII) are being used.
Any thoughts on this would be appreciated! Is it an issue with the way the file is being output in the underlying plug in? or something I'm doing wrong. I guess I can extract the data from the .qza file if it comes to that and run the LME model in R... but QIIME is always a nice way to do it!
Looks like these are two (probably) unrelated issues:
It sounds like an invalid character is in the output file. This might be a quirk of the data you are feeding in, or it might be an issue with the CTF plugin, I am not sure. Maybe the developer of CTF @cmartino can advise? He will probably need to inspect your QZA if you do not mind sharing it here.
The LME error sounds different:
This sounds like it has nothing to do with the inputs, merely the command... my guess is that you copied/pasted from the forum and an invisible character got carried along with it (this can happen when copying from from a website), or there is just a typo. Try typing out the command directly.
However, since you are using the same file that could not validate above:
I suspect that the same metadata validation error might occur here if there really is an issue with that file.
That might not work either if the invalid character gets carried over too... so I'd advise sticking with debugging instead of moving on.
But you could also try LME on one of the other outputs, like the PCA coordinates, if only to feel like something is working!
First, thanks for using CTF and posting the question. I can definitely understand the confusion. The sentence in the tutorial is not clear. I am working on updating the tutorials but have not merged them yet. What I meant by that sentence is that the q2-longitudinal linear-mixed-effects on first-distances on the distance matrix on the CTF distance_matrix might help explore global change over time. This would look like the following in the tutorial:
The SampleData[SampleTrajectory] could also be input into the LME (see command below). The column used for --p-individual-id-column will always be re-named to subject_id in the output state_subject_ordination.qza. This is because CTF will sum all the sample x feature counts in the subject x timepoint pairs and we wanted to avoid conflicts with the original metadata. I think your particular error might be because you also included the metadata in the command, which might cause an error since the state_subject_ordination.qza already contains all the metadata columns. So you only need to provide that one file like so:
I did not suggest this or include it in the paper/tutorials because I am unsure of the validity of LME on PC values. If you have some reasoning or literature on the validity, I would be very interested in it. In the end, I primarily stuck with the log-ratios of aggregate features for the LME models and statistics.
I hope this helps and if you have more questions let me know.