thierrygosselin / radiator

RADseq Data Exploration, Manipulation and Visualization using R
https://thierrygosselin.github.io/radiator/
GNU General Public License v3.0
59 stars 23 forks source link

Error : (converted from warning) unable to re-encode 'filter_monomorphic.R' line 7 #42

Closed flojopi closed 5 years ago

flojopi commented 5 years ago

Hi Thierry, I just tried installing the radiator package. After successfully installing glue, Rtools3.5 and stringi, it fails when trying to install the actual radiator package with the following error message:


Installing package into ‘C:/Users/f/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'radiator' ...
** R
Error : (converted from warning) unable to re-encode 'filter_monomorphic.R' line 7
ERROR: unable to collate and parse R files for package 'radiator'
* removing 'C:/Users/f/Documents/R/win-library/3.5/radiator'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/f/AppData/Local/Temp/Rtmpm0Pwbl/file34c86193c02/radiator_1.0.0.tar.gz’ had non-zero exit status

Any idea as to what causes this error? Btw, I tried looking at that link to installation errors - but the dropbox link is dead?

Thanks, Flo

thierrygosselin commented 5 years ago

glue is not a required package by radiator. Close everything. Re-open R or RStudio. Don't load anything. just enter command below and send the output: devtools::session_info()

flojopi commented 5 years ago

Hi Thierry,

Please find below the output:

devtools::session_info()

  • Session info -------------------------------------------------------------------------------------------------- setting value
    version R version 3.5.2 (2018-12-20) os Windows >= 8 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_New Zealand.1252
    ctype English_New Zealand.1252
    tz Pacific/Auckland
    date 2019-03-15

[1] C:/Users/f/Documents/R/win-library/3.5 [2] C:/Program Files/R/R-3.5.2/library

thierrygosselin commented 5 years ago

Thanks flojopi I don't have an access to a PC until the 2019-03-26 so it might be a while before I find the problem.

thierrygosselin commented 5 years ago

Sorry about the broken link: here again https://www.dropbox.com/s/1kz59xpolb5y52m/rad_genomics_computer_setup.nb.html?dl=0

re-open the issue if it's not working

flojopi commented 5 years ago

Hi Thierry,

Thanks for the link, however the installation guide/troubleshooting is aimed for Unix users (and I am stuck on a Win machine ;)).

Installing package into ‘C:/Users/f/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'radiator' ...
** R
Error : (converted from warning) unable to re-encode 'filter_monomorphic.R' line 7
ERROR: unable to collate and parse R files for package 'radiator'
* removing 'C:/Users/f/Documents/R/win-library/3.5/radiator'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/f/AppData/Local/Temp/RtmpEFQDxM/file1e50572b4a2/radiator_1.0.0.tar.gz’ had non-zero exit status

Any idea what could cause this issue with

unable to re-encode 'filter_monomorphic.R' line 7 and ERROR: unable to collate and parse R files for package 'radiator'

during the installation process on Win10 via R-Studio ?

Thanks, Flo

thierrygosselin commented 5 years ago

Have no idea, it's not doing any of this on the PC I tried with yesterday. It looks like very computer-specific.

  1. Have you tried to delete radiator manually and re-install ?
  2. I would google the first problem: the lib is unspecified...
thierrygosselin commented 5 years ago

https://support.rstudio.com/hc/en-us/community/posts/200522573-Can-t-install-packages https://support.rstudio.com/hc/en-us/community/posts/200635588-Installing-Packages-as-lib-is-unspecified

flojopi commented 5 years ago

Hi Thierry, the lib error is not an error per se, its just because I have two libraries and it installs into the default library, which is the one it tries. I get the same line when I install other packages, and they install successfully. So thats not the problem for the radiator package. Yes, I did try to delete it (but it never shows up in the library folder anyway). I'll try and remove from the tmp folder as well.. and see how that goes.

flojopi commented 5 years ago

I just tried removing it from the tmp folder and re-install, also by specifying the particular library path. But I am still getting the same problem with

Error : (converted from warning) unable to re-encode 'filter_monomorphic.R' line 7 etc as mentioned above?

thierrygosselin commented 5 years ago

