lmrodriguezr / nonpareil

Estimate metagenomic coverage and sequence diversity
http://enve-omics.ce.gatech.edu/nonpareil/
Other
42 stars 11 forks source link

Error in file(con, "r") : invalid 'description' argument #51

Closed ZoeHansen closed 2 years ago

ZoeHansen commented 2 years ago

Hello!

Thank you for your work with Nonpareil -- it's an incredibly useful tool! Unfortunately, I am running into some issues when attempting to run 'Nonpareil.set' and 'Nonpareil.curve.batch'. I didn't see this error popping up in any other issue posts, and I don't think the problem is necessarily related to Nonpareil itself but I was hoping to get some insight into what I may be doing wrong.

I have ~270 samples which I successfully ran through Nonpareil on a Linux system. Each of the output files contains a sample-specific identifier such as 'ER####.nonpareil.npo'. I used Python to compile the paths to each of these files in a dataframe with randomly generated colors associated in a separate column (similar to your suggestion on Read the Docs). So, I have a "File" column which contains the full path to all NPO files, an "ER_ID" column with the sample-specific identifier, and a "color" column (see attached).

ERIN_Nonpareil_npo_output_files.csv

However, when attempting to run Nonpareil.curve.batch() or Nonpareil.set(), I continue to be met with this error: Error in file(con, "r") : invalid 'description' argument

The full traceback is:

8: file(con, "r")
7: readLines(x$file)
6: grep("^# @", readLines(x$file), value = TRUE)
5: gsub("^# @", "", grep("^# @", readLines(x$file), value = TRUE))
4: Nonpareil.read_metadata(np)
3: Nonpareil.curve(plot = FALSE, file = NA_character_, col = NA_character_, 
       label = "")
2: do.call("Nonpareil.curve", nonpareil.opts)
1: Nonpareil.set(files = coverage$File, col = coverage$color, labels = "", 
       plot = TRUE, plot.opts = list(plot.observed = FALSE))

I tried digging around Google and most people say that this is typically an issue when your Excel file is open when trying to import data -- however, my CSV files are closed whenever I'm running my R code and this is still occurring. Do you know what I may be missing? Did I improperly format my CSV containing the file paths and names? I'm sorry if this turns out to be a silly fix, I think I just need another set of eyes on it.

Thank you for your time!

lmrodriguezr commented 2 years ago

Hi,

I'm very glad you've found Nonpareil useful!

I cannot see any obvious issues with your data or your function call. The first thing that comes to my mind is that the files are not accessible for some reason, so I would check first if they all exist:

all(file.exists(coverage$File)

And if so, are they readable?

all(file.access(coverage$File, 4) == 0)

Maybe that's enough to detect the problem. If these return FALSE you can check each of them by removing the wrapping all. Otherwise, please let us know so we can try to troubleshoot some more.

Best wishes Miguel.

ZoeHansen commented 2 years ago

Hi Miguel,

Thank you so much for your response! Yes, it was just a silly error, and one of my files must not have uploaded correctly and so did not "exist" when I was trying to call it. I'm glad it was an easy fix, but I'm sorry for such a silly problem, haha! I really appreciate you sharing your R knowledge and helping me figure it out right away.

Thank you, again!