[med-svn] [seq-gen] 01/06: New upstream version 1.3.4

Alex Mestiashvili malex-guest at moszumanska.debian.org
Mon Oct 2 15:06:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

malex-guest pushed a commit to branch master
in repository seq-gen.

commit 95dced205a29151807e7b4bbac80785456eb410d
Author: Alexandre Mestiashvili <alex at biotec.tu-dresden.de>
Date:   Mon Oct 2 16:23:50 2017 +0200

    New upstream version 1.3.4
---
 .gitignore                        |   5 +
 documentation/Seq-Gen.Manual.html |  55 +++++++++-
 examples/seqs+trees.phy           |   7 ++
 source/aamodels.c                 |   4 +-
 source/aamodels.h                 |   4 +-
 source/eigen.c                    |   4 +-
 source/eigen.h                    |   4 +-
 source/evolve.c                   |   4 +-
 source/evolve.h                   |   4 +-
 source/gamma.c                    |   4 +-
 source/gamma.h                    |   4 +-
 source/global.c                   |   9 +-
 source/global.h                   |   4 +-
 source/model.c                    |   4 +-
 source/model.h                    |   4 +-
 source/nucmodels.c                |   4 +-
 source/nucmodels.h                |   4 +-
 source/progress.c                 |   4 +-
 source/progress.h                 |   4 +-
 source/seq-gen.c                  | 213 +++++++++++++++++++++-----------------
 source/tree.h                     |   4 +-
 source/treefile.c                 |  14 +--
 source/treefile.h                 |   4 +-
 source/twister.c                  |   4 +-
 source/twister.h                  |   4 +-
 25 files changed, 231 insertions(+), 148 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e519cba
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+._*
+*.o
+*~
+*.swp
+source/seq-gen
diff --git a/documentation/Seq-Gen.Manual.html b/documentation/Seq-Gen.Manual.html
index 843bf10..850779a 100755
--- a/documentation/Seq-Gen.Manual.html
+++ b/documentation/Seq-Gen.Manual.html
@@ -2,18 +2,31 @@
 <head>
 	<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
 	<title>Seq-Gen: Simulation of molecular sequences</title> 
+	<style>body { font-family: Helvetica, Arial, Sans-Serif; }</style>
 </head>
 <body>
 	<center>
 		<h1><i>Seq-Gen</i></h1> <h2>Sequence-Generator: An application for the Monte Carlo simulation of molecular sequence evolution along phylogenetic trees. 
 			<br>
-			Version 1.3.2</h2> 
+			Version 1.3.4</h2> 
 		<p align="center">
 			<img width="32" height="32" src="icon.gif"> 
 		</p>
-		<h2><i>© Copyright 1996-2005<br>
-		Andrew Rambaut and Nick C. Grassly</i></h2>
-		<h2>Supported by <a href="http://www.royalsoc.ac.uk/">The Royal Society</a></h2> 
+		<h2><i>© Copyright 1996-2017<br>
+		Andrew Rambaut and Nicholas C. Grassly</i></h2>
+		<h2>Supported by <a href="http://www.royalsoc.ac.uk/">The Royal Society of London</a></h2> 
+		<address>
+			Institute of Evolutionary Biology, 
+			<br>
+			University of Edinburgh, 
+			<br>
+			Ashworth Laboratories, 
+			<br>
+			King's Buildings, 
+			<br>
+			Edinburgh EH9 2FL, U.K. 
+		</address>
+		<br />Originally developed at:
 		<address>
 			Department of Zoology, 
 			<br>
@@ -23,7 +36,41 @@
 			<br>
 			Oxford OX1 3PS, U.K. 
 		</address>
+		<br />
 	</center>
