Tidyverse conflicts with automatic manifest maker

廉价感情. 提交于 2019-12-11 19:14:43

问题


I'm trying to get an R-script to work, the instructions on how I set up/ installed the packages can be found here https://forum.qiime2.org/t/automatic-manifest-maker-in-r/2921 If you'd like to try the script please add

#!/usr/bin/env Rscript

to the first line of the script and de/reactivate R-Env (Credit; Duckmayr) syntax errors (in R-script)

The new issue is that it now returns a new error;

(R-Env) qiime2@qiime2core2018-8:~/Desktop/MACE_DEMUX_FASTQs/barcode08$ 
~/Taxonomy.R
── Attaching packages ─────────────────────────────────────── tidyverse 
1.2.1 ──
✔ ggplot2 2.2.1     ✔ purrr   0.2.4
✔ tibble  1.4.2     ✔ dplyr   0.7.5
✔ tidyr   0.8.1     ✔ stringr 1.3.1
✔ readr   1.1.1     ✔ forcats 0.3.0
── Conflicts ──────────────────────────────────────────             
tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
Error in `[<-.data.frame`(`*tmp*`, "direction", value = "forward") : 
replacement has 1 row, data has 0
Calls: [<- -> [<-.data.frame
Execution halted

I have never done anything using R before so please forgive me if this is a dumb question.

a little context; This is being performed in a conda environment on a vm ubuntu machine and is supposed to create a file called Manifest.csv which contains metadata from the .fastq files in the current directory. I take no credit for the script, it is open access and I did not write it.


回答1:


Your error comes because the script you've used assumes your .R1.fastq.gz are in a Data/ subdirectory of your working directory, but as determined in the comments, that is not the case. This causes TabF and PathF to not have any rows, which causes PathF['direction']='forward' to create the error you get.

The fix is to change

SamplesF <- list.files(path = "Data", pattern = "*.R1.fastq.gz", all.files = FALSE,
       full.names = TRUE, recursive = FALSE,
       ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)

to

data_path <- paste("~/Desktop/MACE_DEMUX_FASTQs/barcode08", "Data", sep = "/")
SamplesF <- list.files(path = data_path, pattern = "*.R1.fastq.gz", all.files = FALSE,
       full.names = TRUE, recursive = FALSE,
       ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)

as well as changing

SamplesR <- list.files(path = "Data", pattern = "*.R2.fastq.gz", all.files = FALSE,
       full.names = TRUE, recursive = FALSE,
       ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)

to

SamplesR <- list.files(path = data_path, pattern = "*.R2.fastq.gz", all.files = FALSE,
       full.names = TRUE, recursive = FALSE,
       ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE)

and make sure your .R1.fastq.gz and .R2.fastq.gz files are in a Data/ subdirectory of ~/Desktop/MACE_DEMUX_FASTQs/barcode08.



来源:https://stackoverflow.com/questions/52496914/tidyverse-conflicts-with-automatic-manifest-maker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!