aboutsummaryrefslogtreecommitdiffstats
path: root/biology/haplohseq
diff options
context:
space:
mode:
authorJason W. Bacon <jwb@FreeBSD.org>2021-01-24 03:31:49 +0800
committerJason W. Bacon <jwb@FreeBSD.org>2021-01-24 03:31:49 +0800
commit92b5f8090476a3e2b1ca55225d90e39579c4cd8a (patch)
tree31473926b503d1189e77b876f1d0d0f87da91330 /biology/haplohseq
parent5884877ee6cb06862c229412ac1e7df896ad48cd (diff)
downloadfreebsd-ports-gnome-92b5f8090476a3e2b1ca55225d90e39579c4cd8a.tar.gz
freebsd-ports-gnome-92b5f8090476a3e2b1ca55225d90e39579c4cd8a.tar.zst
freebsd-ports-gnome-92b5f8090476a3e2b1ca55225d90e39579c4cd8a.zip
biology/haplohseq: Fix example scripts for python 3
Also clean up plist
Diffstat (limited to 'biology/haplohseq')
-rw-r--r--biology/haplohseq/Makefile11
-rw-r--r--biology/haplohseq/distinfo2
-rw-r--r--biology/haplohseq/files/patch-example_example__run.sh24
-rw-r--r--biology/haplohseq/files/patch-scripts_ldmap.py48
-rw-r--r--biology/haplohseq/files/patch-scripts_simple__phaser.py37
-rw-r--r--biology/haplohseq/pkg-plist2
6 files changed, 81 insertions, 43 deletions
diff --git a/biology/haplohseq/Makefile b/biology/haplohseq/Makefile
index 6d1341651f9f..70e796ff0073 100644
--- a/biology/haplohseq/Makefile
+++ b/biology/haplohseq/Makefile
@@ -2,7 +2,7 @@
PORTNAME= haplohseq
DISTVERSION= 0.1.2
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= biology
MAINTAINER= jwb@FreeBSD.org
@@ -26,9 +26,16 @@ MAKE_ENV= STRIP=${STRIP}
SUB_FILES= haplohseq-example
+pre-configure:
+ @${REINPLACE_CMD} \
+ -e 's|/bin/bash|/bin/sh|' \
+ -e 's|python|mkdir example_output; ${PYTHON_CMD}|' \
+ -e 's|\.\./haplohseq|haplohseq|' \
+ ${WRKSRC}/example/example_run.sh
+
post-install-EXAMPLES-on:
${INSTALL_SCRIPT} ${WRKDIR}/haplohseq-example ${STAGEDIR}${PREFIX}/bin
- (cd ${WRKSRC} && ${COPYTREE_SHARE} "example ldmap scripts" ${STAGEDIR}${EXAMPLESDIR})
+ (cd ${WRKSRC} && ${RM} example/*.orig scripts/*.orig && ${COPYTREE_SHARE} "example ldmap scripts" ${STAGEDIR}${EXAMPLESDIR})
do-test:
@(cd ${WRKSRC}/build/test && ${FILESDIR}/run-tests)
diff --git a/biology/haplohseq/distinfo b/biology/haplohseq/distinfo
index a10bda0e1269..7af7556d5596 100644
--- a/biology/haplohseq/distinfo
+++ b/biology/haplohseq/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1589733633
+TIMESTAMP = 1611421648
SHA256 (outpaddling-haplohseq-0.1.2_GH0.tar.gz) = 64f61023a6795decb680c23d142b1a349988d4c0e3bef8c7d52ca33bf42f29f0
SIZE (outpaddling-haplohseq-0.1.2_GH0.tar.gz) = 12084603
diff --git a/biology/haplohseq/files/patch-example_example__run.sh b/biology/haplohseq/files/patch-example_example__run.sh
deleted file mode 100644
index 10a422bddd82..000000000000
--- a/biology/haplohseq/files/patch-example_example__run.sh
+++ /dev/null
@@ -1,24 +0,0 @@
---- example/example_run.sh.orig 2019-11-13 15:45:57 UTC
-+++ example/example_run.sh
-@@ -1,4 +1,4 @@
--#! /bin/bash
-+#!/bin/sh
-
- # Example:
- # Identify allelic imbalance (AI) given a tumor
-@@ -6,13 +6,13 @@
- # of the GATK. This involves the following 3 steps.
-
- printf "STEP 1: PHASING 1KG HET SITES ...\n"
--python ../scripts/simple_phaser.py \
-+python2.7 ../scripts/simple_phaser.py \
- --ldmap ../ldmap/hg19.exome.ldmap \
- --vcf example_input/tumor_exome.vcf \
- -o example_output/tumor_exome
-
- printf "\nSTEP 2: IDENTIFYING REGIONS OF AI ...\n"
--../haplohseq \
-+haplohseq \
- --vcf example_output/tumor_exome.hap.vcf \
- --phased example_output/tumor_exome.hap \
- --event_prevalence 0.1 \
diff --git a/biology/haplohseq/files/patch-scripts_ldmap.py b/biology/haplohseq/files/patch-scripts_ldmap.py
index d16f74cf9949..f9fb588048b1 100644
--- a/biology/haplohseq/files/patch-scripts_ldmap.py
+++ b/biology/haplohseq/files/patch-scripts_ldmap.py
@@ -1,8 +1,42 @@
---- scripts/ldmap.py.orig 2019-11-13 15:51:02 UTC
+--- scripts/ldmap.py.orig 2021-01-23 17:32:15 UTC
+++ scripts/ldmap.py
-@@ -1,3 +1,5 @@
-+#!/usr/bin/env python2.7
-+
- import argparse
- import sys
- import random
+@@ -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/biology/haplohseq/files/patch-scripts_simple__phaser.py b/biology/haplohseq/files/patch-scripts_simple__phaser.py
index d81d288e67ea..c6c5941ee00d 100644
--- a/biology/haplohseq/files/patch-scripts_simple__phaser.py
+++ b/biology/haplohseq/files/patch-scripts_simple__phaser.py
@@ -1,8 +1,31 @@
---- scripts/simple_phaser.py.orig 2019-11-13 15:52:02 UTC
+--- scripts/simple_phaser.py.orig 2021-01-23 17:25:56 UTC
+++ scripts/simple_phaser.py
-@@ -1,3 +1,5 @@
-+#!/usr/bin/env python2.7
-+
- import argparse
- import random
- import sys
+@@ -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/biology/haplohseq/pkg-plist b/biology/haplohseq/pkg-plist
index ec14c5a726b7..1b05c89b84a3 100644
--- a/biology/haplohseq/pkg-plist
+++ b/biology/haplohseq/pkg-plist
@@ -5,6 +5,4 @@ bin/haplohseq
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ldmap/hg19.exome.ldmap
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/scripts/haplohseq_plot.R
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/scripts/ldmap.py
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/scripts/ldmap.py.orig
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/scripts/simple_phaser.py
-%%PORTEXAMPLES%%%%EXAMPLESDIR%%/scripts/simple_phaser.py.orig