[med-svn] [Git][med-team/nim-hts][master] 5 commits: New upstream version 0.3.13+ds

Nilesh Patra gitlab at salsa.debian.org
Thu Nov 26 11:56:07 GMT 2020



Nilesh Patra pushed to branch master at Debian Med / nim-hts


Commits:
05e0b475 by Nilesh Patra at 2020-11-26T11:52:20+00:00
New upstream version 0.3.13+ds
- - - - -
efc1d516 by Nilesh Patra at 2020-11-26T11:52:20+00:00
routine-update: New upstream version

- - - - -
7f14a638 by Nilesh Patra at 2020-11-26T11:52:21+00:00
Update upstream source from tag 'upstream/0.3.13+ds'

Update to upstream version '0.3.13+ds'
with Debian dir 768a77d75792bc6bccfeec153be55d25f500668b
- - - - -
9accad14 by Nilesh Patra at 2020-11-26T11:52:22+00:00
routine-update: Standards-Version: 4.5.1

- - - - -
c55426fb by Nilesh Patra at 2020-11-26T11:52:38+00:00
routine-update: Ready to upload to unstable

- - - - -


8 changed files:

- CHANGES.md
- Dockerfile
- − Dockerfile.musl-hts-nim
- README.md
- debian/changelog
- debian/control
- src/hts/private/hts_concat.nim
- src/hts/vcf.nim


Changes:

=====================================
CHANGES.md
=====================================
@@ -1,3 +1,7 @@
+v0.3.13
+=======
++ changes for nim ORC/ARC GCs
+
 v0.3.11
 =======
 + add bgzi.open which allows opening for reading and writing without quit() and replaces


=====================================
Dockerfile
=====================================
@@ -4,7 +4,7 @@ FROM alpine:3.11.5
 ENV CFLAGS="-fPIC -O3"
 
 RUN apk add wget git xz bzip2-static musl m4 autoconf tar xz-dev bzip2-dev build-base libpthread-stubs libzip-dev gfortran \
-	    openssl-libs-static openblas-static pcre-dev curl llvm-dev curl-static
+	    openssl-libs-static openblas-static pcre-dev curl llvm-dev curl-static bash
 
 RUN mkdir -p /usr/local/include && \
     git clone --depth 1 https://github.com/ebiggers/libdeflate.git && \
@@ -38,7 +38,7 @@ ENV PATH=:/root/.nimble/bin:/nim/bin/:$PATH
 
 RUN \
     git clone https://github.com/samtools/htslib && \
-    cd htslib && git checkout 1.10.2 && autoheader && autoconf && \
+    cd htslib && git checkout 1.11 && autoheader && autoconf && \
     ./configure --disable-s3 --disable-libcurl --with-libdeflate && \
     make -j4 CFLAGS="-fPIC -O3" install && \
     cd ../ && \
@@ -49,20 +49,20 @@ RUN \
     cd ../ && rm -rf htslib bcftools
 
 
+RUN sh -c 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y'
+#	    && apk add clang-libs
 
-RUN sh -c 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y' \
-	    && apk add clang-libs
-
-ENV HTSLIB=dynamic
+ENV HTSLIB=system
 ENV PATH=$PATH:~/.cargo/bin/
 
-COPY docker/d4.patch /tmp/
+#COPY docker/d4.patch /tmp/
 
+#&& git apply < /tmp/d4.patch \
 RUN ~/.cargo/bin/rustup target add x86_64-unknown-linux-musl \
 	&& git clone https://github.com/38/d4-format \
 	&& cd d4-format \
-	&& git apply < /tmp/d4.patch \
-	&& ~/.cargo/bin/cargo build --target x86_64-unknown-linux-musl --release
+        && ln -s /usr/bin/gcc /usr/bin/musl-gcc \
+	&& ~/.cargo/bin/cargo build --all --target x86_64-unknown-linux-musl --release
 
 RUN install -m 644 d4-format/target/x86_64-unknown-linux-musl/release/libd4binding.a /usr/lib && \
 	install -m 644 d4-format/d4binding/include/d4.h /usr/include


