gl.outflank - LeftTrimFraction & RightTrimFration arguments

53 views
Skip to first unread message

Gabriella Scatà

unread,
Jan 11, 2023, 12:28:47 AM1/11/23
to dartR
Hi,
I have tried to change the left and right trim fraction when using gl.outflank, but the outcome seems to be the same even if I use quite a high cut-off (changing from the 0.05 default to 0.2 on both sides).
The plot of uncorrected Fst values vs their frequency with the blue line Chi-square distribution and the histrogram of right-tail Fst P-values vs their frequency are exactly the same as when I used the lower cut-off (0.05).

Are the LeftTrimFraction & RightTrimFration cut-off arguments working?
I just want to make sure that the fact that I am not seeing any difference is not due to a bug in the function.

Thank you!
Best,
Gabriella

Jose Luis Mijangos

unread,
Jan 11, 2023, 2:38:04 AM1/11/23
to dartR
Hi Gabriella,

Thank you for reporting this bug. The bug has been fixed. The updated version of the function is available in the beta version of dartR which can be installed as shown below:

> library(dartR)
> gl.install.vanilla.dartR(flavour = "beta")

Cheers,
Luis

Gabriella Scatà

unread,
Jan 11, 2023, 2:56:20 AM1/11/23
to dartR
Great, thanks!
Just to understand...if I am still using dartR 2.0.4, do I need to install the new version of dartR or can I just install the new developer version in the usual way?

Thanks again
Best,
Gabriella

Jose Luis Mijangos

unread,
Jan 11, 2023, 3:06:53 AM1/11/23
to dartR
Hi Gabriella,

To be sure, you can use:

> library(devtools)
> install_github("green-striped-gecko/dartR@beta")

Cheers,
Luis 

Gabriella Scatà

