1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-22 04:17:44 +00:00

biology/gcta: Genome-wide Complex Trait Analysis

GCTA (Genome-wide Complex Trait Analysis) was originally designed to estimate
the proportion of phenotypic variance explained by genome- or chromosome-wide
SNPs for complex traits (the GREML method), and has subsequently extended for
many other analyses to better understand the genetic architecture of complex
traits.
This commit is contained in:
Jason W. Bacon 2020-04-15 15:22:04 +00:00
parent 81a43c2ff3
commit 64673b1e81
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=531770
9 changed files with 218 additions and 0 deletions

View File

@ -43,6 +43,7 @@
SUBDIR += freebayes
SUBDIR += garlic
SUBDIR += gatk
SUBDIR += gcta
SUBDIR += gemma
SUBDIR += gff2ps
SUBDIR += gmap

35
biology/gcta/Makefile Normal file
View File

@ -0,0 +1,35 @@
# $FreeBSD$
PORTNAME= gcta
DISTVERSION= 1.26.0
CATEGORIES= biology
MASTER_SITES= https://cnsgenomics.com/software/gcta/pre_gcta/
DISTNAME= ${PORTNAME}_${PORTVERSION}_src
MAINTAINER= jwb@FreeBSD.org
COMMENT= Genome-wide Complex Trait Analysis
LICENSE= GPLv3
LICENSE_FILE= ${WRKSRC}/GNU_General_Public_License_v3.txt
BUILD_DEPENDS= eigen>=3:math/eigen3
LIB_DEPENDS+= libopenblas.so:math/openblas
USES= compiler:openmp dos2unix gmake localbase zip
CXXFLAGS+= -I${LOCALBASE}/include/eigen3 -fopenmp
LDFLAGS+= -lopenblas
INSTALL_TARGET= install-strip
PLIST_FILES= bin/gcta
.include <bsd.port.pre.mk>
.if ${CHOSEN_COMPILER_TYPE} == gcc && ${COMPILER_VERSION} <= 42
USE_GCC= yes
.endif
do-extract:
${UNZIP_NATIVE_CMD} -d ${WRKSRC} ${DISTDIR}/${DISTFILES}
.include <bsd.port.post.mk>

3
biology/gcta/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1489125670
SHA256 (gcta_1.26.0_src.zip) = 554c48f421c93cbaf64b1c300ca507d8e7a56086b5c7d857227fbd4048f42acf
SIZE (gcta_1.26.0_src.zip) = 198045

View File

@ -0,0 +1,59 @@
--- Makefile.orig 2020-04-15 01:43:44 UTC
+++ Makefile
@@ -6,21 +6,27 @@
# ---------------------------------------------------------------------
# Directory of the target
-OUTPUT = gcta64
+OUTPUT = gcta
# Compiler
-CXX = g++
+CXX ?= g++
# EIGEN library
-EIGEN_PATH = ../../../Lib/eigen
+EIGEN_PATH ?= ../../../Lib/eigen
# Intel MKL library
-MKL_PATH = /opt/intel/mkl
+MKL_PATH ?= /opt/intel/mkl
# Compiler flags
-CXXFLAGS = -w -O3 -m64 -static -fopenmp -I $(EIGEN_PATH) -DEIGEN_NO_DEBUG -I $(MKL_PATH)/include
-LIB += -static -lz -Wl,--start-group $(MKL_PATH)/lib/intel64/libmkl_intel_lp64.a $(MKL_PATH)/lib/intel64/libmkl_gnu_thread.a $(MKL_PATH)/lib/intel64/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl
+CXXFLAGS ?= -w -O3 -m64 -static -fopenmp -I $(EIGEN_PATH) -DEIGEN_NO_DEBUG -I $(MKL_PATH)/include
+LDFLAGS += -lz -Wl,--start-group -lpthread -lm -ldl
+MKDIR ?= mkdir
+DESTDIR ?= .
+PREFIX ?= /usr/local
+INSTALL ?= install
+STRIP ?= strip
+
HDR += CommFunc.h \
cdflib.h \
dcdflib.h \
@@ -58,7 +64,7 @@ OBJ = $(SRC:.cpp=.o)
all : $(OUTPUT)
$(OUTPUT) :
- $(CXX) $(CXXFLAGS) -o $(OUTPUT) $(OBJ) $(LIB)
+ $(CXX) $(CXXFLAGS) -o $(OUTPUT) $(OBJ) $(LDFLAGS)
$(OBJ) : $(HDR)
@@ -69,6 +75,13 @@ $(OBJ) : $(HDR)
$(OUTPUT) : $(OBJ)
FORCE:
+
+install:
+ ${MKDIR} -p ${DESTDIR}${PREFIX}/bin
+ ${INSTALL} -c ${OUTPUT} ${DESTDIR}${PREFIX}/bin
+
+install-strip: install
+ ${STRIP} ${DESTDIR}${PREFIX}/bin/${OUTPUT}
clean:
rm -f *.o

View File

@ -0,0 +1,15 @@
--- eigen_func.h.orig 2016-06-22 03:11:01 UTC
+++ eigen_func.h
@@ -12,9 +12,9 @@
#ifndef _EIGENFUNC_H
#define _EIGENFUNC_H
-#ifndef EIGEN_USE_MKL_ALL
-#define EIGEN_USE_MKL_ALL
-#endif
+//#ifndef EIGEN_USE_MKL_ALL
+//#define EIGEN_USE_MKL_ALL
+//#endif
#include "CommFunc.h"
#include "StatFunc.h"

View File

