Hello all, and thank you in advance for your time.
My question relates to the rooted-tree.qza created in QIIME 2 2019.4, and how to change the tip labels from sequence IDs from DADA2 to taxa annotations, using R.
I have exported rooted-tree.qza to newick format:
qiime tools export
--input-path rooted-tree.qza
--output-path exported-tree
...and uploaded it to R using the package 'ape':
phy <- read.tree(file = "tree.nwk")
Additionally, I have exported and modified the taxonomy.qza created with SILVA classifier.
qiime tools export taxonomy.qza --output-dir exp-tree
echo $'LABELS\nSEPARATOR TAB\nDATA' > taxonomy.txt
sed "1d" taxonomy.tsv | cut -f1,2 >> taxonomy.txt
I then uploaded taxonomy.txt as a df in R, as seen below:
head(newtips)
seq.id
1 677dc4d80ebf1de5f0abff920ff79a3e
2 6bf1a63f1d1b1de9479fb487edb3c077
3 1170dd578d8b706ee98d951cc6c6e6b0
4 7059e70b32a6e91148afa4a361a2f2ef
5 96d7fe52dfcf9a158701479bd8af75e0
6 ff232c0997800a1e4b231ac8856f682a
taxa
1 D_0__Archaea;D_1__Euryarchaeota;D_2__Methanomicrobia;D_3__Methanosarcinales;D_4__Methanosarcinaceae;D_5__Methanolobus
2 D_0__Bacteria;D_1__Proteobacteria;D_2__Gammaproteobacteria;D_3__Enterobacteriales;D_4__Enterobacteriaceae;D_5__Escherichia-Shigella
3 D_0__Bacteria;D_1__Cyanobacteria;D_2__Oxyphotobacteria;D_3__Chloroplast
4 D_0__Bacteria;D_1__Cyanobacteria;D_2__Oxyphotobacteria;D_3__Chloroplast
5 D_0__Bacteria;D_1__Bacteroidetes;D_2__Bacteroidia;D_3__Bacteroidales;D_4__Bacteroidetes vadinHA17
6 D_0__Bacteria;D_1__Proteobacteria;D_2__Deltaproteobacteria;D_3__Syntrophobacterales;D_4__Syntrophaceae;D_5__Syntrophus
My goal is to match the sequence IDs on my tree (vector named phy) to the annotations dataframe (newtips). I have attempted to use join(), to replace the IDs, as seen below:
phytips <- phy$tip.label
relabeled.phy <- join(newtips, phytips)
...but this has been unsuccessful. I have also annotated my tree using iTOL, yet my exported newick file is saved as .txt, posing new and additional difficulty. I am open to any suggestions?
Thank you for your patience and help,
Jessica