+	<h4>New features and bugs fixed in version 1.3.4 - 16 Sept 2017</h4> 
+	<ul>
+		<li>
+		FASTA format output (thanks to Kevin Murray)
+		</li>
+		<li>
+		Errors now return a non-zero error code.
+		</li>
+		<li>
+		White space at the end of the last sequence no longer prevents the tree from being read.
+		</li>
+		<li>
+		If the tree file was specified as a command line option the program was hanging.
+		</li>
+		<li>
+		Command line options now allows a space for the model (i.e., -m HKY).
+		</li>
+		<li>
+		Long standing error fixed when expanding memory allocated for big trees (thanks Fr�d�ric Lemoine).
+		</li>
+	</ul>
+	<h4>New features and bugs fixed in version 1.3.3 - 28 Oct 2011</h4> 
+	<ul>
+		<li>
+		MtArt amino acid model added by Lars Jermiin.
+		</li>
+		<li>
+		Memory allocation bugs (thanks to Graham Jones for submitting a fix)
+		</li>
+		<li>
+		Rare array overflow causing odd characters in sequence. Thanks to Howard Ross, Jeff Thorne and Michael Ott for independently spotting this error and Michael and Lars Jermiin for submitting a fix.
+		</li>
+	</ul>
 	<h4>Bug fixed in version 1.3.2 - 7 Jan 2005</h4> 
 	<ul>
 		<li>
diff --git a/examples/seqs+trees.phy b/examples/seqs+trees.phy
new file mode 100644
index 0000000..ff20088
--- /dev/null
+++ b/examples/seqs+trees.phy
@@ -0,0 +1,7 @@
+ 4 40
+Taxon1 ATCTTTGTAGTCATCGCCGTATTAGCATTCTTAGATCTAA 
+Taxon2 ATCCTAGTAGTCGCTTGCGCACTAGCCTTCCGAAATCTAG 
+Taxon3 ACTTCTGTGTTTACTGAGCTACTAGCTTCCCTAAATCTAG 
+Taxon4 ATTCCTATATTCGCTAATTTCTTAGCTTTCCTGAATCTGG  
+1
+(((Taxon1:0.2,Taxon2:0.2):0.1,Taxon3:0.3):0.1,Taxon4:0.4);
diff --git a/source/aamodels.c b/source/aamodels.c
index 3337ff4..f30f288 100755
--- a/source/aamodels.c
+++ b/source/aamodels.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/aamodels.h b/source/aamodels.h
index 815d392..f3e08f6 100755
--- a/source/aamodels.h
+++ b/source/aamodels.h
@@ -1,8 +1,8 @@
 /*  Header file for aamodels.c                             */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/eigen.c b/source/eigen.c
index 4525c0f..d2468a0 100755
--- a/source/eigen.c
+++ b/source/eigen.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
 
    The code in this file is taken from Ziheng Yang's PAML package.
diff --git a/source/eigen.h b/source/eigen.h
index c23ac5c..23d23b2 100755
--- a/source/eigen.h
+++ b/source/eigen.h
@@ -1,8 +1,8 @@
 /*  Header file for eigen.c                                */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
 
    The code in this file is taken from Ziheng Yang's PAML package.
diff --git a/source/evolve.c b/source/evolve.c
index 559bdd5..710d15f 100755
--- a/source/evolve.c
+++ b/source/evolve.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/evolve.h b/source/evolve.h
index 7f71fb5..be82c23 100755
--- a/source/evolve.h
+++ b/source/evolve.h
@@ -1,8 +1,8 @@
 /*  Header file for evolve.c                               */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/gamma.c b/source/gamma.c
index 7d5f36e..8f34618 100755
--- a/source/gamma.c
+++ b/source/gamma.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
 
    The code in this file is taken from Ziheng Yang's PAML package.
diff --git a/source/gamma.h b/source/gamma.h
index a98bf60..9779b14 100755
--- a/source/gamma.h
+++ b/source/gamma.h
@@ -1,8 +1,8 @@
 /*  Header file for gamma.c                                */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
 
    The code in this file is taken from Ziheng Yang's PAML package.
diff --git a/source/global.c b/source/global.c
index 3739d44..0df2ca3 100755
--- a/source/global.c
+++ b/source/global.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
@@ -171,7 +171,7 @@ int GetUnsignedLongParams(int argc, char **argv, int *argn, char *pos, int numPa
 			if (st==NULL)
 				return -1;
 		}
-		
+	
 		if (sscanf(st, "%lu", params+i)!=1)
 			return -1;
 		i++;
