[Rcolony-commits] r43 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 7 16:54:42 CEST 2009


Author: jonesor
Date: 2009-05-07 16:54:42 +0200 (Thu, 07 May 2009)
New Revision: 43

Modified:
   pkg/R/build.colony.input.R
   pkg/R/run.colony.R
   pkg/man/monitor.colony.Rd
   pkg/man/run.colony.Rd
Log:
Misc fixes

Modified: pkg/R/build.colony.input.R
===================================================================
--- pkg/R/build.colony.input.R	2009-05-07 11:25:48 UTC (rev 42)
+++ pkg/R/build.colony.input.R	2009-05-07 14:54:42 UTC (rev 43)
@@ -480,8 +480,11 @@
 #Read in the data...
 colonyfile$known.paternal.diads<-read.table(colonyfile$paternal.diads.PATH,header=FALSE,sep=colonyfile$delim.for.paternal.diads.PATH,colClasses=c("character"))
 
+flush.console()
+
 #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)
@@ -498,13 +501,13 @@
 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=", ")))
+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=", ")),immediate.=TRUE)
 }
 
 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=", ")))
+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=", ")),immediate.=TRUE)
 }
 
 
@@ -574,13 +577,13 @@
 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=", ")))
+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=", ")),immediate.=TRUE)
 }
 
 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=", ")))
+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=", ")),immediate.=TRUE)
 }
 
 }
@@ -652,7 +655,7 @@
 if(sum(colonyfile$paternal.sibships$V1%in%colonyfile$fathers[,1])==length(colonyfile$paternal.sibships$V1)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="paternal.sibs.PATH")];
 flush.console();
