setInternet2(TRUE)
will only help if you are trying to access a resource on the internet, but you are trying to access a local file. (Is D: a local or networked drive, btw?)
Does the file exist?
run
file.exists("D:/from_qiime/micro/results/otus_open_ref_R1otu_table_mc2_w_tax_no_pynast_failures.biom")
If it says FALSE then the file does not exist. If it says TRUE, then try
file.info("D:/from_qiime/micro/results/otus_open_ref_R1otu_table_mc2_w_tax_no_pynast_failures.biom")
...to get information about the file that might explain why you can't open it (for example, maybe its size is 0 bytes).
If it still looks ok, you could also read the first few lines of the file in to see if they are what you expect:
head(readLines("D:/from_qiime/micro/results/otus_open_ref_R1otu_table_mc2_w_tax_no_pynast_failures.biom"))
You might also try the example for import_biom()
to see that it works as expected:
library(phyloseq)
example(import_biom)
If that works without errors then it's likely the problem is with your file. Perhaps it is not the format that import_biom() expects.
Finally, please update your post to include the output of sessionInfo()
after you load the phyloseq package, this will help us troubleshoot.
I feel like such an idiot, I got the file path wrong - missed a "/". However, when I corrected it I still got an error:
The D drive is an external hard drive plugged into my laptop. Once I corrected the file path, everything else in your post worked as expected.
OK, this indicates (possibly) that the file does not have the contents that import_biom() expects.
I'm not sure exactly beyond that. I'll ask the phyloseq maintainer to have a look at this. They may ask you to share your file so that they can try and reproduce the problem.
file.choose()
provides a point-and-click way of choosing files; also, tab completion works on file paths.It worked!! Thank you!!!
This seems to have caused problems further down the line with the otu table not being read properly
When you say "this", do you mean choosing the file with file.choose() and/or tab-completion? What is the error you are getting? Is it the same one you reported earlier (invalid JSON input)? It would be helpful if you could post the complete session--all the commands you tried and R's response.
I meant file.choose(). Yes, I have been getting the same JSON error. I found another thread that suggests that this may be due to newer versions of qiime producing biom files in a different format which is not read correctly into phyloseq.
https://github.com/joey711/phyloseq/issues/443
I'll check my qiime version later (I didn't use this computer) and see if I can fix it as suggested in that thread. If not, you'll be hearing more from me soon! Thanks so much for all your help.
For reference, here is my console so far: