diff --git a/bcftools-1.9-configure.patch b/bcftools-1.9-configure.patch new file mode 100644 index 0000000..7e1261e --- /dev/null +++ b/bcftools-1.9-configure.patch @@ -0,0 +1,43 @@ +--- bcftools-1.9-clean/config.mk.in 2018-03-15 14:28:19.000000000 +0000 ++++ bcftools-1.9-after/config.mk.in 2019-11-06 22:13:02.000000000 +0000 +@@ -50,7 +50,8 @@ + + PLATFORM = @PLATFORM@ + PLUGINS_ENABLED = @enable_bcftools_plugins@ +-plugindir = @bcf_plugindir@ ++plugindir = @bcf_plugindir@ ++pluginpath = @bcf_pluginpath@ + PLUGIN_EXT = @PLUGIN_EXT@ + + @Hsource@HTSDIR = @HTSDIR@ +--- bcftools-1.9-clean/configure.ac 2018-07-03 16:54:58.000000000 +0100 ++++ bcftools-1.9-after/configure.ac 2019-11-06 22:13:02.000000000 +0000 +@@ -71,7 +71,7 @@ + no) with_bcf_plugin_path= ;; + esac], + [with_bcf_plugin_path=$with_bcf_plugin_dir]) +-AC_SUBST([PLUGINPATH], $with_bcf_plugin_path) ++AC_SUBST([bcf_pluginpath], $with_bcf_plugin_path) + + AC_ARG_ENABLE([perl-filters], + [AS_HELP_STRING([--enable-perl-filters], +--- bcftools-1.9-clean/configure 2019-11-06 22:16:31.000000000 +0000 ++++ bcftools-1.9-after/configure 2019-11-06 22:16:43.000000000 +0000 +@@ -588,7 +588,7 @@ + HTSDIR + subdirs + enable_perl_filters +-PLUGINPATH ++bcf_pluginpath + bcf_plugindir + enable_bcftools_plugins + GREP +@@ -3237,7 +3237,7 @@ + with_bcf_plugin_path=$with_bcf_plugin_dir + fi + +-PLUGINPATH=$with_bcf_plugin_path ++bcf_pluginpath=$with_bcf_plugin_path + + + # Check whether --enable-perl-filters was given. diff --git a/bcftools-1.9-python3.patch b/bcftools-1.9-python3.patch new file mode 100644 index 0000000..9e31fac --- /dev/null +++ b/bcftools-1.9-python3.patch @@ -0,0 +1,76 @@ +diff --git a/misc/guess-ploidy.py b/misc/guess-ploidy.py +index 816a5c6..6ad3d36 100755 +--- a/misc/guess-ploidy.py ++++ b/misc/guess-ploidy.py +@@ -24,6 +24,8 @@ + # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + # DEALINGS IN THE SOFTWARE. + ++from __future__ import print_function ++ + import matplotlib as mpl + mpl.use('Agg') + import matplotlib.pyplot as plt +@@ -33,8 +35,9 @@ import csv + csv.register_dialect('tab', delimiter='\t', quoting=csv.QUOTE_NONE) + + if len(sys.argv) != 3: +- print >> sys.stderr, 'About: Plot output of "bcftools +guess-ploidy -v"' +- print >> sys.stderr, 'Usage: guess-ploidy.py ' ++ print("""\ ++About: Plot output of "bcftools +guess-ploidy -v" ++Usage: guess-ploidy.py """, file = sys.stderr) + sys.exit() + + prefix = sys.argv[2] +diff --git a/misc/plot-roh.py b/misc/plot-roh.py +index 81efaaa..90dd63e 100755 +--- a/misc/plot-roh.py ++++ b/misc/plot-roh.py +@@ -29,26 +29,27 @@ csv.register_dialect('tab', delimiter='\t', quoting=csv.QUOTE_NONE) + + def usage(msg=None): + if msg==None: +- print 'Usage: plot.py [OPTIONS] ' +- print 'Options:' +- print ' -H, --highlight +group1,-group2 Highlight calls shared within group1 but not present in group2' +- print ' -i, --interactive Run interactively' +- print ' -l, --min-length Filter input regions shorter than this [0]' +- print ' -n, --min-markers Filter input regions with fewer marker than this [0]' +- print ' -o, --outfile Output file name [plot.png]' +- print ' -q, --min-qual Filter input regions with quality smaller than this [0]' +- print ' -r, --region [^] Plot this chromosome/region only' +- print ' -s, --samples List of samples to show, rename or group: "name[\\tnew_name[\\tgroup]]"' +- print ' -h, --help This usage text' +- print 'Matplotlib options:' +- print ' +adj, --adjust Set plot adjust [bottom=0.18,left=0.07,right=0.98]' +- print ' +dpi, --dpi Set bitmap DPI [150]' +- print ' +sxt, --show-xticks Show x-ticks (genomic coordinate)' +- print ' +twh, --track-wh Set track width and height [20,1]' +- print ' +xlb, --xlabel Set x-label' +- print ' +xli, --xlimit Extend x-range by this fraction [0.05]' ++ print("""\ ++Usage: plot-roh.py [OPTIONS] ++Options: ++ -H, --highlight +group1,-group2 Highlight calls shared within group1 but not present in group2 ++ -i, --interactive Run interactively ++ -l, --min-length Filter input regions shorter than this [0] ++ -n, --min-markers Filter input regions with fewer marker than this [0] ++ -o, --outfile Output file name [plot.png] ++ -q, --min-qual Filter input regions with quality smaller than this [0] ++ -r, --region [^] Plot this chromosome/region only ++ -s, --samples List of samples to show, rename or group: "name[\\tnew_name[\\tgroup]]" ++ -h, --help This usage text ++Matplotlib options: ++ +adj, --adjust Set plot adjust [bottom=0.18,left=0.07,right=0.98] ++ +dpi, --dpi Set bitmap DPI [150] ++ +sxt, --show-xticks Show x-ticks (genomic coordinate) ++ +twh, --track-wh Set track width and height [20,1] ++ +xlb, --xlabel Set x-label ++ +xli, --xlimit Extend x-range by this fraction [0.05]""") + else: +- print msg ++ print(msg) + sys.exit(1) + + dir = None diff --git a/bcftools.spec b/bcftools.spec new file mode 100644 index 0000000..568ebea --- /dev/null +++ b/bcftools.spec @@ -0,0 +1,71 @@ +Name: bcftools +Version: 1.9 +Release: 1%{?dist} +Summary: Tools for genomic variant calling and manipulating VCF/BCF files + +# The bcftools source code is MIT-licensed, but the executable becomes +# GPL-licensed when --enable-libgsl is used. +License: GPLv3+ +URL: http://www.htslib.org/ +Source0: https://github.com/samtools/bcftools/releases/download/%{version}/bcftools-%{version}.tar.bz2 +Patch0: bcftools-1.9-python3.patch +Patch1: bcftools-1.9-configure.patch + +BuildRequires: gcc +BuildRequires: gsl-devel +BuildRequires: htslib-devel +BuildRequires: htslib-tools +BuildRequires: perl-interpreter +BuildRequires: perl(ExtUtils::Embed) +BuildRequires: perl(File::Temp) +BuildRequires: perl(Getopt::Long) +BuildRequires: zlib-devel + +%description +BCFtools is a set of utilities that manipulate genomic variant calls in the +Variant Call Format (VCF) and its binary counterpart (BCF). All commands work +transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed. + +(This BCFtools includes the polysomy subcommand, which is implemented using +the GNU Scientific Library. Hence this package is licensed according to the +GNU General Public License, rather than the MIT license used when BCFtools +is built without the polysomy subcommand.) + + +%prep +%setup -q +%patch0 -p1 -b .py3 +%patch1 -p1 -b .conf + +sed -i '1s,/usr/bin/env perl,/usr/bin/perl,' misc/*.pl misc/plot-vcfstats +sed -i '1s,/usr/bin/env python,%{__python3},' misc/*.py + + +%build +%configure CFLAGS="%{optflags}" LDFLAGS="%{build_ldflags}" \ + --prefix=%{_prefix} \ + --with-htslib=system --enable-perl-filters --enable-libgsl \ + --with-bcf-plugin-path='%{_usr}/local/libexec/bcftools:$(plugindir)' +%make_build + + +%install +%make_install + + +%check +make test + + +%files +%doc AUTHORS NEWS +%license LICENSE +%{_bindir}/* +%{_libexecdir}/bcftools +%{_mandir}/man1/bcftools.1* + + +%changelog +* Wed Nov 06 2019 John Marshall - 1.9-1 +- New spec file for bcftools, now separate from samtools (#1767792). +- Backported Python 3 and configure patches from later upstream development.