error loading feature table into R with read_biom

(Eman Khalaf) #1

Yes, the feature is removed now from feature table, but when I generate my working-file (export biom object), then run R script, I got an error when importing biom file:
Error in read_biom(biom_file = BIOMfilename) : Both attempts to read input file: feature-table-with-taxonomy-json.biom either as JSON (BIOM-v1) or HDF5 (BIOM-v2). Check file path, file name, file itself, then try again.
stop(“Both attempts to read input file:\n”, biom_file, “\n”, “either as JSON (BIOM-v1) or HDF5 (BIOM-v2).\n”, “Check file path, file name, file itself, then try again.”)
read_biom(biom_file = BIOMfilename)
import_biom(biomfile, treefile, fastafile, parseFunction = parse_taxonomy_default)

I guess because of the mismatch of featureID across feature table, rep_seq and taxonomy table. The feature was removed only from feature table artifact??
However, I think the feature table has the parent key for the analysis.

So, I removed the ambiguous feature from rep_seq using this code:
qiime taxa filter-seqs --i-sequences rep_seq.qza --i-taxonomy taxonomy.qza --p-include D_0__ --p-exclude Ambiguous_taxa --o-filtered-sequences sequences-no-ambiguous.qza

and generated a new tree, so the feature is now removed from all files except taxonomy file that based on it feature-table-with-taxonomy.biom file is generated??
However, I still could not import the files in R at this step:
featuretable <- import_biom(biomfile, treefile, fastafile, parseFunction=parse_taxonomy_default)
and got the same error
I am not sure if something else is missing or what I did was incorrect?
May you please help me to figure it out
Thank you

Can not remove a specific feature from feature table
(Colin J Brislawn) #2

Hello Eman,

This sounds like a question about the R package Phyloseq. That’s what I use too :slight_smile:

Here’s how I import data.

no_meta <- import_biom("../data/project_16S_silva.2018_08_08/OTU.biom",

Notice how I just try to import the .biom and .tree file as my first step. Also notice how I’m passing file paths that lead directly to the two files.

Have you used R much before or is this your first time?


1 Like
(Eman Khalaf) #3

I mean the problem now that I have an error after filtration (removing ambiguous taxa), however, I used to upload the files in R using biomformat and phyloseq packages without any problem.
Also, in qiime you can filter feature table, representative_seq and subsequently the tree, but you can not filter the taxonomy table. So, I wonder if that causes a problem in uploading files in R.


1 Like
(Colin J Brislawn) #4

OK. If you have a specific error and question, let me know.

For me, I do all my filtering using Phyloseq, totally outside of Qiime 2. Trying to back and forth between Phyloseq and Qiime can be tricky.


1 Like
(Eman Khalaf) #5

All what I need is to remove a taxon “Ambiguous_taxa” from kingdom to species level. Do you know the best way to remove it from all files/ or from phyloseq object?

Thank you

(Colin J Brislawn) #8

Take a look at how subset_taxa() is used on this page:

subset_taxa(GlobalPatterns, Phylum=="Chlamydiae")

You might be able to do something like this: <- phyloseq %>%
  subset_taxa(Phylum != "Ambiguous_taxa") %>%
  subset_taxa(Class != "Ambiguous_taxa") %>%
  subset_taxa(Order != "Ambiguous_taxa") %>%
  subset_taxa(Family != "Ambiguous_taxa") %>%
  subset_taxa(Genus != "Ambiguous_taxa") %>%
  subset_taxa(Species != "Ambiguous_taxa")

Let me know what you find!

1 Like
(Eman Khalaf) #9

I think I would need to do <- phyloseq %>%
subset_taxa(Kingdom != "Ambiguous_taxa")

so, I would be able to remove that feature from its root, as if I used this hierarchy in removing ambiguous taxa, it will remove all ambiguous taxa from the object, won’t it??
I will give it a try and be back to the forum.

1 Like