=====================================
Dockerfile.musl-hts-nim deleted
=====================================
@@ -1,38 +0,0 @@
-## This dockerfile
-# 1. builds htslib and all dependencies currently without libcurl
-# 2. installs nim
-# 3. sets up a nim binary (nsb) that is expected to be called from an external binary (static_builder)
-# These facilitate building static binaries for projects using hts-nim.
-
-# docker build -t brentp/musl-hts-nim:latest -f Dockerfile.musl-hts-nim ..
-FROM alpine:3.9
-
-ENV LDFLAGS=-static PKG_CONFIG='pkg-config --static'
-ENV curl_LDFLAGS=-all-static
-
-RUN apk add curl musl build-base git autoconf zlib-dev bzip2-dev xz-dev curl-dev
-
-RUN cd / && \
-    git clone -b devel --depth 10 git://github.com/nim-lang/nim nim && \
-    cd nim && sh ./build_all.sh
-
-RUN git clone --depth 1 https://github.com/ebiggers/libdeflate.git && \
-    cd libdeflate && make -j 2 CFLAGS='-fPIC -O3' libdeflate.a && \
-    cp libdeflate.a /usr/local/lib && cp libdeflate.h /usr/include && \
-    cd .. && rm -rf libdeflate && \
-    git clone https://github.com/samtools/htslib && \
-    cd htslib && git checkout 1.9 && autoheader && autoconf && \
-   ./configure --enable-plugins --disable-libcurl --with-libdeflate && \
-   make -j4 install && \
-   cd ../ && rm -rf htslib
-
-ADD . /src/
-
-ENV PATH=/root/.nimble/bin:/nim/bin/:$PATH
-
-RUN cat /src/docker/docker.nim.cfg >> /nim/config/nim.cfg && \
-    cd /src/ && nimble install -y && \
-    nimble install -y docopt && \
-    nimble install -y c2nim@#3ec45c24585ebaed && \
-    nim c -o:/usr/local/bin/nsb /src/docker/nsb.nim && \
-    rm -rf /src/


