aboutsummaryrefslogtreecommitdiff
blob: e9cb4c73abda603705b786dfb2f094a2bbf48ac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

PYTHON_COMPAT=( python{2_6,2_7} )

inherit java-pkg-2 java-pkg-simple python-r1 versionator

MY_PV="$(delete_all_version_separators $(get_version_component_range 1-2))"
MY_PATCH="20120106"
MY_P="${PN}-v${MY_PV}-linux"

DESCRIPTION="Predicts both the backbone and side chain 1H, 13C and 15N chemical shifts for proteins"
HOMEPAGE="http://shiftx2.wishartlab.com/"
SRC_URI="http://shiftx2.wishartlab.com/download/${MY_P}-${MY_PATCH}.tgz"

SLOT="0"
LICENSE="all-rights-reserved"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="debug"

CDEPEND="dev-util/weka"

RDEPEND="${CDEPEND}
	dev-lang/R
	>=virtual/jre-1.5"
DEPEND="${CDEPEND}
	>=virtual/jdk-1.5"

S="${WORKDIR}"/${MY_P}

src_prepare() {
	epatch "${FILESDIR}/gentoo-fixes.patch"
	rm "${S}"/src/FeatureRanges.java || die

	shared=$(echo "/usr/share/${PN}" | sed -e 's/\//\\\//g')
	sed -i -e "s/PUT_GENTOO_SHARE_PATH_HERE/${shared}/g" "${S}/src/ShiftXp.java" || die

	if use debug; then
		sed -i -e 's/DEBUG = false/DEBUG = true/g' "${S}/src/ShiftXp.java" || die
	fi

	# hack alert!
	sed '/-o/s:$: -lm:g' -i "${S}/modules/resmf/Makefile" || die
}

src_compile() {
	mkdir "${S}"/build || die
	ejavac -classpath "$(java-pkg_getjars weka)" -nowarn \
		-d "${S}"/build $(find src/ -name "*.java")
	jar cf "${PN}.jar" -C "${S}"/build . || die

	einfo "Building module angles"
	cd "${S}"/modules/angles || die
	emake clean
	emake CFLAGS="${CFLAGS}" GCC=$(tc-getCC) LINK="${LDFLAGS}" get_angles phipsi

	einfo "Building module resmf"
	cd "${S}"/modules/resmf || die
	emake clean
	emake CFLAGS="${CFLAGS}" GCC=$(tc-getCC) LINK="${LDFLAGS}" resmf

	einfo "Building module effects"
	cd "${S}"/modules/effects || die
	emake clean
	emake CFLAGS="${CFLAGS}" GCC=$(tc-getCC) LINK="${LDFLAGS}" all
}

src_install() {
	java-pkg_dojar "${PN}.jar"
	java-pkg_dolauncher ${PN} --main "ShiftXp" --pkg_args "-dir ${EPREFIX}/usr/bin"

	insinto /usr/share/${PN}
	doins "${S}"/lib/{limitedcshift.dat,RandomCoil.csv,data-header.arff}
	doins -r "${S}"/lib/predmodels

	insinto /usr/share/${PN}/vader
	doins -r "${S}"/modules/resmf/lib/*

	local instdir="/opt/${PN}"
	dodoc README 1UBQ.pdb
	python_parallel_foreach_impl python_doscript "${S}"/*py

	# modules/angles
	cd "${S}"/modules/angles || die
	dobin get_angles phipsi

	# other modules
	dobin "${S}"/modules/resmf/resmf "${S}"/modules/effects/caleffect

	# script
	python_scriptinto ${instdir}/script
	python_parallel_foreach_impl python_doscript "${S}"/script/*py
	exeinto ${instdir}/script
	doexe "${S}"/script/*.r

	# shifty3
	python_scriptinto ${instdir}/shifty3
	python_parallel_foreach_impl python_doscript "${S}"/shifty3/*py
	exeinto ${instdir}/shifty3
	doexe "${S}"/shifty3/xalign_x
}