joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
582 stars 187 forks source link

Error Importing Tree File #480

Closed yakshiUPR closed 9 years ago

yakshiUPR commented 9 years ago

Hi everyone,

Im new to phylose and I have been trying to get my files to work within the package. I created a folder within the package called "tabe_original" where I placed my OTU table, Mapping file and my tree file.

I followed the tutorial, and this is what I got.

otufile = system.file("tabe_original", "otu_table.txt", package = "phyloseq") mapfile = system.file("tabe_original", "tabebuia_mapping_14mayo2015.txt", package = "phyloseq") trefile = system.file("tabe_original", "rep_phylo.tre", package = "phyloseq") qiimex = import_qiime(otufile, mapfile, trefile, showProgress = FALSE) Processing map file... Processing otu/tax file... Reading file into memory prior to parsing... Detecting first header line... Header is on line 2
Converting input file to a table... Defining OTU table... Parsing taxonomy table... Processing phylogenetic tree... C:/Users/Nyko/Documents/R/win-library/3.2/phyloseq/tabe_original/rep_phylo.tre ... Warning message: In import_qiime(otufile, mapfile, trefile, showProgress = FALSE) : treefilename failed import. It will not be included.

Its not importing the tree file. I also tried to upload the tree file from another folder, and got this:

otufile = system.file("tabe_original", "otu_table.txt", package = "phyloseq") mapfile = system.file("tabe_original", "tabebuia_mapping_14mayo2015.txt", package = "phyloseq") trefile = read.tree(file="rep_phylo.tre") qiimex = import_qiime(otufile, mapfile, trefile, showProgress = FALSE) Processing map file... Processing otu/tax file... Reading file into memory prior to parsing... Detecting first header line... Header is on line 2
Converting input file to a table... Defining OTU table... Parsing taxonomy table... Processing phylogenetic tree... Error in cat(list(...), file, sep, fill, labels, append) : argument 2 (type 'list') cannot be handled by 'cat'

I will appreciate any kind of help or suggestions. Many thanks, Yakshi

CarlyMuletzWolz commented 9 years ago

This is the way I import my information into phyloseq:

library(phyloseq)

BIOM FILE

biom <- import_biom("GM_all.biom", parseFunction = parse_taxonomy_greengenes)

you may get an error message here with the parseFunction. This appears to be that there is a eighth classification which is unassigned that this function does not recognize. You can look at your otu_table to make sure it looks fine.

rank_names(biom) taxtable = tax_table(biom) taxtable[1:10]

note that if you biom file comes from the new QIIME 1.9 then you will have to biom convert it to a json format or phyloseq cannot import it.

code for this is ----- biom convert -i otu_table.biom -o otu_table_json.biom --table-type ="OTU table" --to-json

MAPPING FILE

map <- import_qiime_sample_data("Gorilla_all_map.txt")

TREE FILE

library(ape) tree_Q = read.tree("GM_all.tre") tree_Q is.rooted(tree_Q) any(tree_Q$tip.label == "'OTU_1100'")

randomly root your tree -- or you could put an outgroup in and then trim it after tree is rooted

tree_Q = root(tree_Q, 1, resolve.root = T)

Merge to make your complete phyloseq object

GM <- merge_phyloseq(biom, tree_Q, map) GM

realize here that if any of your OTUs failed in alignment that they will decrease the number of taxa you are looking at. I just realized this recently. You may have to chnage your alignment settings if you want to retain some of these OTUs

ntaxa(biom) ntaxa(GM)

Hope this helps. Might be a better way, works for me at least.

Cheers,

Carly

joey711 commented 9 years ago

I suspect this is closed. Let me know if I'm wrong by posting a reproducible example.