Transcription of An introduction to adegenet 2.0
1 An introduction Jombart Imperial College LondonMRC Centre for Outbreak Analysis and ModellingJuly 29, 2015 AbstractThis vignette provides an introductory tutorial to theadegenetpackage [4] forthe R software [12]. This package implements tools to handle, analyse and simulategenetic data. Originally developped for multiallelic, codominant markers such asmicrosatellites,adegenetnow also handles dominant markers, allows for any ploidy inthe data, handles SNPs and sequence data, and implements a memory-efficient storagefor genome-wide SNP data. This tutorial provides an overview ofadegenet s basicfunctionalities. , this tutorial is no longer distributed as a packagevignette.
2 Also note thatadegenethas undergone substantial changes with , including a reform of the data structure and new accessors, all documented inthis tutorial. Introduction32 Getting Installing the package - stable version .. Installing the package - devel version .. Getting help in R .. Asking help on a forum .. Bug report, feature requests, contributions: we are all one! ..63 Object genind objects .. genpop objects .. Using accessors ..124 Importing/exporting Importing data from GENETIX, STRUCTURE, FSTAT, Genepop .. Importing data from other software .. Handling presence/absence data .. SNPs data.
3 Extracting polymorphism from DNA sequences .. Extracting polymorphism from proteic sequences .. Usinggenind/genpopconstructors .. Exporting data ..315 Basics of data Manipulating the data .. Using summaries .. Testing for Hardy-Weinberg equilibrium .. Measuring and testing population structure ( ) .. Estimating inbreeding ..456 Multivariate General overview .. Performing a Principal Component Analysis ongenindobjects .. Performing a Correspondance Analysis ongenpopobjects ..587 Spatial Isolation by distance .. isolation by distance .. or distant patches? .. Using Monmonier s algorithm to define genetic boundaries.
4 678 Simulating hybridization7721 IntroductionThis tutorial introduces some basic functionalities of theadegenetpackage for R [12]. Thepurpose of this package is to provide tools for handling, analysing and simulating geneticdata, with an emphasis on multivariate approaches and exploratory methods. Standardmultivariate analyses are implemented in theade4package [2], of whichadegenetwasoriginally an extension. However, the package has since grown methods of its own suchas the Discriminant Analysis of Principal Components (DAPC, [8]), the spatial PrincipalComponents Analysis (sPCA, [5]), or theSeqTrackalgorithm [6].
5 In this tutorial, weintroduce the main data structures, show how to import data intoadegenet, and cover somebasic population genetics and multivariate tutorials are available via the commandadegenetTutorial: adegenetTutorial("spca"): tutorial on the sPCA adegenetTutorial("dapc"): tutorial on the DAPC adegenetTutorial("genomics"): tutorial on handling large SNP datasets usinggenlightobjects32 Getting Installing the package - stable versionBefore going further, we shall make sure thatadegenetis well installed on the computer. Thecurrent version of the package is Make sure you have a recent version of R ( )by ## [1] "R Under development (unstable) (2015-06-18 r68542)"Then, installadegenetwith dependencies (" adegenet ", dep=TRUE)We can now load the package alongside other useful packages:library("ape")library("pegas")l ibrary("seqinr")library("ggplot2")librar y(" adegenet ")If at some point you are unsure about the version of the package, you can check it using:packageDescription(" adegenet ", fields = "Version")## [1] " "adegenetversion should read Installing the package - devel versionThe development ofadegenetis hosted on github.
6 Can install this version using the packagedevtoolsand the following commands:library("devtools")install_gith ub("thibautjombart/ adegenet ")library("ad egenet")The development version may implement new features and fix known issues. However, itmay also occasionally be broken, as this is our working copy of the project. Usual disclaimersapply here: this package is provided with no warranty, etc. If unsure, use the stable Getting help in RThere are several ways of getting information about R in general, and aboutadegenetinparticular. The used to look for help on a given topic. For ("Hardy-Weinberg")replies that there is a theadegenetpackage, and othersimilar functions ingeneticsandpegas.
7 To get help for a given function, use?foowherefoois the function of interest. For instance (quotes and parentheses can be removed):?spcawill open up the manpage of the spatial principal component analysis [5]. At the endof a manpage, an example section often shows how to use a function. This can be copiedand pasted to the console, or directly executed from the console usingexample. For furtherquestions concerning R, the functionRSiteSearchis a powerful tool for making onlineresearches using keywords in R s archives (mailing lists and manpages).adegenethas a few extra documentation can be found fromthe website ( ), in the documents section,including several tutorials and a manual which compiles all manpages of the package, and adedicated mailing list with searchable archives.
8 To open the website from R, use:adegenetWeb()The same can be done for tutorials , usingadegenetTutorial(see manpage to choose thetutorial to open). You will also find an overview of the main functionalities of the packagetyping:?adegenetNote that you can also browse help pages as html pages, ()To go to theadegenetpage, click packages , adegenet , and adegenet -package . Asking help on a forumSeveral mailing lists are available to find different kinds of information on own dedicated forum/mailing avoid spam, this list is filtered; subscription is recommended, and can be done at:5 questions on R forums can sometimes be a traumatic experience, and we aretrying to avoid this as much as possible on the adegenet forum.
9 To this end, the followingpoints are worth keeping in mind: read the doc first:manpages and tutorials take an awful long time to write andmaintain; make sure your answer is not in an obvious place before asking a question;pretending to have read all the available doc while you have not even looked at thebasics tutorial is a clever, yet often unsuccessful strategy. search the archives: adegenet forum has searchable archives (see the adegenetwebsite); your answer may be there already, so it is worth checking. give us info:you tried something, it is not give us some information: whatversion of adegenet are you using, what commands did you enter and what was theoutput, etc.
10 Avoid personal messages:the adegenet forum has plenty of advantages: severalpeople are likely to reply and participate in the conversation, answers are generallyfaster, and all of this is archived and searchable. Please do not email the developersdirectly, unless you need to discuss confidential matters. short answers are okay:some answers will be short . Do not take them as rude, orthink people are upset: answering questions on a forum is a time-consuming activityand the reward for it is low. Sometimes the best answer will be pointing to relevantdocumentation, Please check ?xvalDapc . If you get this, we (most likely) stilllike adegenet forum is not the only forum that might be relevant.