gl.nhybrids: Error

163 views
Skip to first unread message

walter...@ufz.de

unread,
Sep 10, 2020, 10:17:15 AM9/10/20
to dartR
dear Arthur and Bernd,
I want to use NewHybrids and found your function gl.nhybrids to produce the input files.
However, I get errors both with the example code as well as with my own data:

d.gl2 /// GENLIGHT OBJECT /////////
// 119 genotypes, 6,855 binary SNPs, size: 2.5 Mb 26295 (3.22 %) missing data
// Basic content @gen: list of 119 SNPbin
// Optional content
@ind.names: 119 individual labels
@loc.names: 6855 locus labels
@chromosome: factor storing chromosomes of the SNPs @position: integer storing positions of the SNPs
@pop: population of each individual (group size range: 5-12)
@other: a list containing: loc.metrics loc.metrics.flags verbose
> gl.nhybrids( + d.gl2, + outfile = "nhyb.txt", + #outpath = tempdir(), + p0 = c("OS"),# NULL, + p1 = c("CA","MA","PA","SA"), + threshold = 0, + method = "random",#"AvgPIC" + plot = TRUE, + pprob = 0.95, + nhyb.directory = NULL, + BurnIn = 10000, + sweeps = 10000, + GtypFile = "TwoGensGtypFreq.txt", + AFPriorFile = NULL, + PiPrior = "Jeffreys", + ThetaPrior = "Jeffreys", + verbose = NULL + )
Error in gl.nhybrids(d.gl2, outfile = "nhyb.txt", p0 = c("OS"), p1 = c("CA", : unused arguments (threshold = 0, plot = TRUE, pprob = 0.95, verbose = NULL)

> m <- gl.nhybrids(testset.gl, outfile="nhyb.txt", c("Pop1", "Pop4"), c("Pop7", "Pop9"), t=0, method="random")
Starting gl.nhybrids: Assigning individual to hybrid categories
  Only one parental population specified
    Selecting ca 200 random loci
Subsampling at random, approximately 200 loci from genlight object
  No. of loci retained = 128
  Note: SNP metadata discarded
Converting data to NewHybrids format
  Adding sequential number and flagging parental stock
Writing the NewHybrids input file Pop1/nhyb.txt Pop4/nhyb.txt
   NumIndivs 250
   NumLoci 128
   Digits 1
   Format Lumped
Error in file(file, if (append) "a" else "w") : invalid 'description' argument

So it is difficult for me to check where my error is.
Could you have a look, please?
Best regards
Walter

Arthur Georges

unread,
Sep 10, 2020, 8:27:59 PM9/10/20
to dartR
Hmmm. Seemed to work for me, using the test set.

 # Running newhybrids local to R

Program New Hybrids completed at Fri Sep 11 10:19:22 2020
 
Data = C:\Users\georges\AppData\Local\Temp\RtmpWulXnn/nhyb.txt, GtypFile = TwoGensGtypFreq.txt, PiPrior = JEFFREYS, ThetaPrior = JEFFREYS, Seeds = 5 14

Output is in the following files:
    aa-LociAndAlleles.txt  --- A listing of loci and alleles read
    aa-Pi.hist  ---  text file of a histogram representation for
        the posterior distribution of Pi
    aa-PofZ.txt  ---  for each individual in the sample, the posterior probability
        that it falls into each of the genotype frequency categories
    aa-Theta.hist  ---- a histogram representation of the posterior distributions
        of the allele frequencies in the different populations

        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.

Results are stored in file aa-PofZ.csv
Returning data used by New Hybrids in generating the results, as a genlight object
Completed: gl.nhybrids

# Without running locally

> m <- gl.nhybrids(testset.gl, outfile="nhyb.txt",
+ p0=NULL, p1=NULL,
+ verbose=3)
Starting gl.nhybrids
  Processing a SNP dataset
  No parental population specified
    Selecting 200 random loci


Converting data to NewHybrids format
  Adding sequential number
  Writing the NewHybrids input file C:\Users\georges\AppData\Local\Temp\RtmpWulXnn/nhyb.txt
    NumIndivs  250
    NumLoci  200  
    Digits 1
  Format Lumped

Results are stored in file aa-PofZ.csv
Returning data used by New Hybrids in generating the results, as a genlight object
Completed: gl.nhybrids
Reply all
Reply to author
Forward
0 new messages