mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-23 09:10:43 +00:00
biology/haplohseq: Fix example scripts for python 3
Also clean up plist
This commit is contained in:
parent
5884877ee6
commit
92b5f80904
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=562414
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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 \
|
@ -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)):
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user