yiluheihei / microbiomeMarker

R package for microbiome biomarker discovery
https://yiluheihei.github.io/microbiomeMarker
GNU General Public License v3.0
170 stars 40 forks source link

import picrust2 failed: "cannot open compressed file" #92

Open azahorik opened 1 year ago

azahorik commented 1 year ago

I'm trying to import picrust2 output. I have a tab-delimited text metadata file with two columns: SampleID and SampleType. I have the KO prediction files (pred_metagenome_unstrat.tsv.gz and pred_metagenome_unstrat_descrip.tsv.gz). I have set the working directory in R to the directory where all of these files are located.

I ran the following commands:

sam_tab <- system.file( "extdata", "metadata.txt", package = "microbiomeMarker")

annual_KO_tab <- system.file( "extdata", "annual_KO_pred_metagenome_unstrat.tsv.gz", package = "microbiomeMarker" )

annual.ko <- import_picrust2( annual_KO_tab, sam_tab, trait = "KO" )

And got the following error:

Error in open.connection(file, "rt") : cannot open the connection In addition: Warning message: In open.connection(file, "rt") : cannot open compressed file '', probable reason 'Invalid argument'

I have tried:

Regardless, I keep getting the same error. I can't see what I'm doing wrong here. Please advise. I've attached my metadata file and one of the picrust2 output files.

Note: The picrust2 output file was in tsv/tsv.gz format for this, but I had to convert to tab delimited .txt in order to upload it to github. This wasn't the format used in R. annual_KO_pred_metagenome_unstrat.txt metadata.txt

azahorik commented 1 year ago

Further note: I am using R 4.2.2 in RStudio in Windows 10. I am running RStudio as administrator. (Since sometimes Windows can be weird about write perms.)