@ -0,0 +1,29 @@
--- gcta.h.orig 2016-06-22 03:11:01 UTC
+++ gcta.h
@@ -17,9 +17,9 @@
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
#endif
-#ifndef EIGEN_USE_MKL_ALL
-#define EIGEN_USE_MKL_ALL
-#endif
+//#ifndef EIGEN_USE_MKL_ALL
+//#define EIGEN_USE_MKL_ALL
+//#endif
#include "CommFunc.h"
#include "StrFunc.h"
@@ -36,8 +36,11 @@
#include <unsupported/Eigen/SparseExtra>
#include <unsupported/Eigen/IterativeSolvers>
#include <omp.h>
-#include <mkl_cblas.h>
-#include <mkl_lapack.h>
+#include <cblas.h>
+#include <lapacke.h>
+// Looks like openblas, cblas and lapacke are all that's needed
+//#include <blaspp.h>
+//#include <lapackpp.h>
using namespace Eigen;
using namespace std;

View File

@ -0,0 +1,13 @@
--- ld.cpp.orig 2020-04-15 12:56:27 UTC
+++ ld.cpp
@@ -1004,7 +1004,9 @@ void gcta::calcu_max_ld_rsq_blk(eigenVector &multi_rsq
}
- SelfAdjointEigenSolver<MatrixXf> pca(rsq_sub.array());
+ // Fixed compile by removing .array(). Not sure about the validity
+ // of this change, but it seemed reasonable based on constructor docs.
+ SelfAdjointEigenSolver<MatrixXf> pca(rsq_sub);
// debug
// ofstream tmp("tmp_R.txt");

View File

@ -0,0 +1,56 @@
--- mkl.cpp.orig 2020-04-15 00:54:40 UTC
+++ mkl.cpp
@@ -357,7 +357,7 @@ bool gcta::comput_inverse_logdet_LDLT_mkl(eigenMatrix
// MKL's Cholesky decomposition
int info = 0, int_n = (int) n;
char uplo = 'L';
- dpotrf(&uplo, &int_n, Vi_mkl, &int_n, &info);
+ dpotrf_(&uplo, &int_n, Vi_mkl, &int_n, &info);
//spotrf( &uplo, &n, Vi_mkl, &n, &info );
if (info < 0) throw ("Error: Cholesky decomposition failed. Invalid values found in the matrix.\n");
else if (info > 0) return false;
@@ -369,7 +369,7 @@ bool gcta::comput_inverse_logdet_LDLT_mkl(eigenMatrix
}
// Calcualte V inverse
- dpotri(&uplo, &int_n, Vi_mkl, &int_n, &info);
+ dpotri_(&uplo, &int_n, Vi_mkl, &int_n, &info);
//spotri( &uplo, &n, Vi_mkl, &n, &info );
if (info < 0) throw ("Error: invalid values found in the varaince-covaraince (V) matrix.\n");
else if (info > 0) return false;
@@ -405,7 +405,7 @@ bool gcta::comput_inverse_logdet_LU_mkl(eigenMatrix &V
int LWORK = N*N;
double *WORK = new double[n * n];
int INFO;
- dgetrf(&N, &N, Vi_mkl, &N, IPIV, &INFO);
+ dgetrf_(&N, &N, Vi_mkl, &N, IPIV, &INFO);
if (INFO < 0) throw ("Error: LU decomposition failed. Invalid values found in the matrix.\n");
else if (INFO > 0) {
delete[] Vi_mkl;
@@ -418,7 +418,7 @@ bool gcta::comput_inverse_logdet_LU_mkl(eigenMatrix &V
}
// Calcualte V inverse
- dgetri(&N, Vi_mkl, &N, IPIV, WORK, &LWORK, &INFO);
+ dgetri_(&N, Vi_mkl, &N, IPIV, WORK, &LWORK, &INFO);
if (INFO < 0) throw ("Error: invalid values found in the varaince-covaraince (V) matrix.\n");
else if (INFO > 0) return false;
else {
@@ -453,7 +453,7 @@ bool gcta::comput_inverse_logdet_LU_mkl_array(int n, f
int LWORK = N*N;
double *WORK = new double[n * n];
int INFO;
- dgetrf(&N, &N, Vi_mkl, &N, IPIV, &INFO);
+ dgetrf_(&N, &N, Vi_mkl, &N, IPIV, &INFO);
if (INFO < 0) throw ("Error: LU decomposition failed. Invalid values found in the matrix.\n");
else if (INFO > 0) {
delete[] Vi_mkl;
@@ -467,7 +467,7 @@ bool gcta::comput_inverse_logdet_LU_mkl_array(int n, f
}
// Calcualte V inverse
- dgetri(&N, Vi_mkl, &N, IPIV, WORK, &LWORK, &INFO);
+ dgetri_(&N, Vi_mkl, &N, IPIV, WORK, &LWORK, &INFO);
if (INFO < 0) throw ("Error: invalid values found in the varaince-covaraince (V) matrix.\n");
else if (INFO > 0) return (false); // Vi.diagonal()=Vi.diagonal().array()+Vi.diagonal().mean()*1e-3;
else {

7
biology/gcta/pkg-descr Normal file
View File

@ -0,0 +1,7 @@
GCTA (Genome-wide Complex Trait Analysis) was originally designed to estimate
the proportion of phenotypic variance explained by genome- or chromosome-wide
SNPs for complex traits (the GREML method), and has subsequently extended for
many other analyses to better understand the genetic architecture of complex
traits.
WWW: http://cnsgenomics.com/software/gcta/index.html