Adding variables with weird character to "gneiss ols-regression" model

When entering a model with weirdly named terms (eg. variables with special characters on their names in the “table.tsv”, etc…) you can help Patsy (the API that handles the regression) escape the special characters by surrounding the term with Q(), which is the Patsy Quote command, and then utilizing single quotes ' to surround the term in order for bash and python to escape the special characters.

Here I’ve used it on some of the “moving pictures” tutorial variables and data:

qiime gneiss ols-regression --p-formula "subject + Q('body-site') + Q('days-since-experiment-start') + Q('reported-antibiotic-usage')" --i-table balances.qza --i-tree hierarchy.qza --m-metadata-file sample-metadata.tsv --o-visualization regression_summary.qzv

Hope this helps! Happy :qiime2:img!

Source: [https://patsy.readthedocs.io/en/latest/quickstart.html](http://Patsy API Documentation)

2 Likes