git: c9bd01bdf4c1 - main - biology/kallisto: Update to 0.48.0

From: Jason W. Bacon <jwb_at_FreeBSD.org>
Date: Wed, 19 Jan 2022 14:00:10 UTC
The branch main has been updated by jwb:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c9bd01bdf4c1dae17b53482e9dabe000d310cf50

commit c9bd01bdf4c1dae17b53482e9dabe000d310cf50
Author:     Jason W. Bacon <jwb@FreeBSD.org>
AuthorDate: 2022-01-19 13:57:36 +0000
Commit:     Jason W. Bacon <jwb@FreeBSD.org>
CommitDate: 2022-01-19 13:57:36 +0000

    biology/kallisto: Update to 0.48.0
    
    Fixes segfault with --genomebam in 0.46.2
    Unbundle htslib
    A few new features and performance improvements
    
    Changes:        https://github.com/pachterlab/kallisto/tags
---
 biology/kallisto/Makefile                          | 10 +++++---
 biology/kallisto/distinfo                          |  6 ++---
 biology/kallisto/files/kallisto-test.in            | 29 +++++++++++++++++++--
 biology/kallisto/files/patch-CMakeLists.txt        | 30 ++++++++++++++++------
 .../kallisto/files/patch-ext_htslib_configure.ac   | 11 --------
 biology/kallisto/files/patch-src_CMakeLists.txt    | 26 +++++++++++++++++++
 biology/kallisto/files/patch-src_kseq.h            | 12 +++++++++
 7 files changed, 97 insertions(+), 27 deletions(-)

diff --git a/biology/kallisto/Makefile b/biology/kallisto/Makefile
index 996d22ee8720..3d4aecd0b9d3 100644
--- a/biology/kallisto/Makefile
+++ b/biology/kallisto/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=		kallisto
 DISTVERSIONPREFIX=	v
-DISTVERSION=		0.46.1
+DISTVERSION=		0.48.0
 PORTEPOCH=		1
 CATEGORIES=		biology
 
@@ -12,7 +12,8 @@ LICENSE_FILE=	${WRKSRC}/license.txt
 
 BUILD_DEPENDS=	autoconf>=0:devel/autoconf
 LIB_DEPENDS=	libhdf5.so:science/hdf5 \
-		libsz.so:science/szip
+		libsz.so:science/szip \
+		libhts.so:biology/htslib
 
 USES=		cmake:noninja compiler:c++11-lang gmake localbase:ldflags
 USE_GITHUB=	yes
@@ -29,10 +30,13 @@ EXAMPLES_PLIST_FILES=	bin/kallisto-test
 # downstream tools.  Remove this after Sleuth et al catch up.
 CMAKE_ARGS+=		-DUSE_HDF5:BOOL=ON
 MAKE_JOBS_UNSAFE=	yes
-LDFLAGS+=		-lz
+LDFLAGS+=		-lhts -lz
 
 OPTIONS_DEFINE=	EXAMPLES
 
+post-extract:
+	${RM} -rf ${WRKSRC}/ext/htslib
+
 post-install-EXAMPLES-on:
 	${INSTALL_SCRIPT} ${WRKDIR}/kallisto-test ${STAGEDIR}${PREFIX}/bin
 	cd ${WRKSRC}/test && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR}
diff --git a/biology/kallisto/distinfo b/biology/kallisto/distinfo
index 98722ba0c842..1f2de73cccd4 100644
--- a/biology/kallisto/distinfo
+++ b/biology/kallisto/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1595454023
-SHA256 (pachterlab-kallisto-v0.46.1_GH0.tar.gz) = 492ef081395e8858fcd9832aceb8b61c79358f00afb45e6709146c0fb51dd231
-SIZE (pachterlab-kallisto-v0.46.1_GH0.tar.gz) = 2254560
+TIMESTAMP = 1642516764
+SHA256 (pachterlab-kallisto-v0.48.0_GH0.tar.gz) = 1797ac4d1f0771e3f1f25dd7972bded735fcb43f853cf52184d3d9353a6269b0
+SIZE (pachterlab-kallisto-v0.48.0_GH0.tar.gz) = 2706838
diff --git a/biology/kallisto/files/kallisto-test.in b/biology/kallisto/files/kallisto-test.in
old mode 100644
new mode 100755
index f713e9dc44c2..952063e4e66b
--- a/biology/kallisto/files/kallisto-test.in
+++ b/biology/kallisto/files/kallisto-test.in
@@ -16,6 +16,20 @@ usage()
 }
 
 
+##########################################################################
+#   Function description:
+#       Pause until user presses return
+##########################################################################
+
+pause()
+{
+    local junk
+    
+    printf "Press return to continue..."
+    read junk
+}
+
+
 ##########################################################################
 #   Main
 ##########################################################################
@@ -32,9 +46,20 @@ fi
 
 cp -iR %%EXAMPLESDIR%% "$dir"
 cd "$dir"
-kallisto index -i transcripts.idx transcripts.fasta.gz
-kallisto quant -i transcripts.idx -o output -b 100 reads_1.fastq.gz reads_2.fastq.gz
+kallisto index --index=transcripts.idx transcripts.fasta.gz
+pause
+
+kallisto quant --index=transcripts.idx --genomebam --chromosomes=chrom.txt \
+    --gtf=transcripts.gtf.gz --output-dir=output \
+    --boostrap-samples=100 reads_1.fastq.gz reads_2.fastq.gz
+pause
+
 ls -l output
