New version 2.7.2 now on Cran (give it 2 more days or so)

75 views
Skip to first unread message

Bernd. Gruber

unread,
Dec 7, 2022, 2:18:00 AM12/7/22
to dartR

Hi everyone,

this is just an information about current dartR developments.

 You might have noticed that dartR was not on CRAN for about 2 weeks, but the good news is, we are back.

 The new version is 2.7.2 (and will be available as binaries in the next days), but you can install the version from github via:

 

install_github("green-striped-gecko/dartR")

 and then you can run

 gl.install.vanilla.dartR()

 

to get all the additional packages (if you upgrade you should have 95% already installed).

 

The new version was necessary due to some imcompatibilities of other pacakges, which needed to be rectified (e.g. ggtern for ternary plots had issues).

 In terms of new functions there are not many, but quite a few new once:

 gl.assign.grm: allows for assignment to populations using a genetic relatedness matrix

gl.ld.distance: Plots linkage disequilibrium against distance by population disequilibrium patterns

gl.ld.haplotype:  Visualizes patterns of linkage disequilibrium and identification of haplotypes

 gl.sfs (there is no longer gl2sfs (because it is no longer needed). Allows to calculate (multi)dimensional site frequency spectra)

 gl.spatial.autoCorr:  Spatial autocorrelation following Smouse and Peakall 1999

 gl2bpp:  Converts a genlight object into a format suitable for input to the BPP program

 

and another 20 functions had some minor bug fixes.

 

There is one major development under way (but is not in effect yet), as we started to develop our own class (read genlight objects will become dartR objects derived from genlight).

The means nothing will change and all your code will be backward compatible, but we want to deviate from genlight objects having a more defined data object called dartR (name not final yet).

The idea here is for example the genlight object has a slot position that is used for the position of snps on the chromosomes, but we have quite a few functions that use the position of SNPs within the reads and this should be in its own slot at some stage. We promise dartR will always work on genlight objects, which is the core of our package, but for future development (e.g. for being able to include reference genomes and additional data) we will extend the genlight object. If you want to have a glimpse you can use

 class(yourgenlightobject) <- "dartR"

yourgenlightobject

 and you see the new summary we are working on.

A nice side effect is that we can customise the functions and therefore you can now subset your dartR object also for loci using: gl[1:7, 1:8] as this also subsets the metadata for loci and individuals correctly.

 

What the future will bring is not decided, but we are working on some cool functions to allow the estimation of effective population size using snp data, some functions to support captive breeding (e.g. identify offsprings and suggest breeding pairs). If you have suggestions please post them here so we can discuss them. If you have some code lying around which you think would be good as a function send an email to us.

 Also we plan to have some workshops in the coming year, so in case you would be interested to have one at your institution, just shoot me or Luis an email.

Thats for now 

Merry Xmas and all the best for the coming year,

 Bernd & Luis & Carlo & Arthur & Olly

 

==============================================================================

Dr Bernd Gruber                                              )/_         

                                                         _.--..---"-,--c_    

Professor Ecological Modelling                      \|..'           ._O__)_     