@@ -188,7 +188,7 @@ int GetStrParam(int argc, char **argv, int *argn, char *pos, char *param, int le
 {
 	int i;
 	char *st, *P, buf[256];
-	
+		
 	i=0;
 	strcpy(buf, pos);
 	st=strtok(buf, "\t,/");
@@ -202,6 +202,7 @@ int GetStrParam(int argc, char **argv, int *argn, char *pos, char *param, int le
 		if (st==NULL)
 			return -1;
 	}
+
 	strncpy(param, st, len);
 	param[len]='\0';
 	P=param;
diff --git a/source/global.h b/source/global.h
index 16bdef2..b028bca 100755
--- a/source/global.h
+++ b/source/global.h
@@ -1,8 +1,8 @@
 /*  Header file for global.c                               */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/model.c b/source/model.c
index c148114..117a8ea 100755
--- a/source/model.c
+++ b/source/model.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/model.h b/source/model.h
index e3a755a..de1437e 100755
--- a/source/model.h
+++ b/source/model.h
@@ -1,8 +1,8 @@
 /*  Header file for model.c                                */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/nucmodels.c b/source/nucmodels.c
index 7345b2b..71e33b0 100755
--- a/source/nucmodels.c
+++ b/source/nucmodels.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/nucmodels.h b/source/nucmodels.h
index 21d5568..918bd0a 100755
--- a/source/nucmodels.h
+++ b/source/nucmodels.h
@@ -1,8 +1,8 @@
 /*  Header file for nucmodels.c                            */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/progress.c b/source/progress.c
index e484294..70b3ebd 100755
--- a/source/progress.c
+++ b/source/progress.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/progress.h b/source/progress.h
index b97d0ae..9ebc39d 100755
--- a/source/progress.h
+++ b/source/progress.h
@@ -1,8 +1,8 @@
 /*  Header file for progress.c                             */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/seq-gen.c b/source/seq-gen.c
index 4372408..eb384bb 100755
--- a/source/seq-gen.c
+++ b/source/seq-gen.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
@@ -54,7 +54,7 @@
 #include "twister.h"
 
 #define PROGRAM_NAME "seq-gen"
-#define VERSION_NUMBER "Version 1.3.2x"
+#define VERSION_NUMBER "Version 1.3.4"
 
 int treeFile, textFile, numDatasets, numTrees;
 int scaleTrees, scaleBranches, ancestorSeq, writeAncestors, writeRates;
@@ -87,9 +87,10 @@ static void PrintTitle()
 {
 	fprintf(stderr, "Sequence Generator - %s\n", PROGRAM_NAME);
 	fprintf(stderr, "%s\n", VERSION_NUMBER);
-	fprintf(stderr, "(c) Copyright, 1996-2004 Andrew Rambaut and Nick Grassly\n");
-	fprintf(stderr, "Department of Zoology, University of Oxford\n");
-	fprintf(stderr, "South Parks Road, Oxford OX1 3PS, U.K.\n\n");
+	fprintf(stderr, "(c) Copyright, 1996-2017 Andrew Rambaut and Nick Grassly\n");
+	fprintf(stderr, "Institute of Evolutionary Biology, University of Edinburgh\n\n");
+	fprintf(stderr, "Originally developed at:\n");
+	fprintf(stderr, "Department of Zoology, University of Oxford\n\n");
 }
 
 static void PrintUsage()
@@ -141,8 +142,9 @@ static void PrintUsage()
 
 void ReadParams(int argc, char **argv)
 {
-	int i, j;
+	int i, j, k;
 	char ch, *P, st[4];
+	int modelTwoArgs = 0;
 	
 	model=NONE;
 
@@ -206,18 +208,16 @@ void ReadParams(int argc, char **argv)
 					exit(0);
 				break;
 				case 'M':
+					k = i;
 					if (GetStrParam(argc, argv, &i, P, st, 3)) {
 						fprintf(stderr, "Bad (or missing) Model Code: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
-					
 					P=st;
-					while (*P) {
-						*P=toupper(*P);
-						P++;
+					if (i > k) {
+						modelTwoArgs = 1;
 					}
-					P=st;
-		
+								
 					model=-1;
 					for (j=F84; j<numModels; j++) {
 						if (strncmp(P, modelNames[j], 3)==0) {
@@ -238,7 +238,7 @@ void ReadParams(int argc, char **argv)
 					}
 					if (model==-1) {
 						fprintf(stderr, "Unknown Model: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 
 				break;
@@ -249,7 +249,7 @@ void ReadParams(int argc, char **argv)
 	if (model==NONE) {
 		fprintf(stderr, "No model has been specified (use the -m option)\n\n");
 		PrintUsage();
-		exit(0);
+		exit(1);
 	}
 
 	for (i=1; i<argc; i++) {
@@ -258,7 +258,7 @@ void ReadParams(int argc, char **argv)
 			if (treeFile) {
 				fprintf(stderr, "Illegal command parameter: %s\n\n", argv[i]);
 				PrintUsage();
-				exit(0);
+				exit(1);
 			}
 			treeFile=1;
 			strcpy(treeFileName, argv[i]);
@@ -280,73 +280,77 @@ void ReadParams(int argc, char **argv)
 				break;
 				case 'M':
 					// already delt with
+					if (modelTwoArgs) {
+						// the model took two arguments so skip the second one.
+						i++;
+					}
 				break;
 				case 'L':
 					if (GetIntParams(argc, argv, &i, P, 1, &numSites) || numSites<1) {
 						fprintf(stderr, "Bad (or missing) sequence length: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'N':
 					if (GetIntParams(argc, argv, &i, P, 1, &numDatasets) || numDatasets<1) {
 						fprintf(stderr, "Bad (or missing) number of datasets: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'P':
 					if (GetIntParams(argc, argv, &i, P, 1, &maxPartitions) || maxPartitions < 1) {
 						fprintf(stderr, "Bad number of partitions: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'C':
 					if (!isNucModel) {
 						fprintf(stderr, "You can only have codon rates when using nucleotide models\n\n");
-						exit(0);
+						exit(1);
 					}
 					if (rateHetero==GammaRates) {
 						fprintf(stderr, "You can only have codon rates or gamma rates not both\n\n");
-						exit(0);
+						exit(1);
 					}
 					numCats=3;
 					rateHetero=CodonRates;
 					if (GetDoubleParams(argc, argv, &i, P, 3, catRate) ||
 						catRate[0] <= 0.0 || catRate[1] <= 0.0 || catRate[2] <= 0.0 ) {
 						fprintf(stderr, "Bad Category Rates: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'I':
 					if (GetDoubleParams(argc, argv, &i, P, 1, &proportionInvariable) || 
 							proportionInvariable < 0.0 || proportionInvariable >= 1.0) {
 						fprintf(stderr, "Bad Proportion of Invariable Sites: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 					invariableSites = 1;
 				break;
 				case 'A':
 					if (rateHetero==CodonRates) {
 						fprintf(stderr, "You can only have codon rates or gamma rates not both\n\n");
-						exit(0);
+						exit(1);
 					}
 					
 					if (rateHetero==NoRates)
 						rateHetero=GammaRates;
 					if (GetDoubleParams(argc, argv, &i, P, 1, &gammaShape) || gammaShape<=0.0) {
 						fprintf(stderr, "Bad Gamma Shape: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'G':
 					if (rateHetero==CodonRates) {
 						fprintf(stderr, "You can only have codon rates or gamma rates not both\n\n");
-						exit(0);
+						exit(1);
 					}
 					
 					rateHetero=DiscreteGammaRates;
 					if (GetIntParams(argc, argv, &i, P, 1, &numCats) || numCats<2 || numCats>MAX_RATE_CATS) {
 						fprintf(stderr, "Bad number of Gamma Categories: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'F':
@@ -357,7 +361,7 @@ void ReadParams(int argc, char **argv)
 							equalFreqs = 0;
 							if (GetDoubleParams(argc, argv, &i, P, NUM_NUC, nucFreq)) {
 								fprintf(stderr, "Bad Nucleotide Frequencies: %s\n\n", argv[i]);
-								exit(0);
+								exit(1);
 							}
 						}
 					} else {
@@ -371,7 +375,7 @@ void ReadParams(int argc, char **argv)
 							equalFreqs = 0;
 							if (GetDoubleParams(argc, argv, &i, P, NUM_AA, aaFreq)) {
 								fprintf(stderr, "Bad Amino Acid Frequencies: %s\n\n", argv[i]);
-								exit(0);
+								exit(1);
 							}
 						}
 					}
@@ -379,19 +383,19 @@ void ReadParams(int argc, char **argv)
 				case 'T':
 					if (model != HKY && model != F84) {
 						fprintf(stderr, "You can only have a transition/transversion ratio when using HKY or F84 models\n\n");
-						exit(0);
+						exit(1);
 					}
 					equalTstv = 0;
 					if (GetDoubleParams(argc, argv, &i, P, 1, &tstv)) {
 						fprintf(stderr, "Bad Transition-Transversion Ratio: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'R':
 					if (model == GTR) {
 						if (GetDoubleParams(argc, argv, &i, P, NUM_NUC_REL_RATES, nucRelativeRates)) {
 							fprintf(stderr, "Bad General Nucleotide Rate Matrix: %s\n\n", argv[i]);
-							exit(0);
+							exit(1);
 						}
 						if (nucRelativeRates[NUM_NUC_REL_RATES - 1]!=1.0) {
 							for (j=0; j < NUM_NUC_REL_RATES - 1; j++) 
@@ -401,46 +405,46 @@ void ReadParams(int argc, char **argv)
 					} else if ( model == GENERAL) {
 						if (GetDoubleParams(argc, argv, &i, P, NUM_AA_REL_RATES, aaRelativeRate)) {
 							fprintf(stderr, "Bad General Amino Acid Rate Matrix: %s\n\n", argv[i]);
-							exit(0);
+							exit(1);
 						}
 					} else {
 						fprintf(stderr, "You can only have a general rate matrix when using GTR or GENERAL models\n\n");
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'D':
 					scaleTrees=1;
 					if (GetDoubleParams(argc, argv, &i, P, 1, &treeScale) || treeScale<=0.0) {
 						fprintf(stderr, "Bad Total Tree Scale: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 					if (scaleBranches) {
 						fprintf(stderr, "You can't specify both the -d and -s options\n\n");
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'S':
 					scaleBranches=1;
 					if (GetDoubleParams(argc, argv, &i, P, 1, &branchScale) || branchScale<=0.0) {
 						fprintf(stderr, "Bad Branch Length Scale: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 					if (scaleTrees) {
 						fprintf(stderr, "You can't specify both the -d and -s options\n\n");
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'K':
 					if (GetIntParams(argc, argv, &i, P, 1, &ancestorSeq) || ancestorSeq<1) {
 						fprintf(stderr, "Bad ancestral sequence number: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'Z':
 					userSeed = 1;
 					if (GetUnsignedLongParams(argc, argv, &i, P, 1, &randomSeed)) {
 						fprintf(stderr, "Bad random number generator seed: %s\n\n", argv[i]);
-						exit(0);
+						exit(1);
 					}
 				break;
 				case 'O':
@@ -452,7 +456,7 @@ void ReadParams(int argc, char **argv)
 						default:					
 							fprintf(stderr, "Unknown output format: %s\n\n", argv[i]);
 							PrintUsage();
-							exit(0);
+							exit(1);
 					}
 				break;
 				case 'W':
@@ -462,7 +466,7 @@ void ReadParams(int argc, char **argv)
 						default:					
 							fprintf(stderr, "Unknown write mode: %s\n\n", argv[i]);
 							PrintUsage();
-							exit(0);
+							exit(1);
 					}
 				break;
 				case 'Q':
@@ -471,7 +475,7 @@ void ReadParams(int argc, char **argv)
 				default:
 					fprintf(stderr, "Illegal command parameter: %s\n\n", argv[i]);
 					PrintUsage();
-					exit(0);
+					exit(1);
 				break;
 			}
 		}
@@ -496,6 +500,13 @@ void PrintVerbose(FILE *fv)
 
 	fputc('\n', fv);
 	
+	if (hasAlignment) {
+		fprintf(fv, "Alignment read: numSequences = %d, numAlignmentSites = %d\n", numSequences, numAlignmentSites);
+		if (ancestorSeq > 0) {
+			fprintf(fv, "Using sequence %d as the ancestral sequence\n", ancestorSeq);
+		}
+		fputc('\n', fv);
+	}
 	
 	if (scaleTrees) {
 		fprintf(fv, "Branch lengths of trees scaled so that tree is %G from root to tip\n\n", treeScale);
@@ -562,21 +573,24 @@ void ReadFileParams()
 	
 	hasAlignment=0;
 	
-	ch=fgetc(stdin);
-	while (!feof(stdin) && isspace(ch)) 
-		ch=fgetc(stdin);
+	ch=fgetc(tree_fv);
+	while (!feof(tree_fv) && isspace(ch)) {
+		ch=fgetc(tree_fv);
+	}
 		
-	ungetc(ch, stdin);
+	ungetc(ch, tree_fv);
 
 	if (ch!='(' && isdigit(ch)) {
-		fgets(st, 255, stdin);
+		fgets(st, 255, tree_fv);
 		if ( sscanf( st, " %d %d", &numSequences, &numAlignmentSites)!=2 ) {
 			fprintf(stderr, "Unable to read parameters from standard input\n");
-			exit(0);
+			exit(2);
 		}
+
 		hasAlignment=1;
-	}
 		
+//		fprintf(stderr, "%d sequences, %d sites\n", numSequences, numAlignmentSites);
+	}		
 }
 
 void AllocateMemory()
@@ -599,56 +613,64 @@ void ReadFile()
 		
 	n=0;
 	do {
-		ch=fgetc(stdin);
-		while ( !feof(stdin) && isspace(ch)) 
-			ch=fgetc(stdin);
+		ch=fgetc(tree_fv);
+		while ( !feof(tree_fv) && isspace(ch)) {
+			ch=fgetc(tree_fv);
+		}
 			
-		if ( feof(stdin) ) {
+		if ( feof(tree_fv) ) {
 			fprintf(stderr, "Unexpected end of file on standard input\n"); 
-			exit(0);
+			exit(2);
 		}
-	
+			
 		i=0;
-		while ( i<MAX_NAME_LEN && !feof(stdin) && !isspace(ch) ) {
+		while ( i<MAX_NAME_LEN && !feof(tree_fv) && !isspace(ch) ) {
 			names[n][i]=ch;
-			ch=fgetc(stdin);
+			ch=fgetc(tree_fv);
 			i++;
 		}
 		names[n][i]='\0';
 		if (i==0) {
 			fprintf(stderr, "Name missing for species %d\n", n+1);
-			exit(0);
+			exit(2);
+		}
+		while (!feof(tree_fv) && isspace(ch)) {
+			ch=fgetc(tree_fv);
 		}
-		while (!feof(stdin) && isspace(ch))
-			ch=fgetc(stdin);
 		
-		if ( feof(stdin) ) {
+		if ( feof(tree_fv) ) {
 			fprintf(stderr, "Unexpected end of file on standard input\n");
-			exit(0);
+			exit(2);
 		}
 		
 		b=0;
-		while ( !feof(stdin) && b<numAlignmentSites) {
+		while ( !feof(tree_fv) && b<numAlignmentSites) {
 			if ( !isspace(ch) ) {
 				sequences[n][b]=ch;
 				b++;
 			}
-			ch=toupper(fgetc(stdin));
+			ch=toupper(fgetc(tree_fv));
 		}
-		
+
 		if ( b<numAlignmentSites ) {
 			fprintf(stderr, "Unexpected end of file on standard input\n");
-			exit(0);
+			exit(2);
 		}
 		
-		/*fprintf(stderr, "%d: %s, bases read: %d\n", n+1, names[n], b);*/
+//		fprintf(stderr, "%d: %s, bases read: %d, %s\n", n+1, names[n], b, sequences[n]); 
+
 		n++;
 		
-		if ( n<numSequences && feof(stdin) ) {
+		if ( n<numSequences && feof(tree_fv) ) {
 			fprintf(stderr, "Too few sequences in input file\n");
-			exit(0);
+			exit(2);
 		}
 	} while ( n<numSequences );
+	
+	while (!feof(tree_fv) && isspace(ch)) {
+		ch=fgetc(tree_fv);
+	}
+	ungetc(ch, tree_fv);
 }
 
 int OpenTreeFile()
@@ -659,7 +681,7 @@ int OpenTreeFile()
 	if (treeFile) {
 		if ( (tree_fv=fopen(treeFileName, "rt"))==NULL ) {
 			fprintf(stderr, "Error opening tree file: '%s'\n", treeFileName);
-			exit(0);
+			exit(3);
 		}
 		n=CountTrees(tree_fv);
 	} else {
@@ -668,7 +690,7 @@ int OpenTreeFile()
 			fgets(st, 255, stdin);
 			if ( sscanf(st, " %d ", &n)!=1 ) {
 				fprintf(stderr, "Tree is missing from end of sequence file\n");
-				exit(0);
+				exit(3);
 			}
 		} else
 			n=CountTrees(stdin);
@@ -693,7 +715,7 @@ int main(int argc, char **argv)
 
 	if (rateHetero == CodonRates && invariableSites) {
 		fprintf(stderr, "Invariable sites model cannot be used with codon rate heterogeneity.\n");
-		exit(0);
+		exit(4);
 	}
 
 	if (writeAncestors && fileFormat == NEXUSFormat) {
@@ -702,7 +724,7 @@ int main(int argc, char **argv)
 
 	if (writeAncestors && maxPartitions > 1) {
 		fprintf(stderr, "Writing ancestral sequences can only be used for a single partition.\n");
-		exit(0);
+		exit(4);
 	}
 			
 	if (!userSeed)
@@ -713,19 +735,22 @@ int main(int argc, char **argv)
 	if (!quiet)
  		PrintTitle();
 	
-	if (!treeFile) {
+	numTrees = OpenTreeFile();
+
+	/* if (!treeFile) { */
 		ReadFileParams();
-	}
-	
+	/*} */
+
+
 	if ((ancestorSeq>0 && !hasAlignment) || ancestorSeq>numSequences) {
-		fprintf(stderr, "Bad ancestral sequence number\n");
-		exit(0);
+		fprintf(stderr, "Bad ancestral sequence number: %d (%d sequences loaded)\n", ancestorSeq, numSequences);
+		exit(4);
 	}
 	
 	if (textFile) {
 		if ( (text_fv=fopen(textFileName, "rt"))==NULL ) {
 			fprintf(stderr, "Error opening text file for insertion into output: '%s'\n", textFileName);
-			exit(0);
+			exit(4);
 		}
 	}
 
@@ -739,8 +764,8 @@ int main(int argc, char **argv)
 			
 		if (ancestorSeq>0) {
 			if (numSites!=numAlignmentSites) {
-				fprintf(stderr, "Ancestral sequence is of a different length to the simulated sequences\n");
-				exit(0);
+				fprintf(stderr, "Ancestral sequence is of a different length to the simulated sequences (%d)\n", numAlignmentSites);
+				exit(4);
 			}
 			ancestor=sequences[ancestorSeq-1];
 		}
@@ -755,30 +780,28 @@ int main(int argc, char **argv)
 	treeSet = (TTree **)malloc(sizeof(TTree **) * maxPartitions);
 	if (treeSet==NULL) {
 		fprintf(stderr, "Out of memory\n");
-		exit(0);
+		exit(5);
 	}
 	
 	partitionLengths = (int *)malloc(sizeof(int) * maxPartitions);
 	if (partitionLengths==NULL) {
 		fprintf(stderr, "Out of memory\n");
-		exit(0);
+		exit(5);
 	}
 	
 	partitionRates = (double *)malloc(sizeof(double) * maxPartitions);
 	if (partitionRates==NULL) {
 		fprintf(stderr, "Out of memory\n");
-		exit(0);
+		exit(5);
 	}
 	
 	for (i = 0; i < maxPartitions; i++) {
 		if ((treeSet[i]=NewTree())==NULL) {
 			fprintf(stderr, "Out of memory\n");
-			exit(0);
+			exit(5);
 		}
 	}
-			
-	numTrees = OpenTreeFile();
-		
+					
 	CreateRates();
 	
 	treeNo=0;
@@ -800,7 +823,7 @@ int main(int argc, char **argv)
 			}
 		} else if (treeSet[0]->numTips != numTaxa) {
 			fprintf(stderr, "All trees must have the same number of tips.\n");
-			exit(0);
+			exit(4);
 		}
 		
 		if (maxPartitions == 1) {
@@ -817,7 +840,7 @@ int main(int argc, char **argv)
 			if (!IsTreeAvail(tree_fv)) {
 				fprintf(stderr, "\nA set of trees number %d had less partition length (%d) than\n", treeNo + 1, sumLength);
 				fprintf(stderr, "was required to make a sequence of length %d.\n", numSites);
-				exit(0);
+				exit(4);
 			}
 				
 			ReadTree(tree_fv, treeSet[i], treeNo+1, treeSet[0]->numTips, treeSet[0]->names, 
@@ -825,7 +848,7 @@ int main(int argc, char **argv)
 						
 			if (treeSet[i]->numTips != numTaxa) {
 				fprintf(stderr, "All trees must have the same number of tips.\n");
-				exit(0);
+				exit(4);
 			}
 			
 			sumLength += partitionLengths[i];
@@ -840,7 +863,7 @@ int main(int argc, char **argv)
 		if (sumLength != numSites) {
 			fprintf(stderr, "The sum of the partition lengths in the treefile does not equal\n");
 			fprintf(stderr, "the specified number of sites.\n");
-			exit(0);
+			exit(4);
 		}
 			
 		for (i = 0; i < numPartitions; i++)
@@ -871,7 +894,7 @@ int main(int argc, char **argv)
 				if (scaleTrees) { 
 					if (!treeSet[j]->rooted) {
 						fprintf(stderr, "To scale tree length, they must be rooted and ultrametric.\n");
-						exit(0);
+						exit(4);
 					}
 					scale *= treeScale/treeSet[j]->totalLength;
 				} else if (scaleBranches)
diff --git a/source/tree.h b/source/tree.h
index e1c564e..ca16b78 100755
--- a/source/tree.h
+++ b/source/tree.h
@@ -1,8 +1,8 @@
 /*  Header file to define tree and node structures         */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/treefile.c b/source/treefile.c
index e42b597..fbd33fc 100755
--- a/source/treefile.c
+++ b/source/treefile.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
@@ -386,7 +386,7 @@ TNode *ReadNode(FILE *fv, TTree *tree, int numNames, char **names, int detectPol
 		fprintf(stderr, "This tree contains nodes which aren't bifurcations. Resolve the node\n");
 		fprintf(stderr, "with zero branch lengths to obtain correct results. This can be done\n");
 		fprintf(stderr, "with a program called TreeEdit: http://evolve.zoo.ox.ac.uk/software/TreeEdit\n");
-		exit(0);
+		exit(4);
 	}
 
 	if (feof(fv)) {
@@ -475,7 +475,7 @@ void ReadTree(FILE *fv, TTree *tree, int treeNum, int numNames, char **names,
 	if (ch == '[') {
 		if (fscanf(fv, "%d", outNumSites)!=1) {
 			sprintf(treeErrorMsg, "Unable to read partition length");
-			exit(0);
+			exit(4);
 		}
 
 		ch=fgetc(fv);
@@ -485,7 +485,7 @@ void ReadTree(FILE *fv, TTree *tree, int treeNum, int numNames, char **names,
 		if (ch == ',') {
 			if (fscanf(fv, "%lf", outRelRate)!=1) {
 				sprintf(treeErrorMsg, "Unable to read partition relative rate");
-				exit(0);
+				exit(4);
 			}
 
 			ch=fgetc(fv);
@@ -496,7 +496,7 @@ void ReadTree(FILE *fv, TTree *tree, int treeNum, int numNames, char **names,
 	
 	if (ch!='(' || (tree->root=ReadNode(fv, tree, numNames, names, 0))==NULL) {
 		fprintf(stderr, "Error reading tree number %d: %s.\n", treeNum, treeErrorMsg);
-		exit(0);
+		exit(4);
 	}
 	
 	ch=fgetc(fv);
@@ -507,7 +507,7 @@ void ReadTree(FILE *fv, TTree *tree, int treeNum, int numNames, char **names,
 		tree->rooted=0;
 		if ((tree->root->branch0=ReadBranch(fv, tree, numNames, names))==NULL) {
 			fprintf(stderr, "Error reading tree number %d: %s.\n", treeNum, treeErrorMsg);
-			exit(0);
+			exit(4);
 		}
 		tree->root->branch0->branch0=tree->root;
 		tree->root->length0=tree->root->branch0->length0;
diff --git a/source/treefile.h b/source/treefile.h
index 1e02fa4..81ca52f 100755
--- a/source/treefile.h
+++ b/source/treefile.h
@@ -1,8 +1,8 @@
 /*  Header file for treefile.c                             */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 
diff --git a/source/twister.c b/source/twister.c
index 07e90ca..38dbbd6 100755
--- a/source/twister.c
+++ b/source/twister.c
@@ -1,6 +1,6 @@
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
 	
    The code in this file is covered by the license and copyright message
diff --git a/source/twister.h b/source/twister.h
index 1e544b4..446db90 100755
--- a/source/twister.h
+++ b/source/twister.h
@@ -1,8 +1,8 @@
 /*  Header file for twister.c                             */
 
 /*  
-   Sequence Generator - seq-gen, version 1.3.3
-   Copyright (c)1996-2011, Andrew Rambaut & Nick Grassly
+   Sequence Generator - seq-gen, version 1.3.4
+   Copyright (c)1996-2017, Andrew Rambaut & Nick Grassly
    Institute of Evolutionary Biology, University of Edinburgh			
    All rights reserved.                          
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/seq-gen.git



More information about the debian-med-commit mailing list