Phinch - meyermicrobiolab/Meyer_Lab_Resources GitHub Wiki
Phinch is a visualization framework meant to intake .biom files generated from QIIME2 to produce insightful graphs for its users. This tutorial assumes that you have followed the QIIME tutorial, because we will need the transformed-otu.qza, the taxonomy.txt file, and the metadata.txt file from it.
- Prep the Taxonomy Text File
- Convert the TransformedOTU.qza
- Join the Taxonomy and OTU.biom
- Convert the joined table into .biom
- Add Metadata
- Input into Phinch
The first thing that we will have to do is prep the taxonomy text file to be joined with Phinch. In order for us to convert our OTU.biom into an OTU_w_Tax.biom we need to collapse our taxonomy down to one column. To do this we can use the awk command.
head -n1 your_taxa_table.txt > formatted_taxonomy.txt
awk '{print $1 "\tk__"$2"; p__"$3"; c__"$4"; o__"$5"; f__"$6"; g__"$7}' your_taxa_table.txt >> formatted_taxonomy.tsv
Go back to your QIIME files and find your your-feature-table-transposed.qza. This is the table that we will need to export in order to join with our formatted_taxonomy.txt. When you find it, load QIIME2 and use:
qiime tools export \
--input-path your-feature-table-transposed.qza \
--output-path exported-feature-table
This will output the feature-table.qza into an exported-feature-table folder. We then convert that into a .txt file with
biom convert -i exported-feature-table/feature-table.biom -o otu-table-transposed.txt --to-tsv
This is very similar to how we joined our Taxonomy to our ANCOM statistic. To prep for our new file, we need to get our column names into a new text file.
head -n1 otu-table-transposed.txt > otu_w_tax.txt
Make sure to then open up the otu_w_tax.txt and add a taxonomy
column at the end. Now we have to sort our formatted_taxonomy.txt and our otu-table-transposed.txt so go in and remove the column names from both files.
sort formatted_taxonomy.txt > sorted_tax.txt
sort otu-table-transposed.txt > sorted_otu.txt
join sorted_otu.txt sorted_tax.txt -t $'\t' >> otu_w_tax.txt
biom convert -i otu_w_tax.txt -o otu_w_tax.biom --table-type="otu table" --process-obs-metadata=taxonomy
biom add-metadata -i otu_w_tax.biom -o otu_w_tax_metadata.biom --sample-metadata-fp metadata.txt
Now you should be able to input this data into Phinch.