> otu_and_tax.ps <- import_biom("~/../Desktop/Shared_Folder/otu_json_w_tax.biom") Error in fromJSON(content, handler, default.size, depth, allowComments, : invalid JSON input
otu_and_tax.ps <- import_qiime("~/../Desktop/Shared_Folder/otu_tax.txt") 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... Error in names(taxlist) <- rownames(x) : 'names' attribute [296] must be the same length as the vector [0] In addition: Warning message: In `[.data.table`(x, , `:=`(`Consensus Lineage`, NULL)) : Adding new column 'Consensus Lineage' then assigning NULL (deleting it).
> readLines("~/../Desktop/Shared_Folder/otu_json_w_tax.biom") [1] "‰HDF
To get around this I just converted the biom file to .txt (biom convert -i otu_json_w_tax.biom -o otu_tax.txt --to-tsv --header-key taxonomy --output-metadata-id "ConsensusLineage") I then deleted the "#constructed from biom file" header in the first row of the file.
The readLines function recognizes the path to this txt. file
> readLines("~/../Desktop/Shared_Folder/otu_tax.txt") [1] "#OTU ID\t3\t1G\t12\t8R\t8\t15R\t10R\t2R\t17\t19N\t6\t13N\t1R\t15G\t11G\t10N\t20G\t19G\t14\t14R\t18R\t3G\t2\t5N\t11N\t10\t19\t16\t20\t17N\t12N\t13\t15\t18\t1\t4\t8G\t16G\t9G\t11R\t7\t9N\t11\t17G\t9\t13R\t4G\t5\t17R\tConsensusLineage" [2] "OTU_31\t1119.0\t2.0\t0.0\t1013.0\t945.0\t0.0\t1.0\t505.0\t423.0\t616.0\t1323.0\t0.0\t0.0\t0.0\t1.0\t0.0\t564.0\t216.0\t0.0\t0.0\t308.0\t239.0\t1048.0\t634.0\t0.0\t0.0\t556.0\t0.0\t869.0\t432.0\t2.0\t1.0\t0.0\t765.0\t0.0\t1.0\t422.0\t0.0\t653.0\t0.0\t3.0\t1210.0\t1.0\t501.0\t1501.0\t1.0\t0.0\t959.0\t401.0\tk__Bacteria; p__Firmicutes; c__Clostridia; o__Clostridiales; f__Ruminococcaceae; g__Ruminococcus" etc...
otu_and_tax.ps <- import_qiime("~/../Desktop/Shared_Folder/otu_tax.txt") 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... Error in names(taxlist) <- rownames(x) : 'names' attribute [296] must be the same length as the vector [0] In addition: Warning message: In `[.data.table`(x, , `:=`(`Consensus Lineage`, NULL)) : Adding new column 'Consensus Lineage' then assigning NULL (deleting it).