From c8eb3c6e6c18ae5ead1ab28377312c76db623e4f Mon Sep 17 00:00:00 2001 From: "Jason W. Bacon" Date: Sun, 17 Nov 2019 15:00:13 +0000 Subject: [PATCH] biology/haplohseq: Switch to distfile with example data Add script to run on example input Minor fix to report inadequate VCF input --- biology/haplohseq/Makefile | 17 ++++++--- biology/haplohseq/distinfo | 6 +-- biology/haplohseq/files/haplohseq-example.in | 37 +++++++++++++++++++ .../files/patch-example_example__run.sh | 24 ++++++++++++ .../haplohseq/files/patch-scripts_ldmap.py | 8 ++++ .../files/patch-scripts_simple__phaser.py | 8 ++++ .../haplohseq/files/patch-src_FreqPhase.cpp | 29 +++++++++++++++ biology/haplohseq/pkg-plist | 11 ++++++ 8 files changed, 131 insertions(+), 9 deletions(-) create mode 100644 biology/haplohseq/files/haplohseq-example.in create mode 100644 biology/haplohseq/files/patch-example_example__run.sh create mode 100644 biology/haplohseq/files/patch-scripts_ldmap.py create mode 100644 biology/haplohseq/files/patch-scripts_simple__phaser.py create mode 100644 biology/haplohseq/files/patch-src_FreqPhase.cpp create mode 100644 biology/haplohseq/pkg-plist diff --git a/biology/haplohseq/Makefile b/biology/haplohseq/Makefile index 910cac75d6cb..1ba124283d34 100644 --- a/biology/haplohseq/Makefile +++ b/biology/haplohseq/Makefile @@ -2,10 +2,9 @@ PORTNAME= haplohseq DISTVERSION= 0.1.2 +PORTREVISION= 1 CATEGORIES= biology -MASTER_SITES= https://mirror1.hpc.uwm.edu/Distfiles/ \ - https://mirror2.hpc.uwm.edu/Distfiles/ -DISTNAME= haplohseq_source-${DISTVERSION} +MASTER_SITES= https://acadix.biz/Ports/distfiles/ MAINTAINER= jwb@FreeBSD.org COMMENT= Identify regions of allelic imbalance @@ -13,15 +12,21 @@ COMMENT= Identify regions of allelic imbalance LICENSE= MIT LIB_DEPENDS= libboost_system.so:devel/boost-libs +RUN_DEPENDS= R-cran-optparse>0:devel/R-cran-optparse -USES= compiler:c++11-lang gmake localbase:ldflags zip +USES= compiler:c++11-lang gmake localbase:ldflags python:2.7 tar:xz + +OPTIONS_DEFINE= EXAMPLES MAKEFILE= makefile -WRKSRC= ${WRKDIR}/haplohseq_source LDFLAGS+= -lpthread MAKE_ENV= STRIP=${STRIP} -PLIST_FILES= bin/haplohseq +SUB_FILES= haplohseq-example + +post-install-EXAMPLES-on: + ${INSTALL_SCRIPT} ${WRKDIR}/haplohseq-example ${STAGEDIR}${PREFIX}/bin + (cd ${WRKSRC} && ${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 b5acbd168de0..7aec7fe84192 100644 --- a/biology/haplohseq/distinfo +++ b/biology/haplohseq/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1567118170 -SHA256 (haplohseq_source-0.1.2.zip) = 35f8fe6718020e6eacdc309d28fc5dd3cc7c6e8400da1d962fdf6fb52d4e90c5 -SIZE (haplohseq_source-0.1.2.zip) = 63620 +TIMESTAMP = 1573660978 +SHA256 (haplohseq-0.1.2.tar.xz) = 0e7474f6af6b41c4b38f5f4549344714ec022e2adfc4aa9d00e0d420483e260a +SIZE (haplohseq-0.1.2.tar.xz) = 8108896 diff --git a/biology/haplohseq/files/haplohseq-example.in b/biology/haplohseq/files/haplohseq-example.in new file mode 100644 index 000000000000..0cb2a5bee1d7 --- /dev/null +++ b/biology/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/biology/haplohseq/files/patch-example_example__run.sh b/biology/haplohseq/files/patch-example_example__run.sh new file mode 100644 index 000000000000..10a422bddd82 --- /dev/null +++ b/biology/haplohseq/files/patch-example_example__run.sh @@ -0,0 +1,24 @@ +--- 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 new file mode 100644 index 000000000000..d16f74cf9949 --- /dev/null +++ b/biology/haplohseq/files/patch-scripts_ldmap.py @@ -0,0 +1,8 @@ +--- scripts/ldmap.py.orig 2019-11-13 15:51:02 UTC ++++ scripts/ldmap.py +@@ -1,3 +1,5 @@ ++#!/usr/bin/env python2.7 ++ + import argparse + import sys + import random diff --git a/biology/haplohseq/files/patch-scripts_simple__phaser.py b/biology/haplohseq/files/patch-scripts_simple__phaser.py new file mode 100644 index 000000000000..d81d288e67ea --- /dev/null +++ b/biology/haplohseq/files/patch-scripts_simple__phaser.py @@ -0,0 +1,8 @@ +--- scripts/simple_phaser.py.orig 2019-11-13 15:52:02 UTC ++++ scripts/simple_phaser.py +@@ -1,3 +1,5 @@ ++#!/usr/bin/env python2.7 ++ + import argparse + import random + import sys diff --git a/biology/haplohseq/files/patch-src_FreqPhase.cpp b/biology/haplohseq/files/patch-src_FreqPhase.cpp new file mode 100644 index 000000000000..9bab76aee2f5 --- /dev/null +++ b/biology/haplohseq/files/patch-src_FreqPhase.cpp @@ -0,0 +1,29 @@ +--- src/FreqPhase.cpp.orig 2019-11-13 14:19:06 UTC ++++ src/FreqPhase.cpp +@@ -5,6 +5,7 @@ + * Email: sanlucas@gmail.com + */ + ++#include + #include "FreqPhase.h" + + namespace haplohseq { +@@ -180,10 +181,17 @@ double FreqPhase::meanValue(const std::v + double FreqPhase::medianValue(const std::vector& 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 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/biology/haplohseq/pkg-plist b/biology/haplohseq/pkg-plist new file mode 100644 index 000000000000..cab57d2be449 --- /dev/null +++ b/biology/haplohseq/pkg-plist @@ -0,0 +1,11 @@ +bin/haplohseq +%%PORTEXAMPLES%%bin/haplohseq-example +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/example/example_input/tumor_exome.vcf +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/example/example_run.sh +%%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 +%%PORTEXAMPLES%%@dir %%EXAMPLESDIR%%/example/example_output