[med-svn] r1177 - in trunk/packages/treevolve/trunk: . debian

charles-guest at alioth.debian.org charles-guest at alioth.debian.org
Sat Jan 19 04:03:53 UTC 2008


Author: charles-guest
Date: 2008-01-19 04:03:43 +0000 (Sat, 19 Jan 2008)
New Revision: 1177

Added:
   trunk/packages/treevolve/trunk/Makefile
   trunk/packages/treevolve/trunk/debian/
   trunk/packages/treevolve/trunk/debian/changelog
   trunk/packages/treevolve/trunk/debian/control
   trunk/packages/treevolve/trunk/debian/packages
   trunk/packages/treevolve/trunk/debian/rules
Modified:
   trunk/packages/treevolve/trunk/coseq.c
   trunk/packages/treevolve/trunk/exp.sub.c
   trunk/packages/treevolve/trunk/mathfuncs.c
   trunk/packages/treevolve/trunk/models.c
   trunk/packages/treevolve/trunk/treevolve.c
Log:
[svn-inject] Applying Debian modifications to trunk

Added: trunk/packages/treevolve/trunk/Makefile
===================================================================
--- trunk/packages/treevolve/trunk/Makefile	                        (rev 0)
+++ trunk/packages/treevolve/trunk/Makefile	2008-01-19 04:03:43 UTC (rev 1177)
@@ -0,0 +1,14 @@
+#
+#make file for treevolve
+#
+
+CFLAGS += -Wall
+
+treevolve: const.o const.sub.o coseq.o exp.o exp.sub.o mathfuncs.o models.o nodestack.o treevolve.o
+
+treevolve: LDLIBS += -lm
+
+%.o: %.c const.h const.sub.h coseq.h exp.h exp.sub.h mathfuncs.h models.h nodestack.h treevolve.h 
+
+clean:
+	$(RM) -v *.o treevolve Coal.Times

Modified: trunk/packages/treevolve/trunk/coseq.c
===================================================================
--- trunk/packages/treevolve/trunk/coseq.c	2008-01-19 04:03:00 UTC (rev 1176)
+++ trunk/packages/treevolve/trunk/coseq.c	2008-01-19 04:03:43 UTC (rev 1177)
@@ -35,6 +35,9 @@
 /* protoypes */
 void SeqEvolve();
 void Mutate(Node *node);
+void PrintTree(Node *node);
+void PrintInfoNode(Node *node);
+void FreeTree(Node *node);
 char SetBase(double *P);
 void RandomSequence(char *seq);
 void MutateSequence(char *seq, double len);
@@ -44,18 +47,28 @@
 {
 	tipNo=0;
 	RandomSequence(first->sequence);
+	WriteSequence(0, first->sequence);
 	SetCategories();
 	fprintf(stdout, " %d %d\n", sampleSize, numBases);
 	Mutate(first);
-	Stack(first);
+
+	tipNo=0;
+	fprintf(stdout," Tree: ");
+	PrintTree(first);
+	fprintf(stdout,"\n");
+
+	tipNo=0;
+	fprintf(stdout,"\n");
+	PrintInfoNode(first);
+	fprintf(stdout,"\n");
+
+	FreeTree(first);
 }
 
 void Mutate(Node *node)
 {
-int i, expNo, posn;
-float xm;
-char *point, *p1, *p2, *child;
-double rnd;
+int i;
+char *p1, *p2, *child;
 
 	if(node->type==1){						/*i.e. recombination event */
 		if(node->daughters[1]->type==1)		/* first encounter */
@@ -84,9 +97,6 @@
 			}else
 				Mutate(node->daughters[0]);
 		
-			Stack(node->daughters[1]);		/* stack up memory */
-			if(node->daughters[0]->type!=3)
-				Stack(node->daughters[0]);
 		}
 	}else{									/* a coalescent event */
 		memcpy(node->daughters[0]->sequence, node->sequence, (numBases+1));
@@ -96,8 +106,6 @@
 			WriteSequence(tipNo, node->daughters[0]->sequence);
 		}else
 			Mutate(node->daughters[0]);
-		if(node->daughters[0]->type!=3)
-			Stack(node->daughters[0]);		/* stack up memory */
 		
 		memcpy(node->daughters[1]->sequence, node->sequence, (numBases+1));
 		MutateSequence(node->daughters[1]->sequence, (mutRate*((double) node->time - (double) node->daughters[1]->time)));
@@ -106,13 +114,106 @@
 			WriteSequence(tipNo, node->daughters[1]->sequence);
 		}else
 			Mutate(node->daughters[1]);
-			
-		if(node->daughters[1]->type!=3)
-			Stack(node->daughters[1]);		/* stack up memory */
 	}
 	
 }
 
+void FreeTree(Node *node)
+{
+	switch (node->type) {
+	case 0: /* a coalescent event */
+		FreeTree(node->daughters[0]);
+		FreeTree(node->daughters[1]);
+		break;
+	case 1: /* second time of a recombination event */
+		FreeTree(node->daughters[0]);
+		break;
+	case 2: /* Final node */
+	case 3: /* first time of a recombination event */
+		break;
+	}
+	Stack(node);		/* stack up memory */
+}
+
+void PrintTree(Node *node)
+{
+
+	switch (node->type) {
+	case 3: /* first time of a recombination event */
+		break;
+	case 1: /* second time of a recombination event */
+		PrintTree(node->daughters[0]);
+		break;
+	case 2: /* Final node */
+		tipNo++;
+		fprintf(stdout, "%d", tipNo);
+		break;
+	case 0: /* a coalescent event */
+		fprintf(stdout, "(");
+		PrintTree(node->daughters[0]);
+		fprintf(stdout, ",");
+		PrintTree(node->daughters[1]);
+		fprintf(stdout, ")");
+		break;
+	}	
+}
+
+void PrintSeq(short *anc, char *seq)
+{
+	int j;
+	fprintf(stdout, "Seq: ");
+	for (j=0; j<numBases; j++) {
+		if (*anc) {
+			fputc(nucleotides[(int)(*seq)], stdout);
+		} else {
+			fputc(nucleotides[(int)(*seq)]-('A'-'a'), stdout);
+		}
+		seq++;
+		anc++;
+	}
+}
+
+void PrintInfoNode(Node *node)
+{
+	fprintf(stdout, "Node 0x%8p ", node);
+
+	switch (node->type) {
+	case 3: /* first time of a recombination event */
+		fprintf(stdout, "Recomb1 with 0x%8p ", node->daughters[1]);
+		fprintf(stdout, "To 0x%8p ", node->daughters[0]);
+		break;
+	case 1: /* second time of a recombination event */
+		fprintf(stdout, "Recomb2 with 0x%8p ", node->daughters[1]);
+		fprintf(stdout, "To 0x%8p ", node->daughters[0]);
+		break;
+	case 2: /* Final node */
+		tipNo++;
+		fprintf(stdout, "Final%-4d ", tipNo);
+		break;
+	case 0: /* a coalescent event */
+		fprintf(stdout, "Coalesc "); 
+		fprintf(stdout, "To 0x%8p ", node->daughters[0]);
+		fprintf(stdout, "And 0x%8p ", node->daughters[1]);
+		break;
+	}	
+	PrintSeq(node->ancestral, node->sequence);
+	fputc('\n', stdout);
+
+	
+	switch (node->type) {
+	case 0: /* a coalescent event */
+		PrintInfoNode(node->daughters[0]);
+		PrintInfoNode(node->daughters[1]);
+		break;
+	case 1: /* second time of a recombination event */
+		PrintInfoNode(node->daughters[0]);
+		break;
+	case 2: /* Final node */
+	case 3: /* first time of a recombination event */
+		break;
+	}
+}
+
 void RateHetMem()
 {
 	if (rateHetero==GammaRates){
@@ -131,7 +232,7 @@
 
 void SetCategories()
 {
-	int cat, i, j;
+	int i;
 	double sumRates;
 	
 	if (rateHetero==CodonRates) {
@@ -148,7 +249,7 @@
 	} else if (rateHetero==DiscreteGammaRates) {
 		DiscreteGamma(freqRate, catRate, gammaShape, gammaShape, numCats, 0);
 		for (i=0; i<numBases; i++)
-			categories[i]=(int)(rndu()*numCats);
+			categories[i]=random()%numCats;
 	}
 }
 
@@ -234,11 +335,10 @@
 int j;
 	fprintf(stdout, "sample%-4d ", sampleNo);
 	for (j=0; j<numBases; j++) {
-		fputc(nucleotides[*P], stdout);
+		fputc(nucleotides[(int)(*P)], stdout);
 		P++;
 	}
 	fputc('\n', stdout);
 
 }
 
-


Property changes on: trunk/packages/treevolve/trunk/debian
___________________________________________________________________
Name: mergeWithUpstream
   + 1

Added: trunk/packages/treevolve/trunk/debian/changelog
===================================================================
--- trunk/packages/treevolve/trunk/debian/changelog	                        (rev 0)
+++ trunk/packages/treevolve/trunk/debian/changelog	2008-01-19 04:03:43 UTC (rev 1177)
@@ -0,0 +1,12 @@
+treevolve (1.3.2-2) unstable; urgency=low
+
+  * dump to current debian standard 
+
+ -- Vincent Danjean <Vincent.Danjean at ens-lyon.org>  Fri, 21 Jan 2005 16:44:14 +0100
+
+treevolve (1.3.2-1) unstable; urgency=low
+
+  * Initial Debian version.
+
+ -- Vincent Danjean <Vincent.Danjean at ens-lyon.org>  Mon, 26 Jan 2004 13:05:59 +0100
+

Added: trunk/packages/treevolve/trunk/debian/control
===================================================================
--- trunk/packages/treevolve/trunk/debian/control	                        (rev 0)
+++ trunk/packages/treevolve/trunk/debian/control	2008-01-19 04:03:43 UTC (rev 1177)
@@ -0,0 +1,24 @@
+Source: treevolve
+Maintainer: Vincent Danjean <Vincent.Danjean at ens-lyon.org>
+Section: utils
+Priority: extra
+Standards-Version: 3.6.1
+Build-Depends: yada (>= 0.54)
+
+Package: treevolve
+Architecture: any
+Depends: ${treevolve:Depends}
+Description: simulation of evolution of DNA sequences
+ treevolve will simulate the evolution of DNA sequences under a
+ coalescent model, which allows exponential population growth,
+ population subdivision according to an island model, migration and
+ recombination. In addition different periods of population dynamics
+ can be enforced at different times. For example, a period of
+ exponential growth can be followed by a period of stasis where the
+ population is subdivided into demes. Multiple sets of such simulated
+ sequence data can then be compared to sequence data sampled from a
+ population of interest using suitable statistics, and various
+ evolutionary hypotheses concerning the evolution of this population
+ tested.
+ .
+ Modifications made from original software for personal research.

Added: trunk/packages/treevolve/trunk/debian/packages
===================================================================
--- trunk/packages/treevolve/trunk/debian/packages	                        (rev 0)
+++ trunk/packages/treevolve/trunk/debian/packages	2008-01-19 04:03:43 UTC (rev 1177)
@@ -0,0 +1,57 @@
+## debian/packages for treevolve
+## Customised for treevolve by Mr. Nobody
+
+## This is an -example- packages file; read /usr/share/doc/yada/yada.txt.gz to
+## find out how to customise it to your needs.
+
+Source: treevolve
+Section: utils
+Priority: extra
+Maintainer: Vincent Danjean <Vincent.Danjean at ens-lyon.org>
+Upstream-Authors:  Nicholas C. Grassly and Andrew Rambaut <n.grassly at ic.ac.uk>
+Standards-Version: 3.6.1
+Upstream-Source: <URL:http://evolve.zoo.ox.ac.uk/software/Treevolve/treevolve132.tar.Z>
+Home-Page: <URL:http://evolve.zoo.ox.ac.uk/software/Treevolve/main.html>
+#Origin: debian
+Copyright: GPL
+ Copyright 2002 A. Snide Badger
+Major-Changes:
+ Adapted and improved to other researches
+Build: sh
+ bk -r co || true
+ CC=${CC:-gcc}
+ CFLAGS=${CFLAGS:--Wall -g}
+ CXXFLAGS=${CXXFLAGS:--Wall -g}
+ LDFLAGS=${LDFLAGS:-}
+ if [ "${DEB_BUILD_OPTIONS#*noopt}" != "$DEB_BUILD_OPTIONS" ]; then
+     CFLAGS="$CFLAGS -O0"
+     CXXFLAGS="$CXXFLAGS -O0"
+ else
+     CFLAGS="$CFLAGS -O2"
+     CXXFLAGS="$CXXFLAGS -O2"
+ fi
+ make
+Clean: sh
+ bk -r co || true
+ make distclean || make clean || true
+
+Package: treevolve
+Architecture: any
+Depends: []
+Description: simulation of evolution of DNA sequences
+ treevolve will simulate the evolution of DNA sequences under a
+ coalescent model, which allows exponential population growth,
+ population subdivision according to an island model, migration and
+ recombination. In addition different periods of population dynamics
+ can be enforced at different times. For example, a period of
+ exponential growth can be followed by a period of stasis where the
+ population is subdivided into demes. Multiple sets of such simulated
+ sequence data can then be compared to sequence data sampled from a
+ population of interest using suitable statistics, and various
+ evolutionary hypotheses concerning the evolution of this population
+ tested.
+ .
+ Modifications made from original software for personal research.
+Install: sh
+ yada install -bin treevolve
+ yada install -doc treevolve1.3.manual.txt

Added: trunk/packages/treevolve/trunk/debian/rules
===================================================================
--- trunk/packages/treevolve/trunk/debian/rules	                        (rev 0)
+++ trunk/packages/treevolve/trunk/debian/rules	2008-01-19 04:03:43 UTC (rev 1177)
@@ -0,0 +1,251 @@
+#!/usr/bin/make -f
+# Generated automatically from debian/packages
+# by yada v0.54, of Sun, 28 Oct 2007
+
+DEB_HOST_ARCH        := $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null)
+DEB_HOST_ARCH_OS     := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
+DEB_HOST_ARCH_CPU    := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null)
+DEB_HOST_GNU_CPU     := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU 2>/dev/null)
+DEB_HOST_GNU_TYPE    := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE 2>/dev/null)
+DEB_HOST_GNU_SYSTEM  := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM 2>/dev/null)
+
+DEB_BUILD_ARCH       := $(shell dpkg-architecture -qDEB_BUILD_ARCH 2>/dev/null)
+DEB_BUILD_ARCH_OS    := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS 2>/dev/null)
+DEB_BUILD_ARCH_CPU   := $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU 2>/dev/null)
+DEB_BUILD_GNU_CPU    := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU 2>/dev/null)
+DEB_BUILD_GNU_TYPE   := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE 2>/dev/null)
+DEB_BUILD_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM 2>/dev/null)
+
+# Take account of old dpkg-architecture output.
+ifeq ($(DEB_HOST_ARCH_CPU),)
+  DEB_HOST_ARCH_CPU := $(DEB_HOST_GNU_CPU))
+  ifeq ($(DEB_HOST_ARCH_CPU),i486)
+    DEB_HOST_ARCH_OS := i386
+  else
+  ifeq ($(DEB_HOST_ARCH_CPU),x86_64)
+    DEB_HOST_ARCH_OS := amd64
+  endif
+  endif
+endif
+ifeq ($(DEB_HOST_ARCH_OS),)
+  DEB_HOST_ARCH_OS := $(subst -gnu,,$(DEB_HOST_GNU_SYSTEM))
+  ifeq ($(DEB_HOST_ARCH_OS),gnu)
+    DEB_HOST_ARCH_OS := hurd
+  endif
+endif
+ifeq ($(DEB_BUILD_ARCH_CPU),)
+  DEB_BUILD_ARCH_CPU := $(DEB_BUILD_GNU_CPU))
+  ifeq ($(DEB_BUILD_ARCH_CPU),i486)
+    DEB_BUILD_ARCH_OS := i386
+  else
+  ifeq ($(DEB_BUILD_ARCH_CPU),x86_64)
+    DEB_BUILD_ARCH_OS := amd64
+  endif
+  endif
+endif
+ifeq ($(DEB_BUILD_ARCH_OS),)
+  DEB_BUILD_ARCH_OS := $(subst -gnu,,$(DEB_BUILD_GNU_SYSTEM))
+  ifeq ($(DEB_BUILD_ARCH_OS),gnu)
+    DEB_BUILD_ARCH_OS := hurd
+  endif
+endif
+
+LEFT_PARENTHESIS:=(
+VERSION:=$(shell head -n1 debian/changelog | sed -e "s/^[0-9a-zA-Z.-]* $(LEFT_PARENTHESIS)//" -e "s/[^0-9a-zA-Z.:+~-].*//")
+
+SHELL=/bin/bash
+
+.PHONY: default
+default:
+	@echo "Specify a target:"; \
+	echo " build              compile the package"; \
+	echo " build-arch         compile the architecture-dependent package"; \
+	echo " build-indep        compile the architecture-independent package"; \
+	echo " binary             make all binary packages"; \
+	echo " binary-arch        make all architecture-dependent binary packages"; \
+	echo " binary-indep       make all architecture-independent binary packages"; \
+	echo " clean              clean up the source package"; \
+	echo; \
+	echo " clean-install-tree clean up only under debian/"; \
+	echo
+
+# Build the package and prepare the install tree
+
+.PHONY: build-only build
+build-only: debian/build-stamp
+build: build-only
+
+.PHONY: build-arch-only build-arch
+build-arch-only: debian/build-arch-stamp
+build-arch: build-arch-only
+
+.PHONY: build-indep-only build-indep
+build-indep-only: debian/build-indep-stamp
+build-indep: build-indep-only
+
+# Make sure these rules and the control file are up-to-date
+
+.PHONY: rules control templates
+rules: debian/rules
+debian/rules: $(shell which yada) debian/packages-tmp
+	yada rebuild rules
+
+control: debian/control
+debian/control: $(shell which yada) debian/packages-tmp
+	yada rebuild control
+
+templates: debian/templates debian/po/POTFILES.in
+debian/templates: $(shell which yada) debian/packages-tmp
+	yada rebuild templates
+debian/po/POTFILES.in: $(shell which yada) debian/packages-tmp
+	yada rebuild templates
+
+debian/build-stamp: debian/build-arch-stamp debian/build-indep-stamp
+	@[ -f $(shell which yada) -a -f debian/rules ]
+	@umask 022 \
+	  && export pwd="$$(pwd)" \
+	  && export TMPROOT="$$(pwd)/debian/tmp" \
+	  && export SOURCE="treevolve" \
+	  && export VERSION="$(VERSION)" \
+	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
+	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
+	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
+	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
+	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
+	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
+	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
+	echo -E 'bk -r co || true';\
+	echo -E 'CC=$${CC:-gcc}';\
+	echo -E 'CFLAGS=$${CFLAGS:--Wall -g}';\
+	echo -E 'CXXFLAGS=$${CXXFLAGS:--Wall -g}';\
+	echo -E 'LDFLAGS=$${LDFLAGS:-}';\
+	echo -E 'if [ "$${DEB_BUILD_OPTIONS#*noopt}" != "$$DEB_BUILD_OPTIONS" ]; then';\
+	echo -E '    CFLAGS="$$CFLAGS -O0"';\
+	echo -E '    CXXFLAGS="$$CXXFLAGS -O0"';\
+	echo -E 'else';\
+	echo -E '    CFLAGS="$$CFLAGS -O2"';\
+	echo -E '    CXXFLAGS="$$CXXFLAGS -O2"';\
+	echo -E 'fi';\
+	echo -E 'make') | /bin/sh
+	touch debian/build-stamp
+
+debian/build-arch-stamp:
+	@[ -f $(shell which yada) -a -f debian/rules ]
+	touch debian/build-arch-stamp
+
+debian/build-indep-stamp: debian/build-arch-stamp
+	@[ -f $(shell which yada) -a -f debian/rules ]
+	touch debian/build-indep-stamp
+
+.PHONY: install-tree
+install-tree: install-tree-any
+install-tree-any: \
+	debian/tmp-treevolve/DEBIAN/control
+
+debian/tmp-treevolve/DEBIAN/control: debian/build-stamp debian/control
+	rm -rf debian/tmp-treevolve
+	umask 022 && install -d debian/tmp-treevolve/DEBIAN
+	install -d debian/tmp-treevolve/usr/share/doc/treevolve
+	umask 022; yada generate copyright treevolve \
+	  > debian/tmp-treevolve/usr/share/doc/treevolve/copyright
+	install -m 644 -p debian/changelog \
+	  debian/tmp-treevolve/usr/share/doc/treevolve/changelog.Debian
+	@umask 022 \
+	  && export pwd="$$(pwd)" \
+	  && export ROOT="$$(pwd)/debian/tmp-treevolve" \
+	  && export TMPROOT="$$(pwd)/debian/tmp" \
+	  && export CONTROL="$$(pwd)/debian/tmp-treevolve/DEBIAN" \
+	  && export PACKAGE="treevolve" \
+	  && export SOURCE="treevolve" \
+	  && export VERSION="$(VERSION)" \
+	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
+	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
+	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
+	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
+	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
+	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
+	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
+	echo -E 'yada install -bin treevolve';\
+	echo -E 'yada install -doc treevolve1.3.manual.txt') | /bin/sh
+	@umask 022 \
+	  && export pwd="$$(pwd)" \
+	  && export ROOT="$$(pwd)/debian/tmp-treevolve" \
+	  && export TMPROOT="$$(pwd)/debian/tmp" \
+	  && export CONTROL="$$(pwd)/debian/tmp-treevolve/DEBIAN" \
+	  && export PACKAGE="treevolve" \
+	  && export SOURCE="treevolve" \
+	  && export VERSION="$(VERSION)" && (\
+	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
+	echo -E 'yada perl';\
+	echo -E 'yada python';\
+	echo -E 'yada strip';\
+	echo -E 'yada shlibdeps') | /bin/sh
+	yada compress treevolve
+	yada generate maintscripts treevolve
+	find debian/tmp-treevolve -type f -print \
+	  | sed -n 's/^debian\/tmp-treevolve\(\/etc\/.*\)$$/\1/p' \
+	  > debian/tmp-treevolve/DEBIAN/conffiles
+	test -s debian/tmp-treevolve/DEBIAN/conffiles || rm -f debian/tmp-treevolve/DEBIAN/conffiles
+	yada rebuild control
+	yada generate substvars treevolve
+	umask 022 && dpkg-gencontrol -isp -ptreevolve -Pdebian/tmp-treevolve
+
+# Build package files
+
+.PHONY: binary binary-arch binary-indep
+binary: binary-arch binary-indep
+binary-arch: binary-arch-any
+
+.PHONY: binary-arch-any
+binary-arch-any: \
+	binary-package-treevolve
+binary-indep:
+
+.PHONY: binary-package-treevolve
+binary-package-treevolve: check-root debian/tmp-treevolve/DEBIAN/control
+	@[ -f $(shell which yada) -a -f debian/rules ]
+	chown -R 0.0 debian/tmp-treevolve
+	chmod -R u=rwX,go=rX debian/tmp-treevolve
+	@if [ -d debian/tmp-treevolve/usr/doc/treevolve ]; then \
+	  echo "*** Yada warning: /usr/doc/treevolve should be /usr/share/doc/treevolve";\
+	fi
+	dpkg-deb --build debian/tmp-treevolve ..
+
+.PHONY: check-root
+check-root:
+	@[ `id -u` = 0 ] || (echo "You must be root to do this!"; false)
+
+debian/packages-tmp: debian/packages 
+	yada rebuild packages
+
+## Clean up afterwards
+
+.PHONY: clean clean-install-tree clean-build
+
+clean: clean-install-tree clean-build debian/control debian/rules
+	rm -f debian/packages-tmp debian/packages-tmp-new debian/packages-tmp-include
+
+clean-build:
+	@[ -f $(shell which yada) -a -f debian/rules ]
+	rm -f debian/build-stamp debian/build-arch-stamp debian/build-indep-stamp
+	@umask 022 \
+	  && export pwd="$$(pwd)" \
+	  && export TMPROOT="$$(pwd)/debian/tmp" \
+	  && export SOURCE="treevolve" \
+	  && export VERSION="$(VERSION)" \
+	  && export DEB_HOST_GNU_CPU="$(DEB_HOST_GNU_CPU)" \
+	  && export DEB_HOST_GNU_TYPE="$(DEB_HOST_GNU_TYPE)" \
+	  && export DEB_HOST_GNU_SYSTEM="$(DEB_HOST_GNU_SYSTEM)" \
+	  && export DEB_BUILD_GNU_CPU="$(DEB_BUILD_GNU_CPU)" \
+	  && export DEB_BUILD_GNU_TYPE="$(DEB_BUILD_GNU_TYPE)" \
+	  && export DEB_BUILD_GNU_SYSTEM="$(DEB_BUILD_GNU_SYSTEM)" && (\
+	echo -E 'eval "yada () { perl $$(which yada) \"\$$@\"; }"; set -e; set -v';\
+	echo -E 'bk -r co || true';\
+	echo -E 'make distclean || make clean || true') | /bin/sh
+	yada unpatch
+	rm -rf debian/tmp
+
+clean-install-tree: debian/rules
+	@[ -f $(shell which yada) -a -f debian/rules ]
+	rm -f debian/install-tree-stamp
+	rm -rf debian/tmp-* debian/files* debian/substvars debian/shlibs.local debian/ucf


Property changes on: trunk/packages/treevolve/trunk/debian/rules
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/packages/treevolve/trunk/exp.sub.c
===================================================================
--- trunk/packages/treevolve/trunk/exp.sub.c	2008-01-19 04:03:00 UTC (rev 1176)
+++ trunk/packages/treevolve/trunk/exp.sub.c	2008-01-19 04:03:43 UTC (rev 1177)
@@ -26,7 +26,6 @@
 int EpiSubRoutine(Regime *pp)
 {
 double t, tiMe, rnd, Ntemp;
-int i;
 
 	DistributeGenes(pp);
 	lambda=pp->e;

Modified: trunk/packages/treevolve/trunk/mathfuncs.c
===================================================================
--- trunk/packages/treevolve/trunk/mathfuncs.c	2008-01-19 04:03:00 UTC (rev 1176)
+++ trunk/packages/treevolve/trunk/mathfuncs.c	2008-01-19 04:03:43 UTC (rev 1177)
@@ -12,6 +12,7 @@
 
 #include <stdio.h>
 #include <math.h>
+#include <stdlib.h>
 #include "mathfuncs.h"
 #include "exp.h"
 #include "exp.sub.h"
@@ -23,6 +24,7 @@
 
 void SetSeed (int seed)
 {
+   srandom(seed);
    z_rndu = 170*(seed%178) + 137;
    w_rndu=seed;
 }
@@ -40,17 +42,8 @@
 
 double rndu (void)
 {
-   static int x_rndu=11, y_rndu=23;
-   double r;
 
-   x_rndu = 171*(x_rndu%177) -  2*(x_rndu/177);
-   y_rndu = 172*(y_rndu%176) - 35*(y_rndu/176);
-   z_rndu = 170*(z_rndu%178) - 63*(z_rndu/178);
-   if (x_rndu<0) x_rndu+=30269;
-   if (y_rndu<0) y_rndu+=30307;
-   if (z_rndu<0) z_rndu+=30323;
-   r = x_rndu/30269.0 + y_rndu/30307.0 + z_rndu/30323.0;
-   return (r-(int)r);
+  return (double) random()/(double)RAND_MAX;
 }
 
 #endif
@@ -394,11 +387,12 @@
 	  new_step = p/q;					/* it is accepted	*/
     }
 
-    if( fabs(new_step) < TOLERANCE )	/* Adjust the step to be not less*/
+    if( fabs(new_step) < TOLERANCE ) {	/* Adjust the step to be not less*/
       if( new_step > (double)0 )	/* than tolerance		*/
 	new_step = TOLERANCE;
       else
 	new_step = -TOLERANCE;
+    }
 
     a = b;  fa = fb;			/* Save the previous approx.	*/ 
     b += new_step;  fb = (*f)(b);	/* Do step to a new approxim.	*/

Modified: trunk/packages/treevolve/trunk/models.c
===================================================================
--- trunk/packages/treevolve/trunk/models.c	2008-01-19 04:03:00 UTC (rev 1176)
+++ trunk/packages/treevolve/trunk/models.c	2008-01-19 04:03:43 UTC (rev 1177)
@@ -33,7 +33,7 @@
 void SetModel(int theModel)
 {	
 	int i,j,k;
-	double xi, xv, F84temp1, F84temp2, alpha, sumFreq;
+	double xi, xv, F84temp1, F84temp2, sumFreq;
 	double freqAG, freqCT, freqA2, freqC2, freqG2, freqT2;
 	
 	model=theModel;
@@ -325,7 +325,7 @@
 #define csize(a) (fabs(a.re)+fabs(a.im))
 
 complex compl (double re,double im);
-complex conj (complex a);
+complex conj_orig (complex a);
 complex cplus (complex a, complex b);
 complex cminus (complex a, complex b);
 complex cby (complex a, complex b);
@@ -487,7 +487,7 @@
     return(r);
 }
 
-complex conj (complex a)
+complex conj_orig (complex a)
 {
     a.im = -a.im;
     return(a);

Modified: trunk/packages/treevolve/trunk/treevolve.c
===================================================================
--- trunk/packages/treevolve/trunk/treevolve.c	2008-01-19 04:03:00 UTC (rev 1176)
+++ trunk/packages/treevolve/trunk/treevolve.c	2008-01-19 04:03:43 UTC (rev 1177)
@@ -12,6 +12,11 @@
 /*      nicholas.grassly at zoo.ox.ac.uk    */
 /*      http://evolve.zoo.ox.ac.uk/      */
 /*---------------------------------------*/
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
@@ -64,7 +69,7 @@
 void ReadUntil(FILE *fv, char stopChar, char *what);
 
 /*-----------------------------------------*/
-main(int argc, char **argv)
+int main(int argc, char **argv)
 {
 int i, j, result, currPeriod;
 FILE *coTimes;
@@ -79,7 +84,20 @@
 		exit(0);
 	}
 
-	SetSeed(time(NULL));
+	{
+		int fd=open("/dev/urandom", O_RDONLY);
+		int seed;
+		
+		if (fd==-1) {
+			perror("Unable to open /dev/urandom");
+			exit(1);
+		}
+		if (read(fd, &seed, sizeof(seed)) <= 0) {
+			perror("Unable to read /dev/urandom");
+			exit(1);
+		}
+		SetSeed(seed);
+	}
 	avail=NULL;
 	PrintTitle();
 	ReadParams(argc, argv);
@@ -131,6 +149,7 @@
 	if(outputCoTimes)
 		fclose(coTimes);
 	fprintf(stderr, "it's all over! -\n	sequences written to stdout\n");
+	return 0;
 }
 
 int ImplementRegime(Regime* pp)
