Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jan 2021 19:31:50 +0000 (UTC)
From:      "Jason W. Bacon" <jwb@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r562414 - in head/biology/haplohseq: . files
Message-ID:  <202101231931.10NJVoZT053123@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jwb
Date: Sat Jan 23 19:31:49 2021
New Revision: 562414
URL: https://svnweb.freebsd.org/changeset/ports/562414

Log:
  biology/haplohseq: Fix example scripts for python 3
  
  Also clean up plist

Deleted:
  head/biology/haplohseq/files/patch-example_example__run.sh
Modified:
  head/biology/haplohseq/Makefile
  head/biology/haplohseq/distinfo
  head/biology/haplohseq/files/patch-scripts_ldmap.py
  head/biology/haplohseq/files/patch-scripts_simple__phaser.py
  head/biology/haplohseq/pkg-plist

Modified: head/biology/haplohseq/Makefile
==============================================================================
--- head/biology/haplohseq/Makefile	Sat Jan 23 19:30:35 2021	(r562413)
+++ head/biology/haplohseq/Makefile	Sat Jan 23 19:31:49 2021	(r562414)
@@ -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)

Modified: head/biology/haplohseq/distinfo
==============================================================================
--- head/biology/haplohseq/distinfo	Sat Jan 23 19:30:35 2021	(r562413)
+++ head/biology/haplohseq/distinfo	Sat Jan 23 19:31:49 2021	(r562414)
@@ -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

Modified: head/biology/haplohseq/files/patch-scripts_ldmap.py
==============================================================================
--- head/biology/haplohseq/files/patch-scripts_ldmap.py	Sat Jan 23 19:30:35 2021	(r562413)
+++ head/biology/haplohseq/files/patch-scripts_ldmap.py	Sat Jan 23 19:31:49 2021	(r562414)
@@ -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)):

Modified: head/biology/haplohseq/files/patch-scripts_simple__phaser.py
==============================================================================
--- head/biology/haplohseq/files/patch-scripts_simple__phaser.py	Sat Jan 23 19:30:35 2021	(r562413)
+++ head/biology/haplohseq/files/patch-scripts_simple__phaser.py	Sat Jan 23 19:31:49 2021	(r562414)
@@ -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:

Modified: head/biology/haplohseq/pkg-plist
==============================================================================
--- head/biology/haplohseq/pkg-plist	Sat Jan 23 19:30:35 2021	(r562413)
+++ head/biology/haplohseq/pkg-plist	Sat Jan 23 19:31:49 2021	(r562414)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101231931.10NJVoZT053123>