+pause
+
+# Test genomebam
+samtools view output/pseudoalignments.bam | more
+
 more output/abundance.tsv
 
 cat << EOM
diff --git a/biology/kallisto/files/patch-CMakeLists.txt b/biology/kallisto/files/patch-CMakeLists.txt
index b122ef10d345..fb498f8a945b 100644
--- a/biology/kallisto/files/patch-CMakeLists.txt
+++ b/biology/kallisto/files/patch-CMakeLists.txt
@@ -1,11 +1,25 @@
---- CMakeLists.txt.orig	2020-07-22 22:36:50 UTC
+--- CMakeLists.txt.orig	2019-11-04 16:28:52 UTC
 +++ CMakeLists.txt
-@@ -42,7 +42,7 @@ ExternalProject_Add(htslib
-     BUILD_IN_SOURCE 1
-     CONFIGURE_COMMAND autoheader && autoconf && ${PROJECT_SOURCE_DIR}/ext/htslib/configure 
-         --prefix=${PREFIX} --disable-bz2 --disable-lzma --disable-libcurl
+@@ -34,22 +34,6 @@ ELSE(LINK MATCHES shared)
+     message("shared build")
+ ENDIF(LINK MATCHES static)
+ 
+-
+-include(ExternalProject)
+-ExternalProject_Add(htslib
+-    PREFIX ${PROJECT_SOURCE_DIR}/ext/htslib
+-    SOURCE_DIR ${PROJECT_SOURCE_DIR}/ext/htslib
+-    BUILD_IN_SOURCE 1
+-    CONFIGURE_COMMAND autoheader && autoconf && ${PROJECT_SOURCE_DIR}/ext/htslib/configure 
+-        --prefix=${PREFIX} --disable-bz2 --disable-lzma --disable-libcurl
 -    BUILD_COMMAND make lib-static
-+    BUILD_COMMAND gmake lib-static
-     INSTALL_COMMAND ""
- )
+-    INSTALL_COMMAND ""
+-)
+-
+-include_directories(${htslib_PREFIX}/src/htslib)
+-
+-
+-
+ # add_compile_options(-Wdeprecated-register)
  
+ add_subdirectory(src)
diff --git a/biology/kallisto/files/patch-ext_htslib_configure.ac b/biology/kallisto/files/patch-ext_htslib_configure.ac
deleted file mode 100644
index 0482cc554c45..000000000000
--- a/biology/kallisto/files/patch-ext_htslib_configure.ac
+++ /dev/null
@@ -1,11 +0,0 @@
---- ext/htslib/configure.ac.orig	2019-11-04 16:28:52 UTC
-+++ ext/htslib/configure.ac
-@@ -23,7 +23,7 @@
- # DEALINGS IN THE SOFTWARE.
- 
- dnl Process this file with autoconf to produce a configure script
--AC_INIT([HTSlib], m4_esyscmd_s([make print-version]),
-+AC_INIT([HTSlib], [1.4.1],
-         [samtools-help@lists.sourceforge.net], [], [http://www.htslib.org/])
- AC_PREREQ(2.63)  dnl This version introduced 4-argument AC_CHECK_HEADER
- AC_CONFIG_SRCDIR(hts.c)
diff --git a/biology/kallisto/files/patch-src_CMakeLists.txt b/biology/kallisto/files/patch-src_CMakeLists.txt
new file mode 100644
index 000000000000..fbeb9128522a
--- /dev/null
+++ b/biology/kallisto/files/patch-src_CMakeLists.txt
@@ -0,0 +1,26 @@
+--- src/CMakeLists.txt.orig	2021-11-24 14:45:50 UTC
++++ src/CMakeLists.txt
+@@ -3,15 +3,13 @@ file(GLOB headers *.h *.hpp)
+ 
+ list(REMOVE_ITEM sources main.cpp)
+ 
+-include_directories(../ext/htslib)
+-
+ add_library(kallisto_core ${sources} ${headers})
+ target_include_directories(kallisto_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+ 
+ add_executable(kallisto main.cpp)
+ 
+ find_package( Threads REQUIRED )
+-target_link_libraries(kallisto kallisto_core pthread ${CMAKE_CURRENT_SOURCE_DIR}/../ext/htslib/libhts.a)
++target_link_libraries(kallisto kallisto_core pthread)
+ 
+ if(LINK MATCHES static)
+     set(BUILD_SHARED_LIBS OFF)
+@@ -56,4 +54,4 @@ else()
+ endif(LINK MATCHES static)
+ 
+ 
+-install(TARGETS kallisto DESTINATION "${CMAKE_INSTALL_BINDIR}")
+\ No newline at end of file
++install(TARGETS kallisto DESTINATION "${CMAKE_INSTALL_BINDIR}")
diff --git a/biology/kallisto/files/patch-src_kseq.h b/biology/kallisto/files/patch-src_kseq.h
new file mode 100644
index 000000000000..f7712a023fda
--- /dev/null
+++ b/biology/kallisto/files/patch-src_kseq.h
@@ -0,0 +1,12 @@
+--- src/kseq.h.orig	2019-11-04 16:28:52 UTC
++++ src/kseq.h
+@@ -32,6 +32,9 @@
+ #include <string.h>
+ #include <stdlib.h>
+ 
++// Prevent redefinition of kstring_t below
++#include <htslib/kstring.h>
++
+ #define KS_SEP_SPACE 0 // isspace(): \t, \n, \v, \f, \r
+ #define KS_SEP_TAB   1 // isspace() && !' '
+ #define KS_SEP_LINE  2 // line separator: "\n" (Unix) or "\r\n" (Windows)