Tel: (02) 6206 3804                         ,=.    _.+   _ \..--( /          

Fax: (02) 6201 2328                           \\.-''_.-' \ (     \_          

Institute for Applied Ecology                  `'''       `\__   /\          

Faculty of Science and Technology                          ')                

University of Canberra   ACT 2601 AUSTRALIA

Email: bernd....@canberra.edu.au

WWW: bernd-gruber

 

Australian Government Higher Education Provider Number CRICOS #00212K 

NOTICE & DISCLAIMER: This email and any files transmitted with it may contain
confidential or copyright material and are for the attention of the addressee
only. If you have received this email in error please notify us by email
reply and delete it from your system. The University of Canberra accepts
no liability for any damage caused by any virus transmitted by this email.

==============================================================================

Gabriella Scatà

unread,
Mar 12, 2023, 5:50:52 PMMar 12
to dartR
Hi Bernd,
is the new version only compatible with R 4.2.2?

I have R 4.2.1 & RStudio 2022.07.0 Build 548.

Until now, I kept the old dartR version 2.0.4 because I was finalising an analysis and I did not want to change the code and test new functions in the middle of the analysis. 

However, now I would like to install the new dartR version, but in a separate R library folder so I can go back to the previous dartR version (2.0.4) if I need specific features of functions that may not be available anymore in the new dartR version.
I was already doing this with version 2.0.4 switching between dartR 2.0.4 for the main functions and the developer dartR version for the functions with bugs or the dartR version 1.9.6 to plot individual labels on the PCA plot (as that was not available anymore in v2.0.4).

However when I try to install the new dartR version 2.7.2 with the same method I used before, I get the following error:

Error: package ‘dartR.data’ required by ‘dartR’ could not be found

In addition: Warning message:

package ‘dartR’ was built under R version 4.2.2




This is the code I normally use to install different versions of the same package in separate folders (and it worked beautifully so far):
      versions::install.versions("dartR", version="2.7.2", lib = "C:/Users/scatag/AppData/Local/R/win-library/4.2_dartR_v2.7.2")
      library(dartR, lib.loc = "C:/Users/scatag/AppData/Local/R/win-library/4.2_dartR_v2.7.2")


Is there any step I am missing? Does the new dartR package depend on some other package that I should install previously in this folder?  

If I check which packages are available after trying the installation of dartR 2.7.2 in its specific folder - which didn't work - I get the following list of packages:

   (.packages())  

 [1] "dplyr"     "ggplot2"   "adegenet"  "ade4"      "fs"        "versions"  "stats"     "graphics"  "grDevices" "utils"   

[11] "datasets"  "methods"   "base"

          
Is there anything I can do to fix this issue?
Thanks a lot!
Best,
Gabriella

Gabriella Scatà

unread,
Mar 12, 2023, 6:23:44 PMMar 12
to dartR
Uodate:

I tried to install the package "dartR.data" before installing "dartR" v 2.7.2 - both in the specific library folder "dartr_v2.7.2", in the following way:
# install 1st dartR.data package version 1.0.2 (https://cran.r-project.org/web/packages/dartR.data/index.html)

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

trying URL 'https://MRAN.revolutionanalytics.com/snapshot/2023-01-13/bin/windows/contrib/4.2/dartR.data_1.0.2.zip'

Content type 'application/zip' length 1706523 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

>           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


# Now try again installing dartR 2.7.2

>           versions::install.versions("dartR", version="2.7.2", lib = "C:/Users/scatag/AppData/Local/R/win-library/4.2_dartR_v2.7.2")

trying URL 'https://MRAN.revolutionanalytics.com/snapshot/2023-01-23/bin/windows/contrib/4.2/dartR_2.7.2.zip'

Content type 'application/zip' length 3944632 bytes (3.8 MB)

downloaded 3.8 MB

 

package ‘dartR’ successfully unpacked and MD5 sums checked

 

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

Registered S3 method overwritten by 'pegas':

  method      from

  print.amova ade4

Registered S3 method overwritten by 'GGally':

  method from  

  +.gg   ggplot2

Registered S3 method overwritten by 'genetics':

  method      from

  [.haplotype pegas

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_"

In addition: Warning message:

package ‘dartR’ was built under R version 4.2.2



But I still get an error....what should I do? Thanks a lot for this special assistance...
Best,
Gabriella

Jose Luis Mijangos

unread,
Mar 14, 2023, 12:40:35 AMMar 14
to dartR
Hi Gabriella,

Can you try:

>  install.packages("dartR.data")

Cheers,
Luis 

Gabriella Scatà

unread,
Mar 14, 2023, 2:54:44 AMMar 14
to dartR
Hi Luis,
thank you so much for your reply.

Installing dartR.data with install.packages() seemed to work and I was able to successfully install dartR version 2.7.2 in a specific library folder...but then when /i tried to detach it, I had an error and then I could not switch anymore to different version...or at least it seems i can "load" and "detach" other dartR versions previously installed in separate library folders, but I don't seem able to detach the new dartR version installed....it's always there in the background, but it's not seen by the function < (.packages()) >...?
I don't understand...

Can you have a look at the code and tell me if you have any insight? It works perfectly with the other dartR versions (as shown below):

  # TRY installing dartR.data with install.packages()

install.packages("dartR.data")

Installing package into ‘C:/Users/scatag/AppData/Local/R/win-library/4.2’

(as ‘lib’ is unspecified)

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

 

library(dartR.data)

Loading required package: adegenet

Loading required package: ade4

   /// adegenet 2.1.7 is loaded ////////////

   > overview: '?adegenet'

   > tutorials/doc/questions: 'adegenetWeb()'

   > bug reports/feature requests: adegenetIssues()

Warning message:

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

 

# check library path

.libPaths()

                # --> "C:/Users/scatag/AppData/Local/R/win-library/4.2" ;  "C:/Program Files/R/R-4.2.1/library"    

         

# Now try again installing dartR 2.7.2

versions::install.versions("dartR", version="2.7.2", lib = "C:/Users/scatag/AppData/Local/R/win- library/4.2_dartR_v2.7.2")

trying URL 'https://MRAN.revolutionanalytics.com/snapshot/2023-01-24/bin/windows/contrib/4.2/dartR_2.7.2.zip'

Content type 'application/zip' length 3947725 bytes (3.8 MB)

downloaded 3.8 MB

package ‘dartR’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in

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

 

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

Loading required package: ggplot2

Loading required package: dplyr

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

Registered S3 method overwritten by 'pegas':

  method      from

  print.amova ade4

Registered S3 method overwritten by 'GGally':

  method from  

  +.gg   ggplot2

Registered S3 method overwritten by 'genetics':

  method      from

  [.haplotype pegas

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_"

In addition: Warning messages:

1: package ‘dartR’ was built under R version 4.2.2

2: package ‘ggplot2’ was built under R version 4.2.2

 

packageVersion("dartR") # ‘new dartR version! :)

               [1] ‘2.7.2’

detach("package:dartR") # ‘2.7.2’ = developer version of 14 March 2023!!!! :) YES!!! :)

              Error in detach("package:dartR") : invalid 'name' argument

packageVersion("dartR") 

             [1] ‘2.7.2’

# Try laoding another dartR version

library(dartR, lib.loc = "C:/Users/scatag/AppData/Local/R/win-library/4.2_developer_versions_lib") # Version 2.1.4  = previous developer version 

**** Welcome to dartR [Version 2.1.4 ] ****

Be aware that owing to CRAN requirements and compatibility reasons not all functions of the package may run after the basic installation, as some packages could still be missing. Hence for a most enjoyable experience we recommend to run the function

gl.install.vanilla.dartR()

This installs all missing and required packages for your version of dartR.

For citation information please use:

citation('dartR')

Global verbosity is set to: 2

**** Have fun using dartR! ****

 

packageVersion("dartR") # ‘2.1.4’ = previous developer version! :)

           [1] ‘2.1.4’

detach("package:dartR")


# Load the previous CRAN established dartR version (2.0.4) (2 Aug 2022)

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

**** Welcome to dartR [Version 2.0.4 ] ****

Be aware that owing to CRAN requirements and compatibility reasons not all functions of the package may run after the basic installation, as some packages could still be missing. Hence for a most enjoyable experience we recommend to run the function

gl.install.vanilla.dartR()

This installs all missing and required packages for your version of dartR.

For citation information please use:

citation('dartR')

Global verbosity is set to: 2

**** Have fun using dartR! ****

 

packageVersion("dartR") # ‘2.0.4’ - YES!! :)     

           [1] ‘2.0.4’

detach("package:dartR")

 (.packages())  # dartR  is not loaded anymore

 [1] "dplyr"      "ggplot2"    "dartR.data" "adegenet"   "ade4"       "stats"      "graphics"   "grDevices"

 [9] "utils"      "datasets"   "methods"    "base"     

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

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_"

In addition: Warning message:

package ‘dartR’ was built under R version 4.2.

(.packages())

 [1] "dplyr"      "ggplot2"    "dartR.data" "adegenet"   "ade4"       "stats"      "graphics"   "grDevices"

 [9] "utils"      "datasets"   "methods"    "base"     

packageVersion("dartR")

[1] ‘2.7.2

Gabriella Scatà

unread,
Mar 14, 2023, 3:03:26 AMMar 14
to dartR
By the way,  if I load the previous dartR versions (previously installed with this method) à detach & (.packges()) work…and "see" them

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

**** Welcome to dartR ****

 Be aware that owing to CRAN requirements and compatibility reasons not all functions of the packages may run yet, as some dependencies could be missing. Hence for a most enjoyable experience we recommend to run the function

gl.install.vanilla.dartR()

This installs all missing and required packages for your version of dartR.

For citation information please use:

citation('dartR')

**** Have fun using dartR! ****

Attaching package: ‘dartR’

The following object is masked from ‘package:dartR.data’:

    possums.gl

 

>           packageVersion("dartR")  # dartR Version 1.9.6 --> yes!

[1] ‘1.9.6’

>           (.packages()) 

 [1] "dartR"      "dplyr"      "ggplot2"    "dartR.data" "adegenet"   "ade4"       "stats"      "graphics" 

 [9] "grDevices"  "utils"      "datasets"   "methods"    "base"

 

> detach("package:dartR")

> (.packages())

 [1] "dplyr"      "ggplot2"    "dartR.data" "adegenet"   "ade4"       "stats"      "graphics"   "grDevices"

 [9] "utils"      "datasets"   "methods"    "base"

Jose Luis Mijangos

unread,
Mar 15, 2023, 2:31:37 AM (13 days ago) Mar 15
to dartR
Hi Gabriella,

When you want to change the version of dartR, can you try restarting your R session (Menu > Session > Restart R) instead of detaching the package. Then after restarting your R session, call the dartR version you want to use. 

Cheers,
Luis 

Reply all
Reply to author
Forward
0 new messages