Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing picrust output biom files in phyloseq #720

Open
wasimbt opened this issue Mar 1, 2017 · 6 comments
Open

Importing picrust output biom files in phyloseq #720

wasimbt opened this issue Mar 1, 2017 · 6 comments

Comments

@wasimbt
Copy link

wasimbt commented Mar 1, 2017

Dear Joey!

So far I have done all my microbiome analysis on phyloseq. For the last analysis, is there any way to import picrust created biom files into phyloseq?

Thanks in advance!

Wasim

@CarlyMuletzWolz
Copy link

Hi Wasim and Joey,

Any update on this? I'm trying to do the same.

@erictleung
Copy link

@carlyrae @wasimbt Haven't done this myself but here's a comment roughly outlining how to do this. It's a rough overview but seems to do what you're asking for.

@wasimbt
Copy link
Author

wasimbt commented Oct 10, 2017

Hi CarlyRae,

Below is how i did,

##downloaded biomformat package
x = read_biom("Categorize_by_function_level3.biom")
Aj_pathway_major3_function <-import_biom (x)

##This is normal error message ignore (no taxonomy added)
##Error in colnames<-(*tmp*, value = c("ta1", "ta0")) :
##length of 'dimnames' [2] not equal to array extent
##In addition: There were 50 or more warnings (use warnings() to see the first 50)

##Add taxonomy
otumat = as(biom_data(x), "matrix")
OTU = otu_table(otumat, taxa_are_rows=TRUE)
taxmat = as.matrix(observation_metadata(x), rownames.force=TRUE)
TAX = tax_table(taxmat)
TAX
##Taxonomy Table: [328 taxa by 3 taxonomic ranks]:
#KEGG_Pathways1
#1,1,1-Trichloro-2,2-bis(4-chlorophenyl)ethane (DDT) degradation "Metabolism"
#ABC transporters "Environmental Information Processing".....

##Now import mapping file
Aj_map <-import_qiime_sample_data ('AJ_Mapping_file.txt')

##Merge all three files
Aj_f_path3 = phyloseq(OTU, TAX, Aj_map)

Aj_f_path3

It should work for you too,

Cheers!

@wasimbt
Copy link
Author

wasimbt commented Nov 6, 2017 via email

@CarlyMuletzWolz
Copy link

CarlyMuletzWolz commented Nov 6, 2017

Thanks for the reply and help with this. I was actually able to get it to work now. I was having issues with the import_biom call, but it appears that I did not need it.

Read in file created in picrust

y <- read_biom("pathway_predictions.biom")
y

Read in my mapping file

map <- import_qiime_sample_data("Mapping_Ch3_final_selDays.txt")

Add taxonomy to y

otumaty = as(biom_data(y), "matrix")
OTUy = otu_table(otumaty, taxa_are_rows=TRUE)
taxmaty = as.matrix(observation_metadata(y), rownames.force=TRUE)
TAXy = tax_table(taxmaty)
TAXy

Merge all three files

path_1 = phyloseq(OTUy, TAXy, map)
path_1

Following Bletz et al. 2016: Pathways with < 10 counts were removed from the table.

path_2 = filter_taxa(path_1, function(x) sum(x) > 10, TRUE)

Let's rarefy and see if that helps the issues with beta

Yes, need to rarefy for this, otherwise beta differences are driven by differences in sampling depth

min_lib <- min(sample_sums(path_2))
set.seed(4)
path_2 <- rarefy_even_depth(path_2, sample.size = min_lib, verbose = T, replace = TRUE)

Thanks!!

@wasimbt
Copy link
Author

wasimbt commented Nov 6, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants