pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

haplohseq: Identify regions of allelic imbalance



Module Name:	pkgsrc-wip
Committed By:	Jason W Bacon <bacon%NetBSD.org@localhost>
Pushed By:	outpaddling
Date:		Sat Jan 23 13:24:12 2021 -0600
Changeset:	12bbf93b90442ccf109df0d5430d5f8a244ace6d

Modified Files:
	Makefile
Added Files:
	haplohseq/DESCR
	haplohseq/Makefile
	haplohseq/PLIST
	haplohseq/distinfo
	haplohseq/files/haplohseq-example.in
	haplohseq/files/run-tests
	haplohseq/patches/patch-makefile
	haplohseq/patches/patch-scripts_ldmap.py
	haplohseq/patches/patch-scripts_simple__phaser.py
	haplohseq/patches/patch-src_FreqPhase.cpp
	haplohseq/patches/patch-src_HaplohSeq.cpp
	haplohseq/patches/patch-src_test_InputProcessorTest.cpp

Log Message:
haplohseq: Identify regions of allelic imbalance

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=12bbf93b90442ccf109df0d5430d5f8a244ace6d

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |   1 +
 haplohseq/DESCR                                    |   4 +
 haplohseq/Makefile                                 |  55 +++++++++++
 haplohseq/PLIST                                    |   9 ++
 haplohseq/distinfo                                 |  12 +++
 haplohseq/files/haplohseq-example.in               |  37 +++++++
 haplohseq/files/run-tests                          |  10 ++
 haplohseq/patches/patch-makefile                   | 109 +++++++++++++++++++++
 haplohseq/patches/patch-scripts_ldmap.py           |  46 +++++++++
 haplohseq/patches/patch-scripts_simple__phaser.py  |  35 +++++++
 haplohseq/patches/patch-src_FreqPhase.cpp          |  33 +++++++
 haplohseq/patches/patch-src_HaplohSeq.cpp          |  24 +++++
 .../patches/patch-src_test_InputProcessorTest.cpp  |  15 +++
 13 files changed, 390 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 0441a1bcf7..fccad3553a 100644
--- a/Makefile
+++ b/Makefile
@@ -1426,6 +1426,7 @@ SUBDIR+=	hal
 SUBDIR+=	halfempty
 SUBDIR+=	hammer
 SUBDIR+=	hanazono-ttf
+SUBDIR+=	haplohseq
 SUBDIR+=	harmony
 SUBDIR+=	hasciicam
 SUBDIR+=	haserl
diff --git a/haplohseq/DESCR b/haplohseq/DESCR
new file mode 100644
index 0000000000..57173a7ea3
--- /dev/null
+++ b/haplohseq/DESCR
@@ -0,0 +1,4 @@
+Haplohseq identifies regions of allelic imbalance (AI) in sequencing data
+obtained from impure samples where AI events exist in a potentially low
+proportion of cells in the sample.  Input to the software includes a VCF file
+of genotypes and estimated phased genotypes.
diff --git a/haplohseq/Makefile b/haplohseq/Makefile
new file mode 100644
index 0000000000..3aa3685fc2
--- /dev/null
+++ b/haplohseq/Makefile
@@ -0,0 +1,55 @@
+# $NetBSD$
+#
+###########################################################
+#                  Generated by fbsd2pkg                  #
+#              Sat Jan 23 09:24:36 CST 2021               #
+###########################################################
+
+# Unknown tool: USE_TOOLS=	compiler:c++11-lang
+# Unknown tool: USE_TOOLS=	localbase:ldflags
+
+DISTNAME=	haplohseq-0.1.2
+CATEGORIES=	biology
+MASTER_SITES=	${MASTER_SITE_GITHUB:=outpaddling/}
+GITHUB_PROJECT=	haplohseq
+
+MAINTAINER=	bacon%NetBSD.org@localhost
+HOMEPAGE=	https://sites.google.com/site/integrativecancergenomics/software/haplohseq
+COMMENT=	Identify regions of allelic imbalance
+LICENSE=	mit
+
+# math/R is blocked by glib2 build error on CentOS
+# DEPENDS=	R-cran-optparse>0:../../wip/R-optparse
+
+REPLACE_SH=	example/example_run.sh
+
+SUBST_CLASSES+=		test
+SUBST_STAGE.test=	pre-configure
+SUBST_SED.test=		-e 's|\.\./haplohseq|haplohseq|'
+SUBST_SED.test+=	-e 's|python|mkdir example_output; ${PYTHONBIN}|'
+SUBST_FILES.test=	example/example_run.sh
+
+USE_LANGUAGES=	c c++
+USE_TOOLS+=	gmake pax
+MAKE_FILE=	makefile
+# Check this
+# MAKE_ENV+=	STRIP=${STRIP}
+
+EXAMPLESDIR=	${PREFIX}/share/examples/haplohseq
+
+INSTALLATION_DIRS=	share/examples/haplohseq
+
+post-patch:
+	${SED} -e "s|%%EXAMPLESDIR%%|${EXAMPLESDIR}|" \
+		${FILESDIR}/haplohseq-example.in > ${WRKDIR}/haplohseq-example
+
+post-install:
+	${INSTALL_SCRIPT} ${WRKDIR}/haplohseq-example ${DESTDIR}${PREFIX}/bin
+	(cd ${WRKSRC} && ${RM} scripts/*.orig && pax -rw example ldmap scripts ${DESTDIR}${EXAMPLESDIR})
+
+do-test:
+	(cd ${WRKSRC}/build/test && ${SH} ${FILESDIR}/run-tests)
+
+.include "../../devel/boost-libs/buildlink3.mk"
+.include "../../lang/python/application.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/haplohseq/PLIST b/haplohseq/PLIST
new file mode 100644
index 0000000000..fca48e502f
--- /dev/null
+++ b/haplohseq/PLIST
@@ -0,0 +1,9 @@
+@comment $NetBSD$
+bin/haplohseq
+bin/haplohseq-example
+share/examples/haplohseq/example/example_input/tumor_exome.vcf
+share/examples/haplohseq/example/example_run.sh
+share/examples/haplohseq/ldmap/hg19.exome.ldmap
+share/examples/haplohseq/scripts/haplohseq_plot.R
+share/examples/haplohseq/scripts/ldmap.py
+share/examples/haplohseq/scripts/simple_phaser.py
diff --git a/haplohseq/distinfo b/haplohseq/distinfo
new file mode 100644
index 0000000000..2ba38bf958
--- /dev/null
+++ b/haplohseq/distinfo
@@ -0,0 +1,12 @@
+$NetBSD$
+
+SHA1 (haplohseq-0.1.2.tar.gz) = 58ef6a985c48c66bb3e824cfa903d7f63da128c2
+RMD160 (haplohseq-0.1.2.tar.gz) = 8287c3323d2bb6bee2146ce56d20ab5fb31cca80
+SHA512 (haplohseq-0.1.2.tar.gz) = 922f04203b148e52daf672b2f9d780a68a1709c9d907e76bd37841d22cbe4b4175cce7004fb38547dbc4724061db2a11755e292f0dec0b67a71f748fdb009eba
+Size (haplohseq-0.1.2.tar.gz) = 12084603 bytes
+SHA1 (patch-makefile) = 3fbba14e82d35488b7f5c1838a9b6891b6f1e2f5
+SHA1 (patch-scripts_ldmap.py) = bc66e0b1b5e40c59068ffd3b33267a97d7b3a50c
+SHA1 (patch-scripts_simple__phaser.py) = 33f2c6a6b70d236404725179629129f81607cbd7
+SHA1 (patch-src_FreqPhase.cpp) = 5b906e53f2e6968525bd4b1c420d518260388381
+SHA1 (patch-src_HaplohSeq.cpp) = cac07999985c5d45e9afc37b9afcddb217e0d701
+SHA1 (patch-src_test_InputProcessorTest.cpp) = 1a1086b082b542266a1e3509f0e833dcdb1038cb
diff --git a/haplohseq/files/haplohseq-example.in b/haplohseq/files/haplohseq-example.in
new file mode 100644
index 0000000000..0cb2a5bee1
--- /dev/null
+++ b/haplohseq/files/haplohseq-example.in
@@ -0,0 +1,37 @@
+#!/bin/sh -e
+
+##########################################################################
+#   Script description:
+#       Run haplohseq example
+#
+#   https://sites.google.com/site/integrativecancergenomics/software/haplohseq
+#       
+#   History:
+#   Date        Name        Modification
+#   2019-11-13  Jason Bacon Begin
+##########################################################################
+
+usage()
+{
+    printf "Usage: $0 directory\n"
+    exit 1
+}
+
+
+##########################################################################
+#   Main
+##########################################################################
+
+if [ $# != 1 ]; then
+    usage
+fi
+
+dir="$1"
+
+if [ -e "$dir" ]; then
+    printf "'$dir' already exists.  Please remove it or specify another.\n"
+    exit 1
+fi
+cp -R %%EXAMPLESDIR%% "$dir"
+cd "$dir/example"
+sh ./example_run.sh
diff --git a/haplohseq/files/run-tests b/haplohseq/files/run-tests
new file mode 100644
index 0000000000..1ecc6ebc5e
--- /dev/null
+++ b/haplohseq/files/run-tests
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+printf "\n=== FreqPhaseTest ===\n\n"
+./FreqPhaseTest
+printf "\n=== InputProcessorTest ===\n\n"
+./InputProcessorTest
+printf "\n=== HmmTest ===\n\n"
+./HmmTest
+printf "\n=== HaplohSeqTest ===\n\n"
+./HaplohSeqTest
diff --git a/haplohseq/patches/patch-makefile b/haplohseq/patches/patch-makefile
new file mode 100644
index 0000000000..d7d1bdfc19
--- /dev/null
+++ b/haplohseq/patches/patch-makefile
@@ -0,0 +1,109 @@
+$NetBSD$
+
+# Respect env, add destdir support
+
+--- makefile.orig	2019-08-29 18:03:23 UTC
++++ makefile
+@@ -7,23 +7,32 @@
+ #
+ 
+ # Constants
+-CXX=g++
++# Default to g++ if not set by make args or environment
++CXX?=g++
+ #-O0 -g will turn on debugging
+ #The rule of thumb:
+ #When you need to debug, use -O0 (and -g to generate debugging symbols.)
+ #When you are preparing to ship it, use -O2.
+ #When you use gentoo, use -O3...!
+ #When you need to put it on an embedded system, use -Os (optimize for size, not for efficiency.)
+-CXX_FLAGS=-Wall -g -stdlib=libstdc++
++# Use canonincal compiler variables, which may be provided by build env
++CXXFLAGS?=-Wall -g -stdlib=libstdc++
+ SRC=src
+ CONF=conf
+ HMM_SRC=$(SRC)/hmm
+ UTIL_SRC=$(SRC)/util
+-BOOST=/usr/local/boost_1_52_0
++BOOST?=/usr/local/boost_1_52_0
+ INCLUDES=-I./$(SRC) -I./$(HMM_SRC) -I./$(UTIL_SRC) -isystem$(BOOST)
+-LIBRARY_PATHS=-Llib/macosx 
++LIBRARY_PATHS?=-Llib/macosx
+ LIBRARIES=-lm -lboost_program_options -lboost_system -lboost_filesystem -lboost_thread
+ 
++# Installation target with destdir support
++DESTDIR?=.
++PREFIX?=/usr/local
++MKDIR?=mkdir
++INSTALL?=install
++STRIP?= # empty, set to -s to install stripped binary
++
+ # Generated directories which are generated in this script and cleaned up with 'make clean'
+ BUILD=build
+ OBJ=$(BUILD)/obj
+@@ -35,18 +44,21 @@ directories:
+ 
+ # Create object files into the OBJ directory from cpp files in the SRC directory.
+ $(OBJ)/%.o:	$(SRC)/%.cpp directories
+-	$(CXX) $(CXX_FLAGS) $(INCLUDES) -c -o $@ $<
++	$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
+ $(OBJ)/%.o:	$(HMM_SRC)/%.cpp directories
+-	$(CXX) $(CXX_FLAGS) $(INCLUDES) -c -o $@ $<
++	$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
+ $(OBJ)/%.o:	$(UTIL_SRC)/%.cpp directories
+-	$(CXX) $(CXX_FLAGS) $(INCLUDES) -c -o $@ $<
++	$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<
+ 
+-all: clean haplohseq
++all: haplohseq test
+ 
+ haplohseq: $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(OBJ)/Reporter.o $(OBJ)/FreqPhase.o $(OBJ)/VcfUtil.o $(OBJ)/HaplohSeq.o
+-	$(CXX) -o $(BIN)/$@ $(CXX_FLAGS) $(INCLUDES) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(OBJ)/Reporter.o $(OBJ)/FreqPhase.o $(OBJ)/VcfUtil.o $(OBJ)/HaplohSeq.o $(LIBRARY_PATHS) $(LIBRARIES) 
+-	cp -r $(CONF) $(BIN)/.
+-	
++	$(CXX) -o $(BIN)/$@ $(CXXFLAGS) $(INCLUDES) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(OBJ)/Reporter.o $(OBJ)/FreqPhase.o $(OBJ)/VcfUtil.o $(OBJ)/HaplohSeq.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
++
++install:
++	$(MKDIR) -p $(DESTDIR)$(PREFIX)/bin
++	$(INSTALL) -c $(STRIP) $(BIN)/* $(DESTDIR)$(PREFIX)/bin
++
+ clean:
+ 	rm -rf $(BUILD)
+ 
+@@ -74,28 +86,28 @@ test: FreqPhaseTest HaplohSeqTest HmmTest InputProcess
+ 
+ # Create test object files into the OBJ directory from cpp files in the SRC directory.
+ $(TEST_BIN)/%.o:	$(TEST_SRC)/%.cpp directories test_directory
+-	$(CXX) $(CXX_FLAGS) $(INCLUDES) $(TEST_INCLUDES) -c -o $@ $<
++	$(CXX) $(CXXFLAGS) $(INCLUDES) $(TEST_INCLUDES) -c -o $@ $<
+ 
+ HaplohSeqTest:	$(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(TEST_BIN)/HaplohSeqTest.o
+-	$(CXX) -o $(TEST_BIN)/$@ $(CXX_FLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(TEST_BIN)/HaplohSeqTest.o $(LIBRARY_PATHS) $(LIBRARIES) 
++	$(CXX) -o $(TEST_BIN)/$@ $(CXXFLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(TEST_BIN)/HaplohSeqTest.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
+ 
+ FreqPhaseTest:	$(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(OBJ)/FreqPhase.o $(TEST_BIN)/FreqPhaseTest.o
+-	$(CXX) -o $(TEST_BIN)/$@ $(CXX_FLAGS) $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(OBJ)/FreqPhase.o $(TEST_BIN)/FreqPhaseTest.o $(LIBRARY_PATHS) $(LIBRARIES) 
++	$(CXX) -o $(TEST_BIN)/$@ $(CXXFLAGS) $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(OBJ)/FreqPhase.o $(TEST_BIN)/FreqPhaseTest.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
+ 
+ HmmTest:	$(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/HmmTest.o
+-	$(CXX) -o $(TEST_BIN)/$@ $(CXX_FLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/HmmTest.o $(LIBRARY_PATHS) $(LIBRARIES) 
++	$(CXX) -o $(TEST_BIN)/$@ $(CXXFLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/HmmTest.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
+ 
+ InputProcessorTest:	$(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(TEST_BIN)/InputProcessorTest.o
+-	$(CXX) -o $(TEST_BIN)/$@ $(CXX_FLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(TEST_BIN)/InputProcessorTest.o $(LIBRARY_PATHS) $(LIBRARIES) 
++	$(CXX) -o $(TEST_BIN)/$@ $(CXXFLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/InputProcessor.o $(TEST_BIN)/InputProcessorTest.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
+ 	
+ MathUtilTest:	$(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/MathUtilTest.o
+-	$(CXX) -o $(TEST_BIN)/$@ $(CXX_FLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/MathUtilTest.o $(LIBRARY_PATHS) $(LIBRARIES) 
++	$(CXX) -o $(TEST_BIN)/$@ $(CXXFLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/MathUtilTest.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
+ 	
+ ReporterTest:	$(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/ReporterTest.o
+-	$(CXX) -o $(TEST_BIN)/$@ $(CXX_FLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/ReporterTest.o $(LIBRARY_PATHS) $(LIBRARIES) 
++	$(CXX) -o $(TEST_BIN)/$@ $(CXXFLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(TEST_BIN)/ReporterTest.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
+ 
+ ThreadPoolTest:	$(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/ThreadPool.o $(TEST_BIN)/ThreadPoolTest.o
+-	$(CXX) -o $(TEST_BIN)/$@ $(CXX_FLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/ThreadPool.o $(TEST_BIN)/ThreadPoolTest.o $(LIBRARY_PATHS) $(LIBRARIES)
++	$(CXX) -o $(TEST_BIN)/$@ $(CXXFLAGS) $(OBJ)/Hmm.o $(OBJ)/DataStructures.o $(OBJ)/MathUtil.o $(OBJ)/StringUtil.o $(OBJ)/ThreadPool.o $(TEST_BIN)/ThreadPoolTest.o $(LIBRARY_PATHS) $(LIBRARIES) $(LDFLAGS)
+ ############################## END TEST LOGIC ##############################
+ 
+ 
diff --git a/haplohseq/patches/patch-scripts_ldmap.py b/haplohseq/patches/patch-scripts_ldmap.py
new file mode 100644
index 0000000000..e868ab6704
--- /dev/null
+++ b/haplohseq/patches/patch-scripts_ldmap.py
@@ -0,0 +1,46 @@
+$NetBSD$
+
+# Python 3
+
+--- scripts/ldmap.py.orig	2021-01-23 17:32:15 UTC
++++ scripts/ldmap.py
+@@ -29,10 +29,10 @@ class MapMaker:
+     coordinates of the haplotype marker genomic positions.
+     '''
+     def __init__(self, markerFilename, haplotypesFilename):
+-        print "reading haplotype base coordinates ...."
++        print("reading haplotype base coordinates ....")
+         self.coords, self.coordIndexes, self.refs, self.alts = self.readMarkers(markerFilename)
+ #         self.haplotypes = self.readHaplotypes(haplotypesFilename)
+-        print "reading haplotype panel ...."
++        print("reading haplotype panel ....")
+         self.markerCalls = self.readHaplotypes(haplotypesFilename, transpose = True)
+     
+     # reads from a vcf file of defined positions representing the haplotype data    
+@@ -118,7 +118,7 @@ class MapMaker:
+         # 1) COLLECT MARGINALS AND IDENTIFY SITES THAT ARE POLYMORPHIC
+         # If a site has only one allele in the haplotype panel it is not informative, so it won't be used
+         # in LD calculations.  We may want to consider setting some minimum threshold for a minor allele frequency.
+-        print "collecting marginal allele counts and identifying polymorphic sites from haplotype panel ...."
++        print("collecting marginal allele counts and identifying polymorphic sites from haplotype panel ....")
+         for index in range(0,len(self.markerCalls)):
+             ref = self.refs[index]
+             alt = self.alts[index]
+@@ -152,7 +152,7 @@ class MapMaker:
+         log.write("Num non-polymorphic sites: " + str(numNonpolymorphicSites) + "\n")
+                
+         # 2) CALCULATE D FOR POLYMORPHIC SITES COMPARED WITH N SITES TO THE RIGHT THAT ARE POLYMORPHIC
+-        print "calculating D between polymorphic sites and their neighbors ...."
++        print("calculating D between polymorphic sites and their neighbors ....")
+         dVals = []
+         for i in range(0, len(polymorphicIndexes)):   # the last coordinate won't have any partners
+             index_i = polymorphicIndexes[i]
+@@ -244,7 +244,7 @@ class LDMap:
+         return ldMap
+         
+     def save(self, filename):
+-        print "saving ldmap to " + filename
++        print("saving ldmap to " + filename)
+         ldMapFile = open(filename, 'w')
+         ldMapFile.write("\t".join(["COORD","REF","ALT","PAIRED_ALLELES"]) + "\n")
+         for i in range(0,len(self.coords)):
diff --git a/haplohseq/patches/patch-scripts_simple__phaser.py b/haplohseq/patches/patch-scripts_simple__phaser.py
new file mode 100644
index 0000000000..1aa33ee892
--- /dev/null
+++ b/haplohseq/patches/patch-scripts_simple__phaser.py
@@ -0,0 +1,35 @@
+$NetBSD$
+
+# Python 3
+
+--- scripts/simple_phaser.py.orig	2021-01-23 17:25:56 UTC
++++ scripts/simple_phaser.py
+@@ -108,7 +108,7 @@ class SimplePhaser:
+         return informativeHets, informativeCoords, informativeIndexes
+     
+     def getRefPairedAllele(self, anchorIndex, pairedIndex):
+-#         print "\t".join([str(anchorIndex), str(pairedIndex - anchorIndex  - 1), str(len(self.ldMap.dVals)),str(len(self.ldMap.dVals[anchorIndex]))]) # prints intermarker counts
++#         print("\t".join([str(anchorIndex), str(pairedIndex - anchorIndex  - 1), str(len(self.ldMap.dVals)),str(len(self.ldMap.dVals[anchorIndex]))]) # prints intermarker counts)
+         if (pairedIndex - anchorIndex - 1) >= len(self.ldMap.dVals[anchorIndex]):
+             pRef = random.uniform(0,1)
+             if pRef > 0.5:
+@@ -166,8 +166,8 @@ class SimplePhaser:
+                 altHap = temp 
+             
+             if pairedAllele not in [ref,alt]:
+-                print "pairedAllele not ref or alt " + ref + " " + alt
+-                print pairedAllele               
++                print("pairedAllele not ref or alt " + ref + " " + alt)
++                print(pairedAllele)
+          
+         return phasedAlleles, informativeCoords
+             
+@@ -182,7 +182,7 @@ class SimplePhaser:
+             elif candidateHap[i].upper() == phasedHaps[1][i].upper():
+                 currentMatch = 1
+             else:
+-                print "ERROR: " + candidateHap[i] + " does not match " + phasedHaps[0][i] + " or " + phasedHaps[1][i] + "\t" + self.ldMap.coords[i] + "\t" + self.ldMap.refs[i] + "\t" + self.ldMap.alts[i]
++                print("ERROR: " + candidateHap[i] + " does not match " + phasedHaps[0][i] + " or " + phasedHaps[1][i] + "\t" + self.ldMap.coords[i] + "\t" + self.ldMap.refs[i] + "\t" + self.ldMap.alts[i])
+ #                 # randomly assign match
+ #                 p0 = random.uniform(0,1)
+ #                 if p0 > 0.5:
diff --git a/haplohseq/patches/patch-src_FreqPhase.cpp b/haplohseq/patches/patch-src_FreqPhase.cpp
new file mode 100644
index 0000000000..79345c1aed
--- /dev/null
+++ b/haplohseq/patches/patch-src_FreqPhase.cpp
@@ -0,0 +1,33 @@
+$NetBSD$
+
+# Portability
+
+--- src/FreqPhase.cpp.orig	2019-11-13 14:19:06 UTC
++++ src/FreqPhase.cpp
+@@ -5,6 +5,7 @@
+  * Email:  sanlucas%gmail.com@localhost
+  */
+ 
++#include <sysexits.h>
+ #include "FreqPhase.h"
+ 
+ namespace haplohseq {
+@@ -180,10 +181,17 @@ double FreqPhase::meanValue(const std::v
+ double FreqPhase::medianValue(const std::vector<double>& values) {
+ 	double median;
+ 	size_t size = values.size();
++
++	// We can probably detect this condition earlier while loading the VCF
++	if ( size == 0 ) {
++		std::cerr << "FreqPhase::medianValue(): values vector is empty." << std::endl;
++		std::cerr << "Make sure your VCF has all of GT:AD:DP in the FORMAT column." << std::endl;
++		exit(EX_DATAERR);
++	}
+ 	std::vector<double> tempFreqs(values);
+ 	sort(tempFreqs.begin(), tempFreqs.end());
+ 
+-	if (size  % 2 == 0) {
++	if (size % 2 == 0) {
+ 		median = (tempFreqs[size / 2 - 1] + tempFreqs[size / 2]) / 2;
+ 	}
+ 	else {
diff --git a/haplohseq/patches/patch-src_HaplohSeq.cpp b/haplohseq/patches/patch-src_HaplohSeq.cpp
new file mode 100644
index 0000000000..5548cc6617
--- /dev/null
+++ b/haplohseq/patches/patch-src_HaplohSeq.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+# Newer boost
+
+--- src/HaplohSeq.cpp.orig	2019-09-01 14:58:30 UTC
++++ src/HaplohSeq.cpp
+@@ -202,7 +202,7 @@ void HaplohSeq::runBafHaplohseq(	std::string& obsType,
+ 
+ 		// Spawn worker threads
+ 		for (std::size_t t = 0; t < numThreads; t++) {
+-			threadPool.create_thread(boost::bind((unsigned long int (boost::asio::io_service::*)())&boost::asio::io_service::run, &ioService));
++			threadPool.create_thread(boost::bind((boost::asio::io_context::count_type (boost::asio::io_service::*)())&boost::asio::io_service::run, &ioService));
+ 		}
+ 
+ 		std::map<std::string, boost::shared_ptr<Hmm> > chrHmms;
+@@ -420,7 +420,7 @@ void HaplohSeq::runVcfHaplohseq(	std::string& obsType,
+ 
+ 		// Spawn worker threads
+ 		for (std::size_t t = 0; t < numThreads; t++) {
+-			threadPool.create_thread(boost::bind((unsigned long int (boost::asio::io_service::*)())&boost::asio::io_service::run, &ioService));
++			threadPool.create_thread(boost::bind((boost::asio::io_context::count_type (boost::asio::io_service::*)())&boost::asio::io_service::run, &ioService));
+ 		}
+ 
+ 		std::map<std::string, boost::shared_ptr<Hmm> > chrHmms;
diff --git a/haplohseq/patches/patch-src_test_InputProcessorTest.cpp b/haplohseq/patches/patch-src_test_InputProcessorTest.cpp
new file mode 100644
index 0000000000..80e2483060
--- /dev/null
+++ b/haplohseq/patches/patch-src_test_InputProcessorTest.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+# Newer boost
+
+--- src/test/InputProcessorTest.cpp.orig	2019-09-01 12:33:22 UTC
++++ src/test/InputProcessorTest.cpp
+@@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(isHetTest) {
+ 	BOOST_REQUIRE_EQUAL(inputProc.isHet('A','?'), false);
+ 	BOOST_REQUIRE_EQUAL(inputProc.isHet('A','.'), false);
+ 	BOOST_REQUIRE_EQUAL(inputProc.isHet('A',' '), false);
+-	BOOST_REQUIRE_EQUAL(inputProc.isHet('C', NULL), true);
++	BOOST_REQUIRE_EQUAL(inputProc.isHet('C','\0'), true);
+ }
+ 
+ BOOST_AUTO_TEST_CASE(readAllelesTest) {


Home | Main Index | Thread Index | Old Index