[Rcolony-commits] r37 - in pkg: R data

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue May 5 16:29:09 CEST 2009


Author: jonesor
Date: 2009-05-05 16:29:09 +0200 (Tue, 05 May 2009)
New Revision: 37

Modified:
   pkg/R/build.colony.input.R
   pkg/data/.Rhistory
   pkg/data/testdata.rda
Log:
Added error checking for identity of individuals in the diads

Modified: pkg/R/build.colony.input.R
===================================================================
--- pkg/R/build.colony.input.R	2009-05-05 12:33:13 UTC (rev 36)
+++ pkg/R/build.colony.input.R	2009-05-05 14:29:09 UTC (rev 37)
@@ -485,9 +485,32 @@
 colonyfile<-colonyfile[which(names(colonyfile)!="paternal.diads.PATH")];
 flush.console();
 warning(paste("The number of defined paternal diads ","(", colonyfile$n.paternal.sibs.or.paternities,") does not equal the number of paternal diads provided in the file selected (", dim(colonyfile$known.paternal.diads)[1],").\n\n",sep=""),immediate.=TRUE)
-}}
+}
 
+#Check the data
+#if(colonyfile$n.known.paternal.diads!=dim(colonyfile$known.paternal.diads)[1]){
+#colonyfile<-colonyfile[which(names(colonyfile)!="paternal.diads.PATH")];
+#flush.console();
+#warning(paste("The number of defined paternal diads ","(", colonyfile$n.paternal.sibs.or.paternities,") does not equal the number of paternal diads provided in the file selected (", dim(colonyfile$known.paternal.diads)[1],").\n\n",sep=""),immediate.=TRUE)
+#}
 
+#if this is true, then all offspring in the diad file are present in the offspring genotype file
+if(sum(colonyfile$known.paternal.diads$V1%in%colonyfile$Offspring[,1])==length(colonyfile$known.paternal.diads$V1)}{}else{
+colonyfile<-colonyfile[which(names(colonyfile)!="paternal.diads.PATH")];
+flush.console();
+warning(paste("Offspring in diad file are not present in the offspring genotype data:",paste(colonyfile$known.paternal.diads$V1[which(colonyfile$known.paternal.diads$V1%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")))
+}
+
+if(sum(colonyfile$known.paternal.diads$V2%in%colonyfile$fathers[,1])==length(colonyfile$known.paternal.diads$V2)}{}else{
+colonyfile<-colonyfile[which(names(colonyfile)!="paternal.diads.PATH")];
+flush.console();
+warning(paste("Fathers in diad file are not present in the father genotype data:",paste(colonyfile$known.paternal.diads$V2[which(colonyfile$known.paternal.diads$V2%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")))
+}
+
+
+}
+
+
 write.table(paste(colonyfile$n.known.paternal.diads,"!Number of known paternities"),name,append=TRUE,quote=FALSE,row.names=FALSE,col.names=FALSE)
 colonyfile$known.paternal.diads[,1+dim(colonyfile$known.paternal.diads)[2]]<-c("!IDs of known offspring-father dyad",rep("",dim(colonyfile$known.paternal.diads)[1]-1))
 
@@ -545,9 +568,25 @@
 colonyfile<-colonyfile[which(names(colonyfile)!="maternal.diads.PATH")];
 flush.console();
 warning(paste("The number of defined maternal diads ","(", colonyfile$n.known.maternal.diads,") does not equal the number of maternal diads provided in the file selected (", dim(colonyfile$known.maternal.diads)[1],").\n\n",sep=""),immediate.=TRUE)
-}}
+}
 
+#if this is true, then all offspring in the diad file are present in the offspring genotype file
+if(sum(colonyfile$known.maternal.diads$V1%in%colonyfile$Offspring[,1])==length(colonyfile$known.maternal.diads$V1)}{}else{
+colonyfile<-colonyfile[which(names(colonyfile)!="maternal.diads.PATH")];
+flush.console();
+warning(paste("Offspring in diad file are not present in the offspring genotype data:",paste(colonyfile$known.maternal.diads$V1[which(colonyfile$known.maternal.diads$V1%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")))
+}
 
+if(sum(colonyfile$known.maternal.diads$V2%in%colonyfile$Mothers[,1])==length(colonyfile$known.maternal.diads$V2)}{}else{
+colonyfile<-colonyfile[which(names(colonyfile)!="maternal.diads.PATH")];
+flush.console();
+warning(paste("Mothers in diad file are not present in the mother genotype data:",paste(colonyfile$known.maternal.diads$V2[which(colonyfile$known.maternal.diads$V2%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")))
+}
+
+}
+
+
+
 write.table(paste(colonyfile$n.known.maternal.diads," !Number of known maternities"),name,append=TRUE,quote=FALSE,row.names=FALSE,col.names=FALSE)
 colonyfile$known.maternal.diads[,1+dim(colonyfile$known.maternal.diads)[2]]<-c("!IDs of known offspring-mother dyad",rep("",dim(colonyfile$known.maternal.diads)[1]-1))
 

Modified: pkg/data/.Rhistory
===================================================================
--- pkg/data/.Rhistory	2009-05-05 12:33:13 UTC (rev 36)
+++ pkg/data/.Rhistory	2009-05-05 14:29:09 UTC (rev 37)
@@ -1,2 +1,32 @@
 load("/Users/ZSL/Documents/IoZ/rcolony.development/rcolony/data/testdata.rda")
 testdata
+load("/Users/ZSL/Documents/IoZ/rcolony/pkg/data/testdata.rda")
+summary(testdata)
+testdata
+testdata$pairwise.sibs
+testdata$pairwise.sibs[,1]
+testdata$pairwise.sibs[,1]=="hello"<-"O10"
+testdata$pairwise.sibs[,1][testdata$pairwise.sibs[,1]=="hello"]<-"O10"
+testdata$pairwise.sibs[,1]
+load("/Users/ZSL/Documents/IoZ/rcolony/pkg/data/testdata.rda")
+testdata$pairwise.sibs[,1]
+testdata$pairwise.sibs[,1]=="hello"
+testdata$pairwise.sibs[,1][testdata$pairwise.sibs[,1]=="hello"]
+as.character(testdata$pairwise.sibs[,1])[testdata$pairwise.sibs[,1]=="hello"]
+testdata$pairwise.sibs[,1][testdata$pairwise.sibs[,1]=="hello"]
+testdata$pairwise.sibs[,1]<-as.character(testdata$pairwise.sibs[,1])
+testdata$pairwise.sibs[,1][testdata$pairwise.sibs[,1]=="hello"]<-"O10"
+testdata$pairwise.sibs[,1]
+testdata$pairwise.sibs[,1]<-as.factor(testdata$pairwise.sibs[,1])
+testdata$pairwise.sibs[,1]
+testdata$pairwise.sibs[,2]
+testdata$pairwise.sibs[,2]<-as.character(testdata$pairwise.sibs[,2])
+testdata$pairwise.sibs[,2][testdata$pairwise.sibs[,2]=="hello"]<-"O10"
+testdata$pairwise.sibs[,2]<-as.factor(testdata$pairwise.sibs[,2])
+testdata
+save("testdata.rda")
+save(testdata,"testdata.rda")
+?save
+save(testdata,file="testdata.rda")
+load("/Users/ZSL/Documents/IoZ/rcolony/pkg/data/testdata.rda")
+testdata

Modified: pkg/data/testdata.rda
===================================================================
(Binary files differ)



More information about the Rcolony-commits mailing list