=====================================
README.md
=====================================
@@ -17,7 +17,7 @@ too different to python.
 
 If you use this library, please cite [the paper](https://academic.oup.com/bioinformatics/advance-article-abstract/doi/10.1093/bioinformatics/bty358/4990493)
 
-Projects using `hts-nim` are accumulating [in the wiki](https://github.com/brentp/hts-nim/wiki/Examples)
+Projects using `hts-nim` are accumulating [in the wiki](https://github.com/brentp/hts-nim/wiki/Example-uses-of-hts-nim)
 
 ## Installation
 
@@ -29,7 +29,7 @@ Examples of `hts-nim` tools are available in the [hts-nim-tools repo](https://gi
 
 below are examples of the syntax in this library see the [docs](https://brentp.github.io/hts-nim/) for more info:
 
-Also see examples and other repos using hts-nim in the [wiki](https://github.com/brentp/hts-nim/wiki/Examples)
+Also see examples and other repos using hts-nim in the [wiki](https://github.com/brentp/hts-nim/wiki/Example-uses-of-hts-nim)
 
 ## BAM / CRAM / SAM
 


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+nim-hts (0.3.13+ds-1) unstable; urgency=medium
+
+  * New upstream version
+  * Standards-Version: 4.5.1 (routine-update)
+
+ -- Nilesh Patra <npatra974 at gmail.com>  Thu, 26 Nov 2020 11:52:38 +0000
+
 nim-hts (0.3.12+ds-4) unstable; urgency=medium
 
   * Remove wrong path while running tests


=====================================
debian/control
=====================================
@@ -11,7 +11,7 @@ Build-Depends: debhelper-compat (= 13),
                samtools,
                tabix,
                bcftools
-Standards-Version: 4.5.0
+Standards-Version: 4.5.1
 Homepage: https://github.com/brentp/hts-nim
 Vcs-Browser: https://salsa.debian.org/med-team/nim-hts
 Vcs-Git: https://salsa.debian.org/med-team/nim-hts.git


=====================================
src/hts/private/hts_concat.nim
=====================================
@@ -8,9 +8,10 @@ elif defined(macosx):
 else:
   const
     libname* = "libhts.so"
-when NimMajor < 1:
-    type
-        csize_t* = csize
+
+when (NimMajor, NimMinor) < (1, 1):
+  type
+    csize_t* = csize
 ##
 ## enum hts_fmt_option {
 ##     // CRAM specific


=====================================
src/hts/vcf.nim
=====================================
@@ -73,6 +73,17 @@ var empty_samples: seq[string]
 converter toInt(b:BCF_HEADER_TYPE): int = b.int
 converter toCint(b:BCF_HEADER_TYPE): cint = b.cint
 
+proc destroy_variant(v:Variant) =
+  if v != nil and v.c != nil and v.own:
+    bcf_destroy(v.c)
+    v.c = nil
+  if v.p != nil:
+    free(v.p)
+
+proc destroy_format(f:Format) =
+  if f != nil and f.p != nil:
+    free(f.p)
+
 proc n_samples*(v:VCF): int {.inline.} =
   bcf_hdr_nsamples(v.header.hdr).int
 
@@ -175,15 +186,68 @@ proc remove_format*(h:Header, ID:string): Status =
   bcf_hdr_remove(h.hdr, BCF_HEADER_TYPE.BCF_HL_FMT.cint, ID.cstring)
   return Status(bcf_hdr_sync(h.hdr))
 
-proc info*(v:Variant): INFO {.inline, noInit.} =
-  discard bcf_unpack(v.c, BCF_UN_STR or BCF_UN_FLT or BCF_UN_INFO)
-  result = INFO(i:0, v:v)
+proc destroy_vcf(v:VCF) =
+  bcf_hdr_destroy(v.header.hdr)
+  if v.tidx != nil:
+    tbx_destroy(v.tidx)
+  if v.bidx != nil:
+    hts_idx_destroy(v.bidx)
+  if v.c != nil:
+    bcf_destroy(v.c)
+  if v.fname != "-" and v.fname != "/dev/stdin":
+    if v.hts != nil:
+      discard hts_close(v.hts)
+      v.hts = nil
+  else:
+    flushFile(stdout)
+
+var
+  errno* {.importc, header: "<errno.h>".}: cint
+
+proc strerror(errnum:cint): cstring {.importc, header: "<errno.h>", cdecl.}
+
+
+proc open*(v:var VCF, fname:string, mode:string="r", samples:seq[string]=empty_samples, threads:int=0): bool =
+  ## open a VCF at the given path
+  new(v, destroy_vcf)
+  var vmode = mode
+  if vmode[0] == 'w' and vmode.len == 1:
+    if fname.endswith(".gz"): vmode &= "z"
+    elif fname.endswith(".bcf"): vmode &= "b"
+
+  v.hts = hts_open(fname.cstring, vmode.cstring)
+  v.fname = fname
+  if v.hts == nil:
+    stderr.write_line "hts-nim/vcf: error opening file:" & fname & ". " & $strerror(errno)
+    return false
+
+  if mode[0] == 'w': return true
+
+  if mode[0] == 'r' and 0 != threads and 0 != hts_set_threads(v.hts, cint(threads)):
+    raise newException(ValueError, "error setting number of threads")
 
-proc destroy_format(f:Format) =
-  if f != nil and f.p != nil:
-    free(f.p)
 
-proc format*(v:Variant): FORMAT {.inline, noInit.} =
+  v.header = Header(hdr:bcf_hdr_read(v.hts))
+  if v.header.hdr == nil:
+    raise newException(OSError, &"[hts-nim/vcf] error reading VCF header from '{fname}'")
+  if samples.len != 0:
+    v.set_samples(samples)
+
+  v.c = bcf_init()
+
+  if v.c == nil:
+    stderr.write_line "hts-nim/vcf: error opening file:" & fname
+    return false
+
+  return true
+
+proc newVariant*(): Variant {.noInit.} =
+  ## make an empty variant.
+  new(result, destroy_variant)
+  result.c = bcf_init()
+  result.own = true
+
+proc format*(v:Variant): FORMAT {.inline.} =
   discard bcf_unpack(v.c, BCF_UN_ALL)
   new(result, destroy_format)
   result.v = v
@@ -396,44 +460,6 @@ proc set*(i:INFO, key:string, values:var seq[int32]): Status {.inline.} =
       values[0].addr.pointer, len(values).cint, BCF_HT_INT.cint)
   return Status(ret.int)
 
-proc destroy_variant(v:Variant) =
-  if v != nil and v.c != nil and v.own:
-    bcf_destroy(v.c)
-    v.c = nil
-  if v.p != nil:
-    free(v.p)
-
-proc from_string*(v: var Variant, h: Header, s:var string) =
-  var str = kstring_t(s:s.cstring, l:s.len.csize_t, m:s.len.csize_t)
-  if v == nil:
-    new(v, destroy_variant)
-    v.own = true
-  if v.c == nil:
-    v.c = bcf_init()
-  if vcf_parse(str.addr, h.hdr, v.c) != 0:
-   raise newException(ValueError, "hts-nim/Variant/from_string: error parsing variant:" & s)
-
-proc newVariant*(): Variant {.noInit.} =
-  ## make an empty variant.
-  new(result, destroy_variant)
-  result.c = bcf_init()
-  result.own = true
-
-proc destroy_vcf(v:VCF) =
-  bcf_hdr_destroy(v.header.hdr)
-  if v.tidx != nil:
-    tbx_destroy(v.tidx)
-  if v.bidx != nil:
-    hts_idx_destroy(v.bidx)
-  if v.c != nil:
-    bcf_destroy(v.c)
-  if v.fname != "-" and v.fname != "/dev/stdin":
-    if v.hts != nil:
-      discard hts_close(v.hts)
-      v.hts = nil
-  else:
-    flushFile(stdout)
-
 proc close*(v:VCF) =
   if v.fname != "-" and v.fname != "/dev/stdin" and v.hts != nil:
     if hts_close(v.hts) != 0:
@@ -469,44 +495,9 @@ proc write_variant*(v:VCF, variant:Variant): bool =
       doAssert bcf_hdr_sync(variant.vcf.header.hdr) == 0
   return bcf_write(v.hts, v.header.hdr, variant.c) == 0
 
-var
-  errno* {.importc, header: "<errno.h>".}: cint
-
-proc strerror(errnum:cint): cstring {.importc, header: "<errno.h>", cdecl.}
-
-proc open*(v:var VCF, fname:string, mode:string="r", samples:seq[string]=empty_samples, threads:int=0): bool =
-  ## open a VCF at the given path
-  new(v, destroy_vcf)
-  var vmode = mode
-  if vmode[0] == 'w' and vmode.len == 1:
-    if fname.endswith(".gz"): vmode &= "z"
-    elif fname.endswith(".bcf"): vmode &= "b"
-
-  v.hts = hts_open(fname.cstring, vmode.cstring)
-  v.fname = fname
-  if v.hts == nil:
-    stderr.write_line "hts-nim/vcf: error opening file:" & fname & ". " & $strerror(errno)
-    return false
-
-  if mode[0] == 'w': return true
-
-  if mode[0] == 'r' and 0 != threads and 0 != hts_set_threads(v.hts, cint(threads)):
-    raise newException(ValueError, "error setting number of threads")
-
-
-  v.header = Header(hdr:bcf_hdr_read(v.hts))
-  if v.header.hdr == nil:
-    raise newException(OSError, &"[hts-nim/vcf] error reading VCF header from '{fname}'")
-  if samples.len != 0:
-    v.set_samples(samples)
-
-  v.c = bcf_init()
-
-  if v.c == nil:
-    stderr.write_line "hts-nim/vcf: error opening file:" & fname
-    return false
-
-  return true
+proc info*(v:Variant): INFO {.inline, noInit.} =
+  discard bcf_unpack(v.c, BCF_UN_STR or BCF_UN_FLT or BCF_UN_INFO)
+  result = INFO(i:0, v:v)
 
 proc bcf_hdr_int2id(hdr: ptr bcf_hdr_t, typ: int, rid:int): cstring {.inline.} =
   var v = cast[CPtr[bcf_idpair_t]](hdr.id[typ])



View it on GitLab: https://salsa.debian.org/med-team/nim-hts/-/compare/e40e33e4b818cc3b84cd0d9db81fe711f5904afa...c55426fbe62fc683c616c3275671b9d4a927fd8f

-- 
View it on GitLab: https://salsa.debian.org/med-team/nim-hts/-/compare/e40e33e4b818cc3b84cd0d9db81fe711f5904afa...c55426fbe62fc683c616c3275671b9d4a927fd8f
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201126/f4a86687/attachment-0001.html>


More information about the debian-med-commit mailing list