@@ -166,7 +185,6 @@
 {
 	int  j;
 	char ch, str[255], *str2;
-	char *P;
 	
 	numBases=500;
 	sampleSize=20;
@@ -541,7 +559,7 @@
 		if(history[i].t>0.0)
 			fprintf(stderr, "Length: %f\n",  history[i].t);
 		else
-			fprintf(stderr, "Period running until final coalescence\n",  history[i].t);
+			fprintf(stderr, "Period running until final coalescence (%f)\n",  history[i].t);
 		fprintf(stderr, "Time at start: %f\n", t);
 		if(history[i].d>1){
 			fprintf(stderr, "Population subdivided into %d demes\n", history[i].d);
@@ -612,13 +630,11 @@
 void Recombine(double t, int deme)
 {
 int i, picked, sum1, sum2;
-double rnd;
 Node *rec, *anc1, *anc2;
 
 	do{
 		do{
-			rnd=rndu();
-			picked=(int) ( rnd*(ki[deme]) );
+		  picked=random() % (ki[deme]);
 		}while(picked==ki[deme]);
 		
 		rec=first;
@@ -633,8 +649,7 @@
 		}
 		
 		do{
-			rnd=rndu();
-			picked=(int) (rnd*numBases);
+		  picked=random() % numBases;
 		}while(picked==numBases || picked==0);/*cuts sequence at one of 
 												m-1 possible points*/
 		sum1=sum2=0;
@@ -676,17 +691,14 @@
 void Coalesce(double t, int deme)
 {
 int i, picked1, picked2;
-double rnd;
 Node *dec1, *dec2;
 short *p, *q, *r;
 
 	do{						/*choose CA candidates from correct deme*/
-		rnd=rndu();
-		picked1=(int) ( rnd*(ki[deme]) );
+	  picked1=random() % (ki[deme]);
 	}while(picked1==ki[deme]);
 	do{
-		rnd=rndu();
-		picked2=(int) ( rnd*(ki[deme]) );
+	  picked2=random() % (ki[deme]);
 	}while(picked2==ki[deme] || picked2==picked1);
 	
 	dec1=dec2=first;
@@ -716,6 +728,7 @@
 	first->time=t;
 	first->deme=deme;
 	
+	/* virer dec1 et dec2 de la liste des structures Node */
 	dec1->previous->next=dec1->next;/* loop maintenance */
 	dec1->next->previous=dec1->previous;
 	dec2->previous->next=dec2->next;
@@ -734,17 +747,14 @@
 /*------------------------------*/
 void Migration(int deme, int numDemes)
 {
-double rnd;
 int i, migrant, recipDeme;
 Node *P;
 
 	do{				/* pick migrant */
-		rnd=rndu();
-		migrant=((int) (rnd*(ki[deme])) );
+	  migrant=random() % (ki[deme]);
 	}while(migrant==ki[deme]);
 	do{				/* pick recipient deme */
-		rnd=rndu();
-		recipDeme=( (int) (rnd*numDemes) );
+	  recipDeme=random() % numDemes;
 	}while(recipDeme==deme);
 	
 	P=first;




More information about the debian-med-commit mailing list