yiluheihei / microbiomeMarker

R package for microbiome biomarker discovery
https://yiluheihei.github.io/microbiomeMarker
GNU General Public License v3.0
170 stars 40 forks source link

picrust2_import with system.file #80

Open Lacona opened 2 years ago

Lacona commented 2 years ago

Good morning,

I try to import my picrust2 output into microbiomeMarker for further analysis and visualisation. With my test-dataset the import following the example code of the vignette worked nicely.

sam_tab <- system.file(
  "extdata", "picrust2_metadata.tsv",
  package = "microbiomeMarker")
feature_tab <- system.file(
  "extdata", "path_abun_unstrat_descrip.tsv.gz",
  package = "microbiomeMarker")
ps <- import_picrust2(feature_tab, sam_tab, trait = "PATHWAY")
ps

Then I tried to repeat the import with my sample data and failed. The function is not able to replace the test-dataset-files (path_abun_unstrat_descrip.tsv.gz and picrust2_metadata.tsv) with the new sample-files (path_abun_unstrat_descrip.tsv.gz and picrust2_metadata.tsv) even when the test-files are deleted. I had to go into /Library/Frameworks/R.frameworks/Versions/4.2/Resources/library/microbiomeMarker/extdata to delete the files there! When I then tried to import the sample-files again, the error "files not found" occurred. So I copied the files manually into this Library folder and finally was able to create a phyloseq object:

phyloseq-class experiment-level object
otu_table()   OTU Table:         [ 338 taxa and 60 samples ]
sample_data() Sample Data:       [ 60 samples by 7 sample variables ]
tax_table()   Taxonomy Table:    [ 338 taxa by 2 taxonomic ranks ]

Unfortunately, the anova and all further analyses are not working:

mg_anova <- run_test_multiple_groups(
  ps,
  group = "Group",
  method = "anova"
)
mg_anova
head(marker_table(mg_anova))

Error in str2lang(x) : :1:2: unexpected symbol 1: 1CMET2___PWY ^ Additional: warning: In pre_ps_taxa_rank(ps_normed, taxa_rank) : para taxa_rank is not worked for picrust2 function profile and it will be ignored

mm_lr <- run_sl(
  ps,
  group = "Group",
  nfolds = 2,
  nrepeats = 1,
  taxa_rank = "Genus",
  top_n = 15,
  norm = "TSS",
  method = "LR",
)
marker_table(mm_lr)

Error taxa_rank must be one of all, none, Picrust_trait, Picrust_description

It seems to me that information in my phyloseq objects are missing because the import went wrong. I would very much appreciate help in this matter.

Thank you, Andrea