I looked at line 7 in filter_monomorphic and the encoding might be the problem for your computer.

Capture d'écran 2019-03-26 11 09 46 Capture d'écran 2019-03-26 11 10 13

I removed it completely. Try the latest commit...

flojopi commented 5 years ago

Thanks, it works !

thierrygosselin commented 5 years ago

Quick question for you since you're using a PC,

Could you try for me the function radiator::filter_monomorphic ? I have a user that cannot run the function using the default that chose all the cores -1. The function work with 1 CPU. So I'm wondering if it's a problem for all PC or just 1... cheers

flojopi commented 5 years ago

Hi,

actually I can't read in my example data (using a vcf from DArTseq and a created .tsv with 2 columns containing individual ID and corresponding population) using: data <- radiator::filter_rad(data = "my.vcf", strata = "my.tsv", output = c("genind", "hierfstat"))

Folder created: filter_rad_20190327@1432 File written: radiator_filter_rad_args_20190327@1432.tsv File written: random.seed (967332) Filters parameters file generated: filters_parameters_20190327@1432.tsv

Reading VCF Error in if (is.stacks) { : argument is of length zero

Computation time, overall: 2 sec

thierrygosselin commented 5 years ago

Could you send your VCF + Strata file by email ?

DArT gave you a VCF ? or a .csv file ?

thierrygosselin commented 5 years ago

The vcf you sent, what was the assembly strategy ? Hybrid use of a reference genome + de novo approaches ?

Because DArT are certainly not following VCF format specs, but I’ll adapt the script to detect and correct. I got a second user today with the same problem.

Question: Some chromosome have an ID and some a dot (see question above regarding the approach) : I could fill with chrom_1 ..?

thierrygosselin commented 5 years ago

The way you generated the vcd subset, doesn't work. So to try the next release, try your full VCF. Turns out I receive another dataset to test and it was a DArT vcf...

I'm parsing the markers metadata this way: . in CHROM are replaced by denovo NA in POS are replaced by 50 COL: the position of the SNP on the read is extracted from the LOCUS as any other DArT data. LOCUS: are the first group of digits the rest is discarded LOCUS and POS are joined with _ POS is replaced by COL (col is duplicated). This is necessary to make the lines in the VCF unique. Otherwise you get lots of duplicated markers with identical names. They all differentiate when adding COL/POS... MARKERS = CHROMLOCUSPOS

reopen the issue if it doesn't work

flojopi commented 5 years ago

Hi Thierry,

DArT used a reference genome approach for our project, but I am still waiting to get more details from them.

I still experience problems reading in the data. VCF: data <- radiator::filter_rad(data = "Report_SNP_singlerow_2vcf.vcf", strata = "my.strata.tsv", output = c("genind", "hierfstat"))

Reading VCF Data summary: number of samples: 277 number of markers: 71859 done! timing: 10 sec

Generating individual stats... Error in .DynamicClusterCall(cl, length(cl), .fun = function(.proc_idx, : One of the nodes produced an error: Can not open file 'C:\Users\f\Desktop\radiator\filter_rad_20190401@1800\01_radiator\radiator_20190401@1800.gds'. The process cannot access the file because it is being used by another process.

Computation time, overall: 16 sec

dart 2 row format: data <- radiator::filter_rad(data = "Report_SNP_2.csv", strata = "my.strata.tsv", output = c("genind", "hierfstat"))

Reading DArT file... Error: The DArT and strata files don't have the same TARGET_IDs Call rlang::last_error() to see a backtrace In addition: Warning message: Unknown or uninitialised column: 'TARGET_ID'.

DArT conversion timing: 0 sec

Computation time, overall: 0 sec

I am not sure why the second command (using the dart 2 row file format) the strata is not accepted, but it seems to be fine for the vcf.

Cheers, Florian

thierrygosselin commented 5 years ago
  1. VCF:
    • Try re-running the function on a clean R session. With no object in your environment (clean desk).
    • Do you have read/write access on the disk ? The PC is yours, not the organization you're in ?
  2. DArT 2 row format: With DArT data, you need to have 3 columns for DArT (doc updated in filter_rad function, it's written in the function called read_dart, the module under filter_rad that reads the file...) do ??radiator::read_dart.