[adegenet-commits] r1064 - in pkg: . man src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 29 18:10:51 CET 2013
Author: jombart
Date: 2013-01-29 18:10:51 +0100 (Tue, 29 Jan 2013)
New Revision: 1064
Modified:
pkg/ChangeLog
pkg/DESCRIPTION
pkg/man/adegenet.package.Rd
pkg/man/as.SNPbin.Rd
pkg/man/fasta2DNAbin.Rd
pkg/src/sharedAll.c
pkg/src/snpbin.c
Log:
Preparing new release (1.3-6)
Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog 2013-01-29 12:25:36 UTC (rev 1063)
+++ pkg/ChangeLog 2013-01-29 17:10:51 UTC (rev 1064)
@@ -1,3 +1,16 @@
+ CHANGES IN ADEGENET VERSION 1.3-6
+
+NEW FEATURES
+
+ o findMutations: a new procedure to identify the location and
+ nature of mutations between pairs of DNA sequences
+
+ o graphMutations: a graphical representation for findMutations
+
+ o improved graphics for gengraph
+
+
+
CHANGES IN ADEGENET VERSION 1.3-5
NEW FEATURES
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2013-01-29 12:25:36 UTC (rev 1063)
+++ pkg/DESCRIPTION 2013-01-29 17:10:51 UTC (rev 1064)
@@ -1,9 +1,9 @@
Package: adegenet
Version: 1.3-6
-Date: 2012/10/31
+Date: 2013/01/30
Title: adegenet: an R package for the exploratory analysis of genetic and genomic data.
Author: Thibaut Jombart <t.jombart at imperial.ac.uk>
-Developpers: Ismail Ahmed <ismail.ahmed at inserm.fr>, Anne Cori <a.cori at imperial.ac.uk>, Peter Solymos
+Developpers: Ismail Ahmed <ismail.ahmed at inserm.fr>, Anne Cori <a.cori at imperial.ac.uk>, Tobias Erik Reiners <Tobias.Reiners at Senckenberg.de>, Peter Solymos
Contributed datasets from: Katayoun Moazami-Goudarzi, Denis Laloe,
Dominique Pontier, Daniel Maillard, Francois Balloux
Maintainer: Thibaut Jombart <t.jombart at imperial.ac.uk>
Modified: pkg/man/adegenet.package.Rd
===================================================================
--- pkg/man/adegenet.package.Rd 2013-01-29 12:25:36 UTC (rev 1063)
+++ pkg/man/adegenet.package.Rd 2013-01-29 17:10:51 UTC (rev 1064)
@@ -190,14 +190,14 @@
\tabular{ll}{
Package: \tab adegenet\cr
Type: \tab Package\cr
- Version: \tab 1.3-5\cr
- Date: \tab 2012-10-31 \cr
+ Version: \tab 1.3-6\cr
+ Date: \tab 2013-01-30 \cr
License: \tab GPL (>=2)
}
}
\author{
Thibaut Jombart <t.jombart at imperial.ac.uk>\cr
- with contributions of: Ismail Ahmed <ismail.ahmed at inserm.fr>, Peter Solymos\cr
+ Developpers: Ismail Ahmed <ismail.ahmed at inserm.fr>, Tobias Erik Reiners, Peter Solymos, Anne Cori\cr
and contributed datasets from: Katayoun Moazami-Goudarzi, Denis Laloë,
Dominique Pontier, Daniel Maillard, Francois Balloux.
}
Modified: pkg/man/as.SNPbin.Rd
===================================================================
--- pkg/man/as.SNPbin.Rd 2013-01-29 12:25:36 UTC (rev 1063)
+++ pkg/man/as.SNPbin.Rd 2013-01-29 17:10:51 UTC (rev 1064)
@@ -37,6 +37,7 @@
genotypes. \cr
}
\examples{
+\dontrun{
## data to be converted
dat <- c(1,0,0,2,1,1,1,2,2,1,1,0,0,1)
@@ -51,4 +52,5 @@
identical(x1,x2)
identical(x1,x3)
}
+}
\keyword{classes}
Modified: pkg/man/fasta2DNAbin.Rd
===================================================================
--- pkg/man/fasta2DNAbin.Rd 2013-01-29 12:25:36 UTC (rev 1063)
+++ pkg/man/fasta2DNAbin.Rd 2013-01-29 17:10:51 UTC (rev 1064)
@@ -47,6 +47,7 @@
}
\author{Thibaut Jombart \email{t.jombart at imperial.ac.uk} }
\examples{
+\dontrun{
## show the example file ##
## this is the path to the file:
myPath <- system.file("files/usflu.fasta",package="adegenet")
@@ -55,6 +56,6 @@
## read the file
obj <- fasta2DNAbin(myPath, chunk=10) # process 10 sequences at a time
obj
-
}
+}
\keyword{manip}
Modified: pkg/src/sharedAll.c
===================================================================
--- pkg/src/sharedAll.c 2013-01-29 12:25:36 UTC (rev 1063)
+++ pkg/src/sharedAll.c 2013-01-29 17:10:51 UTC (rev 1064)
@@ -24,92 +24,92 @@
/* THIS FUNCTION IS DEPRECATED */
void sharedAll(int *matAll, int *nRow, int *nCol, double *resVec)
{
-/* Declare local C variables */
- int i, i1, i2, j, k, n, p, nbAll, **mat, temp;
- n = *nRow;
- p = *nCol;
+ /* Declare local C variables */
+ int i, i1, i2, j, k, n, p, nbAll, **mat;
+ n = *nRow;
+ p = *nCol;
- int nLoc=p/2;
+ int nLoc=p/2;
-/* Memory allocation for local C variables */
+ /* Memory allocation for local C variables */
- tabintalloc(&mat, n, p); /* function from ade4 */
+ tabintalloc(&mat, n, p); /* function from ade4 */
-/* Local reconstruction of the matrix of alleles
- ! beware: this matrix is to be used from 1 to n and 1 to p included,
- and not from zero to n and p excluded as it is common in C */
- k = 0;
- for (j=1; j<=p; j++) {
- for (i=1; i<=n; i++) {
- mat[i][j] = matAll[k];
- k = k + 1;
- }
- }
+ /* Local reconstruction of the matrix of alleles
+ ! beware: this matrix is to be used from 1 to n and 1 to p included,
+ and not from zero to n and p excluded as it is common in C */
+ k = 0;
+ for (j=1; j<=p; j++) {
+ for (i=1; i<=n; i++) {
+ mat[i][j] = matAll[k];
+ k = k + 1;
+ }
+ }
-/* == Main Computations: ==
- - i1, i2: indices of genotypes
- - j: index of allele
- - n: number of genotypes
- - p number of columns in mat (i.e. twice the number of loci)
- - each term in mat codes an allele (NAs are coded by 0)
-*/
+ /* == Main Computations: ==
+ - i1, i2: indices of genotypes
+ - j: index of allele
+ - n: number of genotypes
+ - p number of columns in mat (i.e. twice the number of loci)
+ - each term in mat codes an allele (NAs are coded by 0)
+ */
- k=0; /* counter used to browse resVec */
- for(i1=1; i1<=(n-1); i1++){
- for(i2=(i1+1); i2<=n; i2++){
- /* Used for debugging
- printf("\n\n debug: ## %d-%d ##",i1,i2);
- */
+ k=0; /* counter used to browse resVec */
+ for(i1=1; i1<=(n-1); i1++){
+ for(i2=(i1+1); i2<=n; i2++){
+ /* Used for debugging
+ printf("\n\n debug: ## %d-%d ##",i1,i2);
+ */
- resVec[k] = 0.0; /* Initialization of the result */
- nbAll = 0; /* counts the number of types alleles */
- for(j=1; j<=nLoc; j++){
- /* Used for debugging
- printf("\n debug: j=%d",j);
- printf("\n debug: mat[i1,j]=%d",mat[i1][j]);
- printf("\n debug: mat[i1,j]=%d",mat[i1][j+nLoc]);
- printf("\n debug: mat[i2,j]=%d",mat[i2][j]);
- printf("\n debug: mat[i2,j+nLoc]=%d",mat[i2][j+nLoc]);
- */
- if(mat[i1][j] != 0 && mat[i1][j+nLoc] != 0 &&
- mat[i2][j] != 0 && mat[i2][j+nLoc] != 0){
- /* Used for debugging
- printf("\n debug: alleles are typed");
- */
- nbAll+=2;
- /* Used for debugging
- printf("\n debug: nbAll=%d", nbAll);
- */
- /* Compare alleles:
- -> either both alleles are in common,
- -> or no allele are common,
- -> or there is one common allele */
- /* both alleles common */
- if((mat[i1][j] == mat[i2][j]
- && mat[i1][j+nLoc] == mat[i2][j+nLoc])
- || (mat[i1][j] == mat[i2][j+nLoc]
- && mat[i1][j+nLoc] == mat[i2][j])){
- resVec[k] += 2.0;
- } else if(!( /* if not 'all alleles differe' */
- mat[i1][j] != mat[i2][j]
- && mat[i1][j] != mat[i2][j+nLoc]
- && mat[i1][j+nLoc] != mat[i2][j]
- && mat[i1][j+nLoc] != mat[i2][j+nLoc])
- ) resVec[k]++;
+ resVec[k] = 0.0; /* Initialization of the result */
+ nbAll = 0; /* counts the number of types alleles */
+ for(j=1; j<=nLoc; j++){
+ /* Used for debugging
+ printf("\n debug: j=%d",j);
+ printf("\n debug: mat[i1,j]=%d",mat[i1][j]);
+ printf("\n debug: mat[i1,j]=%d",mat[i1][j+nLoc]);
+ printf("\n debug: mat[i2,j]=%d",mat[i2][j]);
+ printf("\n debug: mat[i2,j+nLoc]=%d",mat[i2][j+nLoc]);
+ */
+ if(mat[i1][j] != 0 && mat[i1][j+nLoc] != 0 &&
+ mat[i2][j] != 0 && mat[i2][j+nLoc] != 0){
+ /* Used for debugging
+ printf("\n debug: alleles are typed");
+ */
+ nbAll+=2;
+ /* Used for debugging
+ printf("\n debug: nbAll=%d", nbAll);
+ */
+ /* Compare alleles:
+ -> either both alleles are in common,
+ -> or no allele are common,
+ -> or there is one common allele */
+ /* both alleles common */
+ if((mat[i1][j] == mat[i2][j]
+ && mat[i1][j+nLoc] == mat[i2][j+nLoc])
+ || (mat[i1][j] == mat[i2][j+nLoc]
+ && mat[i1][j+nLoc] == mat[i2][j])){
+ resVec[k] += 2.0;
+ } else if(!( /* if not 'all alleles differe' */
+ mat[i1][j] != mat[i2][j]
+ && mat[i1][j] != mat[i2][j+nLoc]
+ && mat[i1][j+nLoc] != mat[i2][j]
+ && mat[i1][j+nLoc] != mat[i2][j+nLoc])
+ ) resVec[k]++;
- } /* end if */
- } /* end for j in 1:(nLoc) */
+ } /* end if */
+ } /* end for j in 1:(nLoc) */
- /* Divide the number of shared alleles by the number of typed alleles */
- if(nbAll > 0) resVec[k] = resVec[k]/nbAll;
- /*printf("\n debug: resVec[i1,i2]/nbAll (%d,%d)=# %f #", i1,i2,resVec[k]);*/
- k++;
+ /* Divide the number of shared alleles by the number of typed alleles */
+ if(nbAll > 0) resVec[k] = resVec[k]/nbAll;
+ /*printf("\n debug: resVec[i1,i2]/nbAll (%d,%d)=# %f #", i1,i2,resVec[k]);*/
+ k++;
- } /* end for i2 */
- } /* end for i1*/
+ } /* end for i2 */
+ } /* end for i1*/
- /* Free allocated memory */
- freeinttab(mat);
+ /* Free allocated memory */
+ freeinttab(mat);
} /* end sharedAll */
@@ -117,8 +117,8 @@
/* SMALL FUNCTION TO RETURN THE SMALLEST OF 2 INTEGERS */
int min_int(int a, int b){
- if(a<b) return a;
- return b;
+ if(a<b) return a;
+ return b;
}
@@ -126,34 +126,34 @@
/* THIS IS THE FUNCTION TO USE */
void nb_shared_all(int *in, int *out, int *nind, int *ncol){
- int i, j, k, counter=0, **mat, n = *nind, p = *ncol;
+ int i, j, k, counter=0, **mat, n = *nind, p = *ncol;
- /* allocate memory for table of allele nb */
- tabintalloc(&mat, n, p);
+ /* allocate memory for table of allele nb */
+ tabintalloc(&mat, n, p);
- /* reconstruct table of allele nb */
- for(j=1;j<=p;j++){
- for(i=1;i<=n;i++){
- mat[i][j] = in[counter++];
- }
- }
+ /* reconstruct table of allele nb */
+ for(j=1;j<=p;j++){
+ for(i=1;i<=n;i++){
+ mat[i][j] = in[counter++];
+ }
+ }
- /* perform computations */
- counter = 0;
- for(i=1;i<=(n-1);i++){
- for(j=i+1;j<=n;j++){
- out[counter] = 0; /* initialize result to zero */
- for(k=1;k<=p;k++){
- out[counter] = out[counter] + min_int(mat[i][k], mat[j][k]);
- }
- counter++;
- }
- }
+ /* perform computations */
+ counter = 0;
+ for(i=1;i<=(n-1);i++){
+ for(j=i+1;j<=n;j++){
+ out[counter] = 0; /* initialize result to zero */
+ for(k=1;k<=p;k++){
+ out[counter] = out[counter] + min_int(mat[i][k], mat[j][k]);
+ }
+ counter++;
+ }
+ }
- /* Free allocated memory */
- freeinttab(mat);
+ /* Free allocated memory */
+ freeinttab(mat);
} /* end nb_shared_all */
Modified: pkg/src/snpbin.c
===================================================================
--- pkg/src/snpbin.c 2013-01-29 12:25:36 UTC (rev 1063)
+++ pkg/src/snpbin.c 2013-01-29 17:10:51 UTC (rev 1064)
@@ -393,7 +393,6 @@
double snpbin_dotprod_int(struct snpbin *x, struct snpbin *y, double *mean, double *sd){
/* define variables, allocate memory */
int P = nLoc(x), i;
- short isna;
double res = 0.0;
int *vecx, *vecy;
vecx = (int *) calloc(P, sizeof(int));
@@ -415,7 +414,6 @@
/* } */
/* compute dot product */
- int count=0;
for(i=0;i<P;i++){
if(snpbin_isna(x,i) == 0 && snpbin_isna(y,i) == 0){
/* res += ((vecx[i]-mean[i])/sd[i]) * ((vecy[i]-mean[i])/sd[i]); */
@@ -440,7 +438,6 @@
double snpbin_dotprod_freq(struct snpbin *x, struct snpbin *y, double *mean, double *sd){
/* define variables, allocate memory */
int P = nLoc(x), i;
- short isna;
double res = 0.0;
double *vecx, *vecy;
vecx = (double *) calloc(P, sizeof(double));
@@ -462,7 +459,6 @@
/* } */
/* compute dot product */
- int count=0;
for(i=0;i<P;i++){
if(snpbin_isna(x,i) == 0 && snpbin_isna(y,i) == 0){
/* res += ((vecx[i]-mean[i])/sd[i]) * ((vecy[i]-mean[i])/sd[i]); */
@@ -489,7 +485,7 @@
/* and then used to create different 'snpbin' on the C side */
struct genlightC genlightTogenlightC(unsigned char *gen, int *nbvecperind, int *byteveclength, int *nbnaperind, int *naposi, int *nind, int *nloc, int *ploidy){
/* declare variables and allocate memory */
- int i, j, idxByteVec=0, idxNAVec=0;
+ int i, idxByteVec=0, idxNAVec=0;
struct genlightC out;
out.x = (struct snpbin *) calloc(*nind, sizeof(struct snpbin));
@@ -502,7 +498,7 @@
/* printf("\nimported genotype %i: ", i+1); */
/* printsnpbin(&out.x[i]); */
}
-
+
/* printf("step 3"); */
out.nind = nind;
More information about the adegenet-commits
mailing list