wejlab / animalcules

R shiny app for interactive microbiome analysis
https://wejlab.github.io/animalcules-docs/
Other
51 stars 16 forks source link

Quick fix for read_pathoscope_data() #49

Closed aubreyodom closed 2 years ago

aubreyodom commented 2 years ago

Hey animalcules team! I was trying to upload some PathoScope data into the Shiny app, and ran into a strange error that left me highly confused: image

Upon further investigation into the inner workings of the upload function, I determined that this error resulted from a very abnormal taxon that was in the first 100 lines read: image

The presence of the apostrophe in Peanut_witches'-broom_phytoplasma is what caused the issue. As such, the easy solution that I am asking to be implemented is within read_pathoscope_data(), lines 31-33.

As part of the read.table() implementation in lapply, I recommend disabling quoting altogether, like so:

ltbl <- lapply(filenames, read.table, skip = 1,
               header = TRUE, sep = "\t", nrow = 100,
               comment.char = "", check.names = FALSE, 
               quote = "")  # this is the line to be added

With PathoScope output data, outputs are likely always going to be in tsv format, so I don't foresee this being an issue. It worked totally fine when I tried it on ~80 of my own output files. If you want to be slightly more consevative, you could just only allow double quotes with quote = "\"".

Thanks!

P.S. If there's some way to make it so the metadata doesn't also have to be in TSV format when uploading PathoScope data, that would be cool too.

aubreyodom commented 2 years ago

I had to fix this myself.