unread,
Mar 12, 2023, 7:02:17 PM3/12/23
to dartR
Hi Luis,
I tried to install the developer version (@beta) but in a separate folder (as I explained some time ago --> see: https://groups.google.com/g/dartr/c/wHQCYq8mTPA/m/BGxZ1q61AQAJ), so that I can switch from one version of dartR to another.

However, I get the following error messages - and dartR@beta is not installed:

<

> devtools::install_github("green-striped-gecko/dartR@beta", lib = "C:/Users/scatag/AppData/Local/R/win-library/4.2_dartR_developer_v03_23")

Downloading GitHub repo green-striped-gecko/dartR@beta

These packages have more recent versions available.

It is recommended to update all of them.

Installing 1 packages: dartR.data

trying URL 'http://cran.rstudio.com/bin/windows/contrib/4.2/dartR.data_1.0.2.zip'

Content type 'application/zip' length 1706346 bytes (1.6 MB)

downloaded 1.6 MB

package ‘dartR.data’ successfully unpacked and MD5 sums checked

 

The downloaded binary packages are in

               C:\Users\scatag\AppData\Local\Temp\RtmpGkEgPj\downloaded_packages

  checking for file 'C:\Users\scatag\AppData\Local\Temp\RtmpGkEgPj\remotes2600436955a15\green-striped-gecko-dartR-ee0b6ae/DESCRIPTION' (1s)

─  preparing 'dartR': (49.7s)

  checking DESCRIPTION meta-information ...

─  checking for LF line-endings in source and make files and shell scripts (4.5s)

─  checking for empty or unneeded directories

─  building 'dartR_2.7.2.tar.gz'

* installing *source* package 'dartR' ...

** using staged installation

** R

** data

*** moving datasets to lazyload DB

** inst

** byte-compile and prepare package for lazy loading

Warning messages:

1: package 'ggplot2' was built under R version 4.2.2

2: package 'dartR.data' was built under R version 4.2.2

** help

*** installing help indices

*** copying figures

** building package indices

** installing vignettes

** testing if installed package can be loaded from temporary location

Warning: package 'ggplot2' was built under R version 4.2.2

Warning: package 'dartR.data' was built under R version 4.2.2

** testing if installed package can be loaded from final location

Warning: package 'ggplot2' was built under R version 4.2.2

Warning: package 'dartR.data' was built under R version 4.2.2

** testing if installed package keeps a record of temporary installation path

* DONE (dartR)

 

>           library(dartR, lib.loc = "C:/Users/scatag/AppData/Local/R/win-library/4.2_dartR_developer_v03_23")

Loading required package: dartR.data

Error: package ‘dartR.data’ could not be loaded

In addition: Warning message:

In library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc,  :

  there is no package called ‘dartR.data’

 

 

If I try to load the dartR.data package first à

> library(dartR.data, lib.loc = "C:/Users/scatag/AppData/Local/R/win-library/4.2_dartR_v2.7.2")

Warning message:

package ‘dartR.data’ was built under R version 4.2.2

>           library(dartR, lib.loc = "C:/Users/scatag/AppData/Local/R/win-library/4.2_dartR_developer_v03_23")

Error: package or namespace load failed for ‘dartR’:

 .onAttach failed in attachNamespace() for 'dartR', details:

  call: gsub_(st$close, st$open, text, fixed = TRUE, useBytes = TRUE)

  error: could not find function "gsub_"


>

Is there anything I can do to fix this issue?
I would still like to be able to switch between developer & current Cran versions of dartR, as well as previous versions. This method of installing different versions in different library folders worked before...but i seem to be missing something now...and I think i need some help in understanding what is missing... 

I would appreciate if you could provide some assistance on this "special" issue...

Thanks a lot!
Best,
Gabriella

Gabriella Scatà

unread,
Apr 27, 2023, 5:38:16 AM4/27/23
to dartR
Hi Luis,
hope all is good.

I finally managed to install both the new dartR version (2.7.2) & the new developer version of dartR (dartR@dev 2.9.4 - as of 26 April 2023) to test the LeftTrimFraction & RightTrimFraction arguments in gl.outflank, which you said got fixed in the new developer version.

However, unfortunately, something is still quite wrong in this function (at least in dartR@dev  2.9.4). When I look at the "results" of the gl.outflank function the columns "q values", "p values" and "p values Right tail" are all NA!

How is it possible?

Below my code:
<packageVersion("dartR") # ‘2.9.4’

My_dataset_OUTFLANK_dartR2.9.4_Rtrim0.05 = gl.outflank(
              My_dataset,
              plot = TRUE,
              LeftTrimFraction = 0.05, 
              RightTrimFraction = 0.05, 
              Hmin = 0.1, 
              qthreshold = 0.05 
            )

My_dataset_OUTFLANK_dartR2.9.4_Rtrim0.05$outflank$results$pvaluesRightTail

   [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA……

My_dataset_OUTFLANK_dartR2.9.4_Rtrim0.05$outflank$results$pvalues
   [1] NA NA NA NA NA NA NA NA....
       

>

Could you please let me know if this is the dartR version where the bug (Left/RightTrim function not working) was fixed? Am I using the correct dartR version?
There is clearly another issue in the current dev@dartR version, unless I am doing something wrong?
But I do get all q values, p values and p values Right tail if I use the previous dartR version (2.0.4) with the very same code...

I would really appreciate some help!
Thanks a lot as usual!
Gabriella

Il giorno mercoledì 11 gennaio 2023 alle 17:38:04 UTC+10 luis.m...@gmail.com ha scritto:

Gabriella Scatà

unread,
Apr 27, 2023, 5:45:26 AM4/27/23
to dartR
And this is how the right tail p values histogram from the code above looks like...which I think it's also odd...because if you have all NAs...how can the frequencies be slightly different in the plot?

Plot code:
 hist(My_dataset_OUTFLANK_dartR2.9.4_Rtrim0.05$outflank$results$pvaluesRightTail)
             


My_dataset_OUTFLANK_dartR2.9.4_Rtrim0.05_for_dartR_ggroup.png
Reply all
Reply to author
Forward
0 new messages