-warning(paste("Fathers in paternal sibships file are not present in the fathers genotype data:",paste(colonyfile$paternal.sibships$V1[which(colonyfile$paternal.sibships$V1%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")))
+warning(paste("Fathers in paternal sibships file are not present in the fathers genotype data:",paste(colonyfile$paternal.sibships$V1[which(colonyfile$paternal.sibships$V1%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)
 }
 
 os<-na.omit(as.vector(as.matrix(colonyfile$paternal.sibships[,2:dim(colonyfile$paternal.sibships)[2]])))
@@ -660,7 +663,7 @@
 if(sum(os%in%colonyfile$fathers[,1])==length(os)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="paternal.sibs.PATH")];
 flush.console();
-warning(paste("Offspring in paternal sibships file are not present in the fathers genotype data:",paste(os[which(os%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")))
+warning(paste("Offspring in paternal sibships file are not present in the fathers genotype data:",paste(os[which(os%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)
 }
 
 }	
@@ -747,7 +750,7 @@
 if(sum(colonyfile$maternal.sibships$V1%in%colonyfile$mothers[,1])==length(colonyfile$maternal.sibships$V1) ){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="maternal.sibs.PATH")];
 flush.console();
-warning(paste("Mothers in maternal sibships file are not present in the mothers genotype data:",paste(colonyfile$maternal.sibships$V1[which(colonyfile$maternal.sibships$V1%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")))
+warning(paste("Mothers in maternal sibships file are not present in the mothers genotype data:",paste(colonyfile$maternal.sibships$V1[which(colonyfile$maternal.sibships$V1%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)
 }
 
 os<-na.omit(as.vector(as.matrix(colonyfile$maternal.sibships[,2:dim(colonyfile$maternal.sibships)[2]])))
@@ -755,7 +758,7 @@
 if(sum(os%in%colonyfile$fathers[,1])==length(os)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="maternal.sibs.PATH")];
 flush.console();
-warning(paste("Offspring in maternal sibships file are not present in the mothers genotype data:",paste(os[which(os%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")))
+warning(paste("Offspring in maternal sibships file are not present in the mothers genotype data:",paste(os[which(os%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)
 }
 
 
@@ -848,7 +851,7 @@
 if(sum(colonyfile$excluded.paternities$V1%in%colonyfile$Offspring[,1])==length(colonyfile$excluded.paternities$V1)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="excluded.paternities.PATH")];
 flush.console();
-warning(paste("Offspring in excluded paternities file are not present in the offspring genotype data:",paste(colonyfile$excluded.paternities$V1[which(colonyfile$excluded.paternities$V1%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")))
+warning(paste("Offspring in excluded paternities file are not present in the offspring genotype data:",paste(colonyfile$excluded.paternities$V1[which(colonyfile$excluded.paternities$V1%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)
 }
 
 os<-na.omit(as.vector(as.matrix(colonyfile$excluded.paternities[,2:dim(colonyfile$excluded.paternities)[2]])))
@@ -856,7 +859,7 @@
 if(sum(os%in%colonyfile$fathers[,1])==length(os)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="excluded.paternities.PATH")];
 flush.console();
-warning(paste("Fathers in excluded paternities file are not present in the fathers genotype data:",paste(os[which(os%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")))}
+warning(paste("Fathers in excluded paternities file are not present in the fathers genotype data:",paste(os[which(os%in%colonyfile$fathers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)}
 
 
 }
@@ -939,7 +942,7 @@
 if(sum(colonyfile$excluded.maternities$V1%in%colonyfile$Offspring[,1])==length(colonyfile$excluded.maternities$V1)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="excluded.maternities.PATH")];
 flush.console();
-warning(paste("Offspring in excluded maternities file are not present in the offspring genotype data:",paste(colonyfile$excluded.maternities$V1[which(colonyfile$excluded.maternities$V1%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")))
+warning(paste("Offspring in excluded maternities file are not present in the offspring genotype data:",paste(colonyfile$excluded.maternities$V1[which(colonyfile$excluded.maternities$V1%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)
 }
 
 os<-na.omit(as.vector(as.matrix(colonyfile$excluded.maternities[,2:dim(colonyfile$excluded.maternities)[2]])))
@@ -947,7 +950,7 @@
 if(sum(os%in%colonyfile$mothers[,1])==length(os)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="excluded.maternities.PATH")];
 flush.console();
-warning(paste("Fathers in excluded maternities file are not present in the mothers genotype data:",paste(os[which(os%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")))}
+warning(paste("Fathers in excluded maternities file are not present in the mothers genotype data:",paste(os[which(os%in%colonyfile$mothers[,1]==FALSE)], collapse=", ")),immediate.=TRUE)}
 
 
 
@@ -1026,7 +1029,7 @@
 if(sum(os%in%colonyfile$mothers[,1])==length(os)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="excluded.paternal.sibships.PATH")];
 flush.console();
-warning(paste("Offspring in excluded paternal sibships file are not present in the offspring genotype data:",paste(os[which(os%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")))}
+warning(paste("Offspring in excluded paternal sibships file are not present in the offspring genotype data:",paste(os[which(os%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")),immediate.=TRUE)}
 
 
 }
@@ -1107,7 +1110,7 @@
 if(sum(os%in%colonyfile$mothers[,1])==length(os)){}else{
 colonyfile<-colonyfile[which(names(colonyfile)!="excluded.maternal.sibships.PATH")];
 flush.console();
-warning(paste("Offspring in excluded maternal sibships file are not present in the offspring genotype data:",paste(os[which(os%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")))}
+warning(paste("Offspring in excluded maternal sibships file are not present in the offspring genotype data:",paste(os[which(os%in%colonyfile$Offspring[,1]==FALSE)], collapse=", ")),immediate.=TRUE)}
 
 }
 

Modified: pkg/R/run.colony.R
===================================================================
--- pkg/R/run.colony.R	2009-05-07 11:25:48 UTC (rev 42)
+++ pkg/R/run.colony.R	2009-05-07 14:54:42 UTC (rev 43)
@@ -40,11 +40,11 @@
 #Copy Colony2 program to the working directory
 	system(paste("cp",colonyexecpath,datadir,sep=" "))
 	
-#Rename the DAT file as Colony2.DAT
-	system(paste("mv",paste(datadir,filename,sep=""),paste(datadir,"Colony2.DAT",sep=""),sep=" "))
+#Rename the DAT file as Colony2.DAT (unless it is already called "Colony2.DAT")
+if(filename!="Colony2.DAT"){system(paste("mv",paste(datadir,filename,sep=""),paste(datadir,"Colony2.DAT",sep=""),sep=" "))}
 	
 #Make a copy of the DAT file in it's original name
-	system(paste("cp",paste(datadir,"Colony2.DAT",sep=""),paste(datadir,filename,sep=""),sep=" "))
+if(filename!="Colony2.DAT"){system(paste("cp",paste(datadir,"Colony2.DAT",sep=""),paste(datadir,filename,sep=""),sep=" "))}
 	
 #Run Colony
 #If monitor = TRUE, then a temp.txt file is produced (temp.txt). This can be monitored using monitor.colony.R so progress can be observed.
@@ -56,7 +56,7 @@
 
 #Remove the Colony2.exe and 
 	system(paste("rm",colonyexec))
-	system("rm Colony2.DAT")
+if(filename!="Colony2.DAT"){system("rm Colony2.DAT")}
 
 
 
@@ -66,9 +66,9 @@
 
 	#Windows commands
 	shell(paste("copy",colonyexecpath,datadir,sep=" "))#Copy the colony exe file to the project directory	
-	shell(paste("rename",paste(datadir,filename,sep=""),paste(datadir,"Colony2.DAT",sep=""),sep=" "))#Rename the colony dat file as Colony2.DAT	 
+	if(filename!="Colony2.DAT"){shell(paste("rename",paste(datadir,filename,sep=""),paste(datadir,"Colony2.DAT",sep=""),sep=" "))}#Rename the colony dat file as Colony2.DAT	 
 	shell.exec("Colony2.exe") #run colony2
-	shell(paste("rename",paste(datadir,"Colony2.DAT",sep=""),paste(datadir,filename,sep=""),sep=" "))#Rename the colony dat file to original file name.	 
+	if(filename!="Colony2.DAT"){shell(paste("rename",paste(datadir,"Colony2.DAT",sep=""),paste(datadir,filename,sep=""),sep=" "))}#Rename the colony dat file to original file name.	 
 	shell("del Colony2.exe") #tidy up, remove colony2.exe	  
 	
 	}else{stop(paste("This function is not correctly configured to run on",platform$OS.type,"systems."))

Modified: pkg/man/monitor.colony.Rd
===================================================================
--- pkg/man/monitor.colony.Rd	2009-05-07 11:25:48 UTC (rev 42)
+++ pkg/man/monitor.colony.Rd	2009-05-07 14:54:42 UTC (rev 43)
@@ -16,42 +16,42 @@
 \item{interv.t}{The interval (in seconds) at which R should retrieve intermediate data.}
   \item{last.few}{(not yet implemented) How many datapoints should be displayed. Set to -1 to show all data. If the number is a positive integer, then the last x datapoints are shown.}
 \item{n}{If there are two variables witht he same name, which one should be used? See details.}
-\item{showres}{Should R show the results obtained in a table in the R console window? Boolean.}
+\item{showres}{Should R show the results obtained in a table to be displayed in the R console window? Boolean.}
 
 
 }
 \details{
 The intermediate results available are:
 
-\textit{Run} : The replicate run number. Variable
-\textit{Tmr} : The number of temperature reductions so far within the run. Variable
-\textit{Itr} : The number of iterates (reconfigurations considered) so far within the run. Variable
-\textit{NSucc} : The number of successful (accepted) reconfigurations so far within the temperature. Variable
-\textit{NSuccLmt} : Maximum (Limit) number of successful reconfigurations allowed within the temperature. Constant
-\textit{NFail1} : The number of reconfigurations since the last update of the best likelihood within the temperature. Variable
-\textit{NFail1Lmt} : Maximum (Limit) value of  NFail1 within the temperature. Constant
-\textit{NFail2} : The total number of reconfigurations since the last update of the best likelihood within the run. Variable
-\textit{NFail2Lmt} : Maximum (Limit) value of  NFail2 within a run. Constant. The run terminates when NFail2Lmt=NFail2 and the successful rate (see below) < 0.01
-\textit{SucRate\%} : =NSucc / Itr. Variable
-\textit{SucLmt\%} : =NSucc / NSuccLmt. Variable
-\textit{FailLmt\%} : =NFail1 / NFail1Lmt. Variable
-\textit{IterLmt\%} : = (Number of iterates) / (Maximum number of iterates) within a temperature. Variable
-\textit{CrLogL} : The log likelihood of the current configuration. Variable
-\textit{BtLogL} : The best log likelihood reached with the current configuration. Variable
+\emph{Run} : The replicate run number. Variable
+\emph{Tmr} : The number of temperature reductions so far within the run. Variable
+\emph{Itr} : The number of iterates (reconfigurations considered) so far within the run. Variable
+\emph{NSucc} : The number of successful (accepted) reconfigurations so far within the temperature. Variable
+\emph{NSuccLmt} : Maximum (Limit) number of successful reconfigurations allowed within the temperature. Constant
+\emph{NFail1} : The number of reconfigurations since the last update of the best likelihood within the temperature. Variable
+\emph{NFail1Lmt} : Maximum (Limit) value of  NFail1 within the temperature. Constant
+\emph{NFail2} : The total number of reconfigurations since the last update of the best likelihood within the run. Variable
+\emph{NFail2Lmt} : Maximum (Limit) value of  NFail2 within a run. Constant. The run terminates when NFail2Lmt=NFail2 and the successful rate (see below) < 0.01
+\emph{SucRate\%} : =NSucc / Itr. Variable
+\emph{SucLmt\%} : =NSucc / NSuccLmt. Variable
+\emph{FailLmt\%} : =NFail1 / NFail1Lmt. Variable
+\emph{IterLmt\%} : = (Number of iterates) / (Maximum number of iterates) within a temperature. Variable
+\emph{CrLogL} : The log likelihood of the current configuration. Variable
+\emph{BtLogL} : The best log likelihood reached with the current configuration. Variable
 
-\textit{#F1} : Current number of paternal sib families. Variable
-\textit{#F2} : Current number of maternal sib families. Variable
-\textit{#F3} : Current number of sib family clusters. Variable
-\textit{#FS} : Current number of full sib families. Variable
-\textit{HSPair} : Current number of half-sib dyads. Variable
-\textit{FSPair} : Current number of full-sib dyads. Variable
-\textit{#AssgnC1} : Current number of candidate males that are assigned parentage. Variable
-\textit{#AssgnC2} : Current number of candidate females that are assigned parentage. Variable
-\textit{#AssgnP1} : Current number of offspring that have assigned paternity. Variable
-\textit{#AssgnP2} : Current number of offspring that have assigned maternity. Variable
+\emph{#F1} : Current number of paternal sib families. Variable
+\emph{#F2} : Current number of maternal sib families. Variable
+\emph{#F3} : Current number of sib family clusters. Variable
+\emph{#FS} : Current number of full sib families. Variable
+\emph{HSPair} : Current number of half-sib dyads. Variable
+\emph{FSPair} : Current number of full-sib dyads. Variable
+\emph{#AssgnC1} : Current number of candidate males that are assigned parentage. Variable
+\emph{#AssgnC2} : Current number of candidate females that are assigned parentage. Variable
+\emph{#AssgnP1} : Current number of offspring that have assigned paternity. Variable
+\emph{#AssgnP2} : Current number of offspring that have assigned maternity. Variable
 
 F1, F2, F3, FS, HSPair, FSPair, AssgnC1, AssgnC2, AssgnP1 and AssgnP2 appear twice in the intermediate outputs of Colony2. Their first appearance is for the current status. While the second appearance is for the best status so far (i.e. the maximum value).
-Users wishing to plot any of these values should use the \textit{n} argument to select the appropriate value (1 for the current value, 2 for best value).
+Users wishing to plot any of these values should use the \emph{n} argument to select the appropriate value (1 for the current value, 2 for best value).
 
 }
 \value{}

Modified: pkg/man/run.colony.Rd
===================================================================
--- pkg/man/run.colony.Rd	2009-05-07 11:25:48 UTC (rev 42)
+++ pkg/man/run.colony.Rd	2009-05-07 14:54:42 UTC (rev 43)
@@ -1,15 +1,13 @@
 \name{run.colony}
 \alias{run.colony}
-%- Also NEED an '\alias' for EACH other topic documented here.
-\title{ ~~function to do ... ~~ }
+\title{A function to run Colony2 from within the R environment.}
 \description{
-  ~~ A concise (1-5 lines) description of what the function does. ~~
-}
-\usage{function(colonyexecpath="prompt",datfilepath="prompt",wait=TRUE,monitor=TRUE)}
+This function used \code{system} to call Colony2 from within R.}
+\usage{run.colony(colonyexecpath="prompt",datfilepath="prompt",wait=TRUE,monitor=TRUE)}
 
 \arguments{
   \item{colonyexecpath}{The path to the Colony2 executable. If none is given, and the function defaults to \"prompt\", then you will be prompted to click on the file.}
-  \item{datfilepath}{ he path to the DAT file that you wish to run. If none is given, and the function defaults to \"prompt\", then you will be prompted to click on the file. }
+  \item{datfilepath}{The path to the DAT file that you wish to run. If none is given, and the function defaults to \"prompt\", then you will be prompted to click on the file. }
   \item{wait}{Should R wait for Colony2 to be run by the system or not? TRUE/FALSE}
   \item{monitor}{Do you wish to monitor the output of Colony2 while it is running? }
 
@@ -31,4 +29,4 @@
 \examples{
 
 }
-\keyword{ IO }
+\keyword{IO}



More information about the Rcolony-commits mailing list