[adegenet-commits] r558 - pkg/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 8 17:00:18 CET 2010


Author: jombart
Date: 2010-02-08 17:00:17 +0100 (Mon, 08 Feb 2010)
New Revision: 558

Modified:
   pkg/man/H3N2.Rd
Log:
Done H3N2 doc. Now have to check all doc.


Modified: pkg/man/H3N2.Rd
===================================================================
--- pkg/man/H3N2.Rd	2010-02-08 15:54:15 UTC (rev 557)
+++ pkg/man/H3N2.Rd	2010-02-08 16:00:17 UTC (rev 558)
@@ -4,7 +4,7 @@
 \docType{data}
 \title{}
 \description{
-This dataset consists of 2949 strains of seasonal influenza (H3N2)
+This dataset consists of 1903 strains of seasonal influenza (H3N2)
 distributed worldwide, and typed at 125 SNPs located in the
 hemagglutinin (HA) segment. These data were gathered from DNA sequences
 available from Genbank (http://www.ncbi.nlm.nih.gov/Genbank/).
@@ -16,12 +16,10 @@
     \describe{
         \item{x}{a \code{data.frame} containing miscellanous annotations
 	  of the sequences.}
-        \item{Region}{a character vector indicating the geographic region of each population.}
-        \item{Label}{a character vector indicating the correspondance
-	  with population labels used in the genind object (i.e., as
-	  output by \code{pop(H3N2)}).}
-	\item{Latitude,Longitude}{geographic coordinates of the
-	  populations, indicated as north and east degrees.}
+        \item{xy}{a matrix with two columns indicating the geographic
+	  coordinates of the strains.}
+        \item{epid}{a character vector indicating the epidemic of the strains.}
+	\item{lon,lat}{geographic coordinates of the strains, indicated as north and east degrees.}
     }
 }
 \source{
@@ -35,90 +33,29 @@
 genetically structured populations. Submitted to \emph{PLoS genetics}.
 }
 \examples{
-\dontrun{
 ## LOAD DATA
 data(H3N2)
 H3N2
 
+## set population to yearly epidemics
+pop(H3N2) <- factor(H3N2$other$epid)
 
+
+
 ## PERFORM DAPC - USE POPULATIONS AS CLUSTERS
 ## to reproduce exactly analyses from the paper, use "n.pca=1000"
-dapc1 <- dapc(H3N2, all.contrib=TRUE, scale=FALSE, n.pca=200, n.da=80) # takes 2 minutes
+dapc1 <- dapc(H3N2, all.contrib=TRUE, scale=FALSE, n.pca=150, n.da=5)
 dapc1
 
 ## (see ?dapc for details about the output)
 
 
-
 ## SCREEPLOT OF EIGENVALUES
-barplot(dapc1$eig, main="H3N2 - DAPC eigenvalues", col=c("red","green","blue", rep("grey", 1000)))
+barplot(dapc1$eig, main="H3N2 - DAPC eigenvalues")
 
 
+## SCATTERPLOT (axes 1-2)
+scatter(dapc1, ratio=.2)
 
-## SCATTERPLOTS
-## (!) Note: colors may be inverted with respect to the
-## original paper (as signs of principal components are arbitrary)
-## axes 1-2
-s.label(dapc1$grp.coord[,1:2], clab=0, sub="Axes 1-2")
-par(xpd=T)
-colorplot(dapc1$grp.coord[,1:2], dapc1$grp.coord, cex=3, add=TRUE)
-add.scatter.eig(dapc1$eig,10,1,2, posi="bottomright", ratio=.3, csub=1.25)
-
-## axes 2-3
-s.label(dapc1$grp.coord[,2:3], clab=0, sub="Axes 2-3")
-par(xpd=T)
-colorplot(dapc1$grp.coord[,2:3], dapc1$grp.coord, cex=3, add=TRUE)
-add.scatter.eig(dapc1$eig,10,1,2, posi="bottomright", ratio=.3, csub=1.25)
-
-
-
-## MAP DAPC1 RESULTS
-if(require(maps)){
-
-xy <- cbind(H3N2$other$popInfo$Longitude, H3N2$other$popInfo$Latitude)
-
-par(mar=rep(.1,4))
-map(fill=TRUE, col="lightgrey")
-colorplot(xy, -dapc1$grp.coord, cex=3, add=TRUE, trans=FALSE)
 }
-
-
-
-## LOOK FOR OTHER CLUSTERS
-## to reproduce results of the reference paper, use :
-## grp <- find.clusters(hgdp, max.n=50, n.pca=200, scale=FALSE)
-## and then
-## plot(grp$Kstat, type="b", col="blue")
-
-grp <- find.clusters(H3N2, max.n=30, n.pca=200, scale=FALSE, n.clust=4) # takes about 2 minutes
-names(grp)
-
-## (see ?find.clusters for details about the output)
-
-
-
-## PERFORM DAPC - USE POPULATIONS AS CLUSTERS
-## to reproduce exactly analyses from the paper, use "n.pca=1000"
-dapc2 <- dapc(H3N2, pop=grp$grp, all.contrib=TRUE, scale=FALSE, n.pca=200, n.da=80) # takes around 2 minutes
-dapc2
-
-
-## PRODUCE SCATTERPLOT
-scatter(dapc2) # axes 1-2
-scatter(dapc2,2,3) # axes 2-3
-
-
-## MAP DAPC2 RESULTS
-if(require(maps)){
-xy <- cbind(H3N2$other$popInfo$Longitude, H3N2$other$popInfo$Latitude)
-
-myCoords <- apply(dapc2$ind.coord, 2, tapply, pop(H3N2), mean)
-
-par(mar=rep(.1,4))
-map(fill=TRUE, col="lightgrey")
-colorplot(xy, myCoords, cex=3, add=TRUE, trans=FALSE)
-}
-
-}
-}
 \keyword{datasets}



More information about the adegenet-commits mailing list