Issues using qiime2R


(Fabiola ) #1

Hi Jbisanz

I am trying to go through the steps in your tutorial, but I keep getting this error:

> SVs<-read_qza(“table.qza”)
Error in unzip(file, exdir = tmp) : ‘exdir’ does not exist

I have set my working directory to where the files are located, and have googled to see if there is a way to fix this, but no luck.

Thanks


Tutorial: Integrating QIIME2 and R for data visualization and analysis using qiime2R
(Fabiola ) #2

Hi,

I was going through your tutorial, and I am stumped on one portion. I am trying to concert the taxonomy data into a tabular split version of itself, using your code above. After running the code, I see that the data does not split as suggested, and the taxonomy levels instead are filled with “NA”. Could you please give me some input?

image


(Fabiola ) #3

Hi, I have a quick question on running alpha and beta diversity in R-studio.

I tried the code you supplied and changed the variables to those I am interested in, but I keep getting this error.I have looked online, but I am not having luck finding a method to fix it.

Aesthetics must be either length 1 or the same as the data (192): x, y, shape, colour, size

thanks


(Jordan Bisanz) #4

My best guess is that you made a typo in your variable name in the mapping aesthetics (aes) portion. I believe this error happens if the column name doesn’t exist in the input data to ggplot. Check this and if it doesn’t fix your problems can you please upload either the artifact itself or an RDS file of your pca object? Please include your exact code as well.


(Fabiola ) #5

Hi, I actually fixed this error, but forgo to delete my question. I do have another question, and although I’ve spend 2 hours trying to figure it out, I cannot.

When I try to recreate the alpha diversity in R, I get this error
Error: Aesthetics must either be length one, or the same length as the data

This is my code:
#PLOTTING ALPHA DIVERSITY
obsOTU$data %>%
as.data.frame() %>%
rownames_to_column("#SampleID") %>%
left_join(metadata) %>%
mutate(TimeSinceFire=as.numeric(TimeSinceFire)) %>% #coerce this to be stored as number
ggplot(aes(x=TimeSinceFire, y=obsOTU, group=Treatment, color=Site, shape=Unit)) +
geom_point(size=8) +
geom_line() +
facet_grid(Site~Treatment) + #plot body sites across rows and subjects across columns
theme_bw() +
xlab(“TimeSinceFire (years)”) +
ylab(“Observed OTU’s”) +
ggtitle(“Observed OTU’s across time”)

I am mimicing what you have done, just to see if I undestand, but I am stuck.

If you could please help me out that would be great, and if you have any other tutorials, please let me know. I am currently trying to create a PCA, but I am unsure how to do with qiime outputs.


(Jordan Bisanz) #6
obsOTU$data %>%
as.data.frame() %>%
rownames_to_column("#SampleID") %>%
left_join(metadata) %>%
mutate(TimeSinceFire=as.numeric(TimeSinceFire)) %>% head()

Can you run this part and send the output?


(benjamin w.) #7

I just wanted to apologize, I have not had a chance to re-run your fixed code. I will and let you know if it works. Ben


(Fabiola ) #8

Yes, give me a second.


(Fabiola ) #9


(Not sure what I am supposed to be looking for?)

I have an additional question, when trying to create a phyloseq object I continue to get this error, even when I am in the correct directory. Can you please help me with this as well? So I tried creating it using this code, but I still get an error.

physeq<-phyloseq(otu_table(ECMtable$data, taxa_are_rows = T), phy_tree(tree$data), tax_table(taxtable), sample_data(metadata))

phy<-qza_to_phyloseq(“burn-rarefied-table.qza”, “burn-rooted-tree-EcM.qza”, “taxonomy.qza”,“Metadata.tsv”, tmp = “C:/tmp”)

Error in unzip(file, exdir = tmp, list = TRUE) : _
_ zip file ‘burn-rarefied-table.qza’ cannot be opened

In addition: Warning message:
In unzip(file, exdir = tmp) : error 1 in extracting from zip file


(Matthew Ryan Dillon) #10

I suggest that you reserve the practice of “deleting a question after it has been asked” for when you truly need it, like after publishing sensitive data on accident. Otherwise, this generates a lot of “noise” on the forum for other users, and, can make things pretty confusing for us when we try and figure out how to go about helping you. Maybe one strategy is if you think there is a chance you would want to delete your post, wait an hour or two before before posting it, just to make sure it is actually what you intend to post. Thanks! :qiime2:


(Jordan Bisanz) #11

ggplot(aes(x=TimeSinceFire, y=obsOTU, group=Treatment, color=Site, shape=Unit)) +

On this line, each variable (x,y,group,color,shape) needs to be a column in your input. It would appear that the variable you want to map to y is observed_otus rather than obsOTU so you should have:

ggplot(aes(x=TimeSinceFire, y=observed_otus, group=Treatment, color=Site, shape=Unit)) +

In regards to the unzip error, that error is most likely saying that the file isn’t found. I am somewhat confused, do both of those functions return the same error or just the second? Check that the input file exists in your current working directory with list.files() and that you have not made a typo in its name. You can either set your working directory to the one containing your file setwd("/path/to/your/dir/") or use an absolute file path (read_qza("/path/to/burn-rarefied-table.gza")).


(Fabiola ) #12

I see, for some reason I though that since obsOTU (the complete datafile). I was thinking it looked like table.qza and that it only contained frequencies, as it appears in Qiime. Thank you, and thank you for showing me the code to look at the header of the joined data.frame.

Let me run the phyloseq code again and see if I can check the error again.


(Fabiola ) #13

Sorry about that, I thought having unecessary questions made it worst, but I will make sure not to do this again.

thanks


(Fabiola ) #14

So I restarted R, and set the working directory again and it worked. :slight_smile:

Thanks again


(Evan Bolyen) #15

Bookkeeping note, I’ve migrated this thread to a new topic and un-deleted the questions.


(Fabiola ) #16

strong text
Hi again,

So, the code worked but it kept my taxonomy as a string
k_;p_; … instead of breaking it down to 7 levels. Is there anything I can do about this when I run the code using qza_to_phyloseq? It works perfectly when I use phyloseq().

phy<-qza_to_phyloseq(“R-phylo/burn-rarefied-table.qza”, “R-phylo/burn-rooted-tree-EcM.qza”,
“R-phylo/taxonomy.qza”,“R-phylo/Metadata.tsv”, tmp = “C:/tmp”)


(Fabiola ) #18

HI,

So after working with phyloseq all day, the program froze and I had to restart it, and although I loaded everything the same way and have closed and restarted laptop, I continue to get this error.

physeq<-phyloseq(

  • otu_table(table$data, taxa_are_rows = T),
  • phy_tree(tree$data),
  • tax_table(as.data.frame(taxtable) %>% select(-Confidence) %>% column_to_rownames(“Feature.ID”) %>% as.matrix()), #moving the taxonomy to the way phyloseq wants it
  • sample_data(metadata %>% as.data.frame() %>% column_to_rownames("#SampleID"))
  • )

Error: Column num2 not found


(Fabiola ) #19

Hi,

Sorry to message you again. My R-studio was acting very glitchy and the University uninstalled it and reinstalled it, but now I am having a problem loading QIIME2R.

I’ve tried a few times, but continue to get this error, can you please help me, again.

devtools::install_github(“jbisanz/qiime2R”)
Downloading GitHub repo jbisanz/[email protected]
from URL https://api.github.com/repos/jbisanz/qiime2R/zipball/master
Installing qiime2R
“C:/Users/fabipc/DOCUME~1/R/R-35~1.1/bin/x64/R” --no-site-file --no-environ --no-save
–no-restore --quiet CMD INSTALL
“C:/Users/fabipc/AppData/Local/Temp/RtmpoVb970/devtools27bc6a53f57/jbisanz-qiime2R-ba443df”
–library=“C:/Users/fabipc/Documents/R/R-3.5.1/library” --install-tests

  • installing source package ‘qiime2R’ …
    ** R
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    there is no package called ‘BiocGenerics’
    ERROR: lazy loading failed for package ‘qiime2R’
  • removing ‘C:/Users/fabipc/Documents/R/R-3.5.1/library/qiime2R’
    In R CMD INSTALL
    Installation failed: Command failed (1)

(Jordan Bisanz) #20

It would appear you might have lost some bioconductor packages as well. Run this code at it should hopefully fix it up:

source("https://bioconductor.org/biocLite.R")
biocLite("BiocGenerics")

(Jordan Bisanz) #21

I am unsure exactly what is happening here or your previous pos. Without some snapshot into the inputs, I can’t really diagnose it. In the future can you post a more complete example of the code and the inputs (with the first couple rows and columns of tables). I suspect the Error: Column num2 not found is related to one of your column_to_rownames() functions and that the column which you are trying to find to make rownames doesn’t exist in the input table.