[med-svn] [r-bioc-rtracklayer] 01/05: New upstream version 1.38.0

Andreas Tille tille at debian.org
Thu Nov 9 08:27:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository r-bioc-rtracklayer.

commit 6942ae96de55be6ccee15c932a02ce0e69ec36d2
Author: Andreas Tille <tille at debian.org>
Date:   Thu Nov 9 09:06:05 2017 +0100

    New upstream version 1.38.0
---
 DESCRIPTION              |  15 ++++++++-------
 NAMESPACE                |   2 +-
 R/bed.R                  |   5 +++--
 R/bigWig.R               |  18 ++++++++++++++++--
 R/browser.R              |   4 ++--
 R/chain.R                |  20 ++++++++++++++++++--
 R/gff.R                  |   3 +--
 R/ucsc.R                 |   7 ++++++-
 R/wig.R                  |  14 ++++++++++++--
 inst/doc/rtracklayer.pdf | Bin 311311 -> 311498 bytes
 inst/tests/test.bedGraph |  18 +++++++++---------
 man/BEDFile-class.Rd     |   1 +
 man/BigWigFile.Rd        |  21 ++++++++++++++++++---
 man/GFFFile-class.Rd     |   1 -
 man/GenomicData.Rd       |   1 -
 man/TwoBitFile-class.Rd  |   2 +-
 man/browseGenome.Rd      |   6 +++---
 man/export.Rd            |   1 -
 src/Makevars             |   2 +-
 src/Makevars.in          |   2 +-
 src/bigWig.c             |   5 +++--
 src/chain_io.c           |  11 ++++++-----
 src/ucsc/bPlusTree.c     |   4 +---
 src/ucsc/bbiRead.c       |   7 +++----
 src/ucsc/dnautil.c       |  28 +++++++++++++---------------
 src/ucsc/net.c           |   4 ++--
 src/ucsc/udc.c           |  12 +++++-------
 src/utils.c              |   1 -
 28 files changed, 134 insertions(+), 81 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index ab07c52..8d53031 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,13 +1,14 @@
 Package: rtracklayer
-Title: R interface to genome browsers and their annotation tracks
-Version: 1.36.6
+Title: R interface to genome annotation files and the UCSC genome
+        browser
+Version: 1.38.0
 Author: Michael Lawrence, Vince Carey, Robert Gentleman
 Depends: R (>= 3.3), methods, GenomicRanges (>= 1.21.20)
 Imports: XML (>= 1.98-0), BiocGenerics (>= 0.13.8), S4Vectors (>=
-        0.13.13), IRanges (>= 2.3.7), XVector (>= 0.9.4), GenomeInfoDb
-        (>= 1.3.14), Biostrings (>= 2.43.7), zlibbioc, RCurl (>=
-        1.4-2), Rsamtools (>= 1.17.8), GenomicAlignments (>= 1.5.4),
-        tools
+        0.13.13), IRanges (>= 2.11.12), XVector (>= 0.9.4),
+        GenomeInfoDb (>= 1.3.14), Biostrings (>= 2.43.7), zlibbioc,
+        RCurl (>= 1.4-2), Rsamtools (>= 1.17.8), GenomicAlignments (>=
+        1.5.4), tools
 Suggests: BSgenome (>= 1.33.4), humanStemCell, microRNA (>= 1.1.1),
         genefilter, limma, org.Hs.eg.db, hgu133plus2.db,
         GenomicFeatures, BSgenome.Hsapiens.UCSC.hg19,
@@ -27,4 +28,4 @@ Collate: io.R web.R ranges.R trackDb.R browser.R ucsc.R readGFF.R gff.R
         test_rtracklayer_package.R ncbi.R zzz.R
 biocViews: Annotation,Visualization,DataImport
 NeedsCompilation: yes
-Packaged: 2017-10-11 22:33:17 UTC; biocbuild
+Packaged: 2017-10-30 22:51:07 UTC; biocbuild
diff --git a/NAMESPACE b/NAMESPACE
index f0b7d23..a94fa36 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -64,7 +64,7 @@ exportClasses(BrowserSession, BrowserView, BrowserViewList,
               UCSCData, TrackLine, BasicTrackLine, GraphTrackLine,
               Bed15TrackLine, UCSCTrackModes, BigWigSelection,
               UCSCSchema, Quickload, QuickloadGenome,
-              GenomicRangesORGenomicRangesList)
+              GenomicRanges_OR_GenomicRangesList)
 
 ## File classes
 exportClasses(RTLFile, CompressedFile, GFFFile, UCSCFile, BEDFile, WIGFile,
diff --git a/R/bed.R b/R/bed.R
index 4198c09..b9f40f6 100644
--- a/R/bed.R
+++ b/R/bed.R
@@ -50,7 +50,7 @@ setMethod("export", c("ANY", "BEDFile"),
             if (class(track) == "try-error") {
               track <- try(as(object, "GenomicRangesList"), silent = TRUE)
               if (is(track, "try-error"))
-                stop("cannot export object of class '", cl, "': ", track)
+                stop("cannot export object of class '", cl, "'")
             }
             export(track, con, ...)
           })
@@ -300,7 +300,8 @@ setMethod("import", "BEDFile",
                                    presentClasses, "NULL")
               bed <- DataFrame(read.table(con, colClasses = bedClasses,
                                           as.is = TRUE, na.strings = ".",
-                                          comment.char = ""))
+                                          comment.char = "",
+                                          sep = "\t"))
             } else {
               if (is.null(colnames))
                 colnames <- character()
diff --git a/R/bigWig.R b/R/bigWig.R
index eaa40ad..82f5113 100644
--- a/R/bigWig.R
+++ b/R/bigWig.R
@@ -107,7 +107,7 @@ setMethod("export", c("GenomicRanges", "BigWigFile"),
             con <- path.expand(path(con))
             object <- sortBySeqnameAndStart(object)
             score <- score(object)
-            if (!is.numeric(score) || any(is.na(score)))
+            if (isValidScore(score))
               stop("The score must be numeric, without any NA's")
             if (!isTRUEorFALSE(compress))
               stop("'compress' must be TRUE or FALSE")
@@ -261,7 +261,8 @@ setMethod("import", "BigWigFile",
 setMethod("summary", "BigWigFile",
           function(object, which = as(seqinfo(object), "GenomicRanges"),
                    size = 1L, type = c("mean", "min", "max", "coverage", "sd"),
-                   defaultValue = NA_real_, asRle = FALSE, ...)
+                   defaultValue = NA_real_, asRle = FALSE,
+                   as = c("GRangesList", "RleList", "matrix"), ...)
           {
             ### FIXME: could do with "GenomicRanges" here, but
             ### coercions generally only exist for GRanges specifically
@@ -269,7 +270,17 @@ setMethod("summary", "BigWigFile",
             if (!is.numeric(size))
               stop("'size' must be numeric")
             size <- recycleIntegerArg(size, "size", length(which))
+            as <- match.arg(as)
+            if (any(size > width(which)) && as != "matrix")
+              stop("some 'which' are smaller than 'size'; ",
+                   "consider passing as='matrix'")
+            if (as == "matrix" && (length(size) == 0L || any(size != size[1L])))
+                stop("for as='matrix', there must be one unique 'size'")
             type <- match.arg(type)
+            if (!missing(asRle))
+              warning("argument asRle is deprecated; use as='RleList'")
+            if (asRle)
+              as <- "RleList"
             if (type == "sd") type <- "std"
             if (!isSingleNumberOrNA(defaultValue))
               stop("'defaultValue' must be a single number or NA")
@@ -277,6 +288,9 @@ setMethod("summary", "BigWigFile",
                                  as.character(seqnames(which)),
                                  ranges(which), size, type,
                                  as.numeric(defaultValue))
+            if (as == "matrix") {
+                return(do.call(rbind, summaryList))
+            }
             tiles <- tile(which, n = size)
             if (asRle) {
               setNames(RleList(mapply(Rle, summaryList, as.list(width(tiles))),
diff --git a/R/browser.R b/R/browser.R
index d9e1b6f..7d36d4c 100644
--- a/R/browser.R
+++ b/R/browser.R
@@ -136,10 +136,10 @@ setGeneric("browseGenome",
 setMethod("browseGenome", "missing",
           function(object, ...) browseGenome(GenomicRangesList(), ...))
 
-setClassUnion("GenomicRangesORGenomicRangesList",
+setClassUnion("GenomicRanges_OR_GenomicRangesList",
               c("GenomicRanges", "GenomicRangesList"))
 
-setMethod("browseGenome", "GenomicRangesORGenomicRangesList",
+setMethod("browseGenome", "GenomicRanges_OR_GenomicRangesList",
           function(object, browser = "UCSC",
                    range = base::range(object), view = TRUE,
                    trackParams = list(), viewParams = list(),
diff --git a/R/chain.R b/R/chain.R
index b67fff3..cc309d7 100644
--- a/R/chain.R
+++ b/R/chain.R
@@ -42,6 +42,7 @@ setMethod("import.chain", "ANY", function(con, ...) {
 setMethod("import", "ChainFile", function(con, format, text, exclude = "_") {
   if (!missing(format))
     checkArgFormat(con, format)
+  ### FIXME: use readLines() to read the file, parse lines in C
   if (!is(connection(con), "file")) {
     stop("chain import currently only handles local, uncompressed files")
   }
@@ -53,7 +54,9 @@ setMethod("import", "ChainFile", function(con, format, text, exclude = "_") {
 ### Accessors
 ###
 
-setMethod("ranges", "ChainBlock", function(x) x at ranges)
+setMethod("ranges", "ChainBlock",
+    function(x, use.names=TRUE, use.mcols=FALSE) x at ranges
+)
 setMethod("offset", "ChainBlock", function(object) object at offset)
 setMethod("score", "ChainBlock", function(x) Rle(x at score, x at length))
 setMethod("space", "ChainBlock", function(x) Rle(x at space, x at length))
@@ -81,6 +84,19 @@ flipStrandTricky <- function(strand, flip) {
   strandRevCodes[as.vector(flipped)]
 }
 
+smoothGaps <- function(qhits, ranges, offsets) {
+    congruent_gaps <- width(gaps(ranges)) == abs(offsets)
+    congruent_gaps_rle <- Rle(congruent)
+    congruent_rle <- c(Rle(FALSE), congruent_gaps_rle)
+    group_rle <- Rle(cumsum(!congruent_rle))
+    group_ranges <- disjoin(ranges(Rle(qhits)), ranges(group_rle))
+    ans <- range(relist(ranges, group_ranges))
+    mcols(ans)$qhits <- qhits[start(group_ranges)]
+    mcols(ans)$offsets <- offsets[start(group_ranges)]
+    ans
+}
+
+
 setGeneric("liftOver", function(x, chain, ...) standardGeneric("liftOver"))
 setMethod("liftOver", c("GenomicRanges", "Chain"),
           function(x, chain)
@@ -89,7 +105,7 @@ setMethod("liftOver", c("GenomicRanges", "Chain"),
               r <- ranges(gr)
               ol <- findOverlaps(r, ranges(chain))
               shits <- subjectHits(ol)
-              r <- ranges(ol, r, ranges(chain))
+              r <- overlapsRanges(r, ranges(chain), ol)
               rev <- as.vector(reversed(chain)[shits])
               starts <- ifelse(rev,
                                start(reflect(r, ranges(chain)[shits])),
diff --git a/R/gff.R b/R/gff.R
index 6fd32d6..1716a77 100644
--- a/R/gff.R
+++ b/R/gff.R
@@ -61,8 +61,7 @@ setMethod("export", c("ANY", "GFFFile"),
             if (is(res, "try-error")) {
               res <- try(as(object, "GenomicRangedDataList"), silent = TRUE)
               if (is(res, "try-error"))
-                stop("cannot export object of class '", class(object), "': ",
-                     res)
+                stop("cannot export object of class '", class(object), "'")
             }
             object <- res
             if (!missing(format))
diff --git a/R/ucsc.R b/R/ucsc.R
index a039a30..94f2338 100644
--- a/R/ucsc.R
+++ b/R/ucsc.R
@@ -297,8 +297,13 @@ ucscTableGet <- function(query, .parse = TRUE, tracks = FALSE, ...)
   ucscGet(browserSession(query), "tables",
           c(ucscForm(query, tracks = tracks), ...), .parse = .parse)
 
+dropCookie <- function(object) {
+    object at hguid <- character()
+    object
+}
+
 ucscTablePost <- function(query, .parse = TRUE, tracks = FALSE, ...)
-  ucscPost(browserSession(query), "tables",
+  ucscPost(dropCookie(browserSession(query)), "tables",
            c(ucscForm(query, tracks = tracks), list(...)), .parse = .parse)
 
 ## gets the track names available from the table browser
diff --git a/R/wig.R b/R/wig.R
index 909d1ed..f56e812 100644
--- a/R/wig.R
+++ b/R/wig.R
@@ -58,6 +58,11 @@ setMethod("export", c("ANY", "WIGFile"),
               row.names = FALSE, quote = FALSE)
 }
 
+isValidScore <- function(score) {
+    !(is.numeric(score) || is(score, "Rle") && is.numeric(runValue(score))) ||
+        any(is.na(score))
+}
+
 setMethod("export", c("GenomicRanges", "WIGFile"),
           function(object, con, format,
                    dataFormat = c("auto", "variableStep", "fixedStep"),
@@ -65,7 +70,7 @@ setMethod("export", c("GenomicRanges", "WIGFile"),
           {
             if (!missing(format))
               checkArgFormat(con, format)
-            if (!is.numeric(score(object)) || any(is.na(score(object))))
+            if (isValidScore(score(object)))
               stop("The score must be numeric, without any NA's")
             scipen <- getOption("scipen")
             options(scipen = 100) # prevent use of scientific notation
@@ -73,7 +78,12 @@ setMethod("export", c("GenomicRanges", "WIGFile"),
             dataFormat <- match.arg(dataFormat)            
             doBlock <- function(chromData) {
               if (length(chromData) == 0L)
-                return()
+                  return()
+              if (is(chromData, "GPos")) {
+                  ans <- writer(chromData, con, "fixedStep", append)
+                  append <<- TRUE
+                  return(ans)
+              }
               if (is.unsorted(start(chromData)))
                 chromData <- chromData[order(start(chromData)),]
               starts <- start(chromData)
diff --git a/inst/doc/rtracklayer.pdf b/inst/doc/rtracklayer.pdf
index 17aa4a3..76dddd8 100644
Binary files a/inst/doc/rtracklayer.pdf and b/inst/doc/rtracklayer.pdf differ
diff --git a/inst/tests/test.bedGraph b/inst/tests/test.bedGraph
index c1b0963..9e0a29d 100644
--- a/inst/tests/test.bedGraph
+++ b/inst/tests/test.bedGraph
@@ -1,10 +1,10 @@
 track type=bedGraph name="bedGraph track" description="Test" visibility=full color=200,100,0 altColor=0,100,200 gridDefault=Off priority=20 alwaysZero=On yLineMark=10 windowingFunction="mean"
-chr19 59102000 59102300 -1.0
-chr19 59102300 59102600 -0.75
-chr19 59102600 59102900 -0.50
-chr19 59102900 59103200 -0.25
-chr19 59103200 59103500 0.0
-chr19 59103500 59103800 0.25
-chr17 59103800 59104100 0.50
-chr18 59104100 59104400 0.75
-chr18 59104400 59104700 1.00
+chr19	59102000	59102300	-1.0
+chr19	59102300	59102600	-0.75
+chr19	59102600	59102900	-0.50
+chr19	59102900	59103200	-0.25
+chr19	59103200	59103500	0.0
+chr19	59103500	59103800	0.25
+chr17	59103800	59104100	0.50
+chr18	59104100	59104400	0.75
+chr18	59104400	59104700	1.00
diff --git a/man/BEDFile-class.Rd b/man/BEDFile-class.Rd
index ac7b134..34cd758 100644
--- a/man/BEDFile-class.Rd
+++ b/man/BEDFile-class.Rd
@@ -36,6 +36,7 @@
 \alias{export,GenomicRanges,BED15File,ANY-method}
 \alias{export,ANY,BEDPEFile,ANY-method}
 \alias{export,Pairs,BEDPEFile,ANY-method}
+\alias{export,UCSCData,BED15File,ANY-method}
 \alias{export.bed}
 \alias{export.bed,ANY-method}
 \alias{export.bed15}
diff --git a/man/BigWigFile.Rd b/man/BigWigFile.Rd
index 960a110..80605c4 100644
--- a/man/BigWigFile.Rd
+++ b/man/BigWigFile.Rd
@@ -32,6 +32,7 @@
 %% Utilites:
 \alias{summary,BigWigFile-method}
 \alias{path,BigWigFileList-method}
+\alias{cleanupBigWigCache}
 
 \title{BigWig Import and Export}
 
@@ -142,7 +143,9 @@ export.bw(object, con, ...)
     \item{}{
       \code{summary(ranges = as(seqinfo(object), "GenomicRanges"), size
         = 1L, type = c("mean", "min", "max", "coverage", "sd"),
-        defaultValue = NA_real_), ...}: Aggregates the intervals in the file
+        defaultValue = NA_real_),
+	as = c("GRangesList", "RleList", "matrix"), ...}:
+        Aggregates the intervals in the file
         that fall into \code{ranges}, which should be something
         coercible to \code{GRanges}.  The aggregation essentially
         compresses each sequence to a length of \code{size}. The
@@ -150,8 +153,14 @@ export.bw(object, con, ...)
         include the mean, min, max, coverage (percent sequence covered
         by at least one feature), and standard deviation. When a window
         contains no features, \code{defaultValue} is assumed. The result
-        is an \code{\link[IRanges:RleList-class]{RleList}}, with an
-        element for each element in \code{ranges}. The
+        type depends on \code{as}, and can be a GRangesList, RleList or
+        matrix, where the number elements (or rows) is equal to the
+        length of \code{ranges}. For \code{as="matrix"}, there must be
+        one unique value of \code{size}, which is equal to the number of
+        columns in the result. The \code{as="matrix"} case is the only
+        one that supports a \code{size} greater than the width of the
+        corresponding element in \code{ranges}, where values are
+	interpolated to yield the matrix result. The
         driving use case for this is visualization of coverage when the
         screen space is small compared to the viewed portion of the
         sequence. The operation is very fast, as it leverages cached
@@ -162,6 +171,11 @@ export.bw(object, con, ...)
         \code{NA_real_} is returned.
     }
   }
+
+  When accessing remote data, the UCSC library caches data in the
+  \file{/tmp/udcCache} directory. To clean the cache, call
+  \code{cleanBigWigCache(maxDays)}, where any files older than
+  \code{maxDays} days old will be deleted.
 }
 
 \section{\code{BigWigFileList} objects}{
@@ -214,6 +228,7 @@ if (.Platform$OS.type != "windows") {
   summary(bwf, range(head(track))) # just average the first few features
   summary(bwf, size = seqlengths(bwf) / 10) # 10X reduction
   summary(bwf, type = "min") # min instead of mean
+  summary(bwf, track, size = 10, as = "matrix") # each feature 10 windows
 }
 }
 
diff --git a/man/GFFFile-class.Rd b/man/GFFFile-class.Rd
index 12a01f5..06e7c8b 100644
--- a/man/GFFFile-class.Rd
+++ b/man/GFFFile-class.Rd
@@ -287,7 +287,6 @@ export.gff3(object, con, ...)
   ## from connection
   test_gff_con <- file(test_gff3)
   test <- import(test_gff_con, format = "gff")
-  close(test_gff_con)
 
   ## various arguments
   import(test_gff3, genome = "hg19")
diff --git a/man/GenomicData.Rd b/man/GenomicData.Rd
index 2f16622..f122eff 100644
--- a/man/GenomicData.Rd
+++ b/man/GenomicData.Rd
@@ -9,7 +9,6 @@
 \alias{chrom<-}
 \alias{chrom<-,GRanges-method}
 \alias{score,ANY-method}
-\alias{score,GenomicRangesORGRangesList-method}
 
 \title{Data on a Genome}
 
diff --git a/man/TwoBitFile-class.Rd b/man/TwoBitFile-class.Rd
index a0ac429..aa59a18 100644
--- a/man/TwoBitFile-class.Rd
+++ b/man/TwoBitFile-class.Rd
@@ -42,7 +42,7 @@
 \usage{
 \S4method{import}{TwoBitFile,ANY,ANY}(con, format, text,
            which = as(seqinfo(con), "GenomicRanges"), ...)
-\S4method{getSeq}{TwoBitFile}(x, which = as(seqinfo(con), "GenomicRanges"))
+\S4method{getSeq}{TwoBitFile}(x, which = as(seqinfo(x), "GenomicRanges"))
 import.2bit(con, ...)
 
 \S4method{export}{ANY,TwoBitFile,ANY}(object, con, format, ...)
diff --git a/man/browseGenome.Rd b/man/browseGenome.Rd
index 2dcc266..b0a0242 100644
--- a/man/browseGenome.Rd
+++ b/man/browseGenome.Rd
@@ -1,7 +1,7 @@
 \name{browseGenome}
 \alias{browseGenome}
-\alias{GenomicRangesORGenomicRangesList-class}
-\alias{browseGenome,GenomicRangesORGenomicRangesList-method}
+\alias{GenomicRanges_OR_GenomicRangesList-class}
+\alias{browseGenome,GenomicRanges_OR_GenomicRangesList-method}
 \alias{browseGenome,missing-method}
 \title{ Browse a genome }
 \description{
@@ -9,7 +9,7 @@
 }
 \usage{
 browseGenome(object, ...)
-\S4method{browseGenome}{GenomicRangesORGenomicRangesList}(object,
+\S4method{browseGenome}{GenomicRanges_OR_GenomicRangesList}(object,
   browser = "UCSC", range = base::range(object),
   view = TRUE, trackParams = list(), viewParams = list(),
   name = "customTrack", ...)
diff --git a/man/export.Rd b/man/export.Rd
index 1841b27..c91451f 100644
--- a/man/export.Rd
+++ b/man/export.Rd
@@ -173,7 +173,6 @@ import(con, format, text, ...)
   \dontrun{
   con <- file("my.gff3")
   export(track, con, "gff3")
-  close(con)
   }
   ## or as a string
   export(track, format = "gff3")
diff --git a/src/Makevars b/src/Makevars
index 60b0895..70cbc0c 100644
--- a/src/Makevars
+++ b/src/Makevars
@@ -1,7 +1,7 @@
 include Makevars.common
 OBJECTS = $(PKG_OBJECTS) $(UCSC_OBJECTS:%=ucsc/%)
 PKG_LIBS=-lz -pthread -lssl -lcrypto
-PKG_CPPFLAGS+= -DUSE_SSL -D_FILE_OFFSET_BITS=64
+PKG_CPPFLAGS= -DUSE_SSL -D_FILE_OFFSET_BITS=64
 all: $(SHLIB)
 
 clean:
diff --git a/src/Makevars.in b/src/Makevars.in
index 61dd21d..6fba84e 100644
--- a/src/Makevars.in
+++ b/src/Makevars.in
@@ -1,7 +1,7 @@
 include Makevars.common
 OBJECTS = $(PKG_OBJECTS) $(UCSC_OBJECTS:%=ucsc/%)
 PKG_LIBS=-lz -pthread @OPENSSL_LIBS@
-PKG_CPPFLAGS+=@OPENSSL_CFLAGS@ @SSL_CPPFLAGS@ -D_FILE_OFFSET_BITS=64
+PKG_CPPFLAGS=@OPENSSL_CFLAGS@ @SSL_CPPFLAGS@ -D_FILE_OFFSET_BITS=64
 all: $(SHLIB)
 
 clean:
diff --git a/src/bigWig.c b/src/bigWig.c
index 2c67f5f..7092791 100644
--- a/src/bigWig.c
+++ b/src/bigWig.c
@@ -242,8 +242,9 @@ SEXP BWGFile_query(SEXP r_filename, SEXP r_ranges, SEXP r_return_score,
   SEXP chromNames = getAttrib(r_ranges, R_NamesSymbol);
   int nchroms = length(r_ranges);
   Rboolean return_list = asLogical(r_return_list);
-  SEXP rangesList, rangesListEls, dataFrameList, dataFrameListEls, ans;
-  SEXP numericListEls;
+  SEXP rangesList, rangesListEls = NULL, dataFrameList,
+      dataFrameListEls = NULL, ans;
+  SEXP numericListEls = NULL;
   bool returnScore = asLogical(r_return_score);
   const char *var_names[] = { "score", "" };
   struct lm *lm = lmInit(0);
diff --git a/src/chain_io.c b/src/chain_io.c
index eae86a4..1f31ecc 100644
--- a/src/chain_io.c
+++ b/src/chain_io.c
@@ -31,12 +31,12 @@ ChainBlock **read_chain_file(FILE *stream, const char *exclude, int *nblocks) {
   char linebuf[LINEBUF_SIZE];
   char *header[HEADER_SIZE];
   char *data[DATA_SIZE];
-  int tstart, qstart;
-  Rboolean new_block = TRUE, excluded = FALSE, trc, qrc;
-  ChainBlock *block, **result;
+  int tstart = 0, qstart = 0;
+  Rboolean new_block = TRUE, excluded = FALSE, trc = FALSE, qrc = FALSE;
+  ChainBlock *block = NULL, **result = NULL;
   struct hash *hash = hashNew(6);
   struct hashEl *hash_elements;
-  int line = 0, i = 0, header_line;
+  int line = 0, i = 0, header_line = 0;
   while (fgets(linebuf, LINEBUF_SIZE, stream) != NULL) {
     line++;
     if (strlen(linebuf) == LINEBUF_SIZE - 1) {
@@ -116,7 +116,8 @@ ChainBlock **read_chain_file(FILE *stream, const char *exclude, int *nblocks) {
         IntAE_insert_at(block->length, IntAE_get_nelt(block->length),
                         line-header_line);
         //Rprintf("end of %s block, line: %d\n", block->name, line);
-        fgets(linebuf, LINEBUF_SIZE, stream); /* skip empty line */
+        if (fgets(linebuf, LINEBUF_SIZE, stream) == NULL) /* skip empty line */
+	    error("incomplete block");
         line++;
       }
     }
diff --git a/src/ucsc/bPlusTree.c b/src/ucsc/bPlusTree.c
index 6b09e15..1ecd2d0 100644
--- a/src/ucsc/bPlusTree.c
+++ b/src/ucsc/bPlusTree.c
@@ -283,14 +283,12 @@ for (;;)
     /* Read block header,  break if we are leaf. */
     UBYTE isLeaf;
     UBYTE reserved;
-    bits16 childCount;
     udcMustReadOne(bpt->udc, isLeaf);
     if (isLeaf)
          break;
     udcMustReadOne(bpt->udc, reserved);
     boolean isSwapped = bpt->isSwapped;
-    childCount = udcReadBits16(bpt->udc, isSwapped);
-
+    udcReadBits16(bpt->udc, isSwapped);
     /* Read and discard first key. */
     char keyBuf[bpt->keySize];
     udcMustRead(bpt->udc, keyBuf, bpt->keySize);
diff --git a/src/ucsc/bbiRead.c b/src/ucsc/bbiRead.c
index 2e7188a..c940003 100644
--- a/src/ucsc/bbiRead.c
+++ b/src/ucsc/bbiRead.c
@@ -745,10 +745,9 @@ else if (bbi->version == 1)
 	for (i=0; i<zoomSectionCount; ++i)
 	    {
 	    /* Read, but ignore, position. */
-	    bits32 chromId, chromStart, chromEnd;
-	    chromId = udcReadBits32(udc, isSwapped);
-	    chromStart = udcReadBits32(udc, isSwapped);
-	    chromEnd = udcReadBits32(udc, isSwapped);
+	    udcReadBits32(udc, isSwapped);
+	    udcReadBits32(udc, isSwapped);
+	    udcReadBits32(udc, isSwapped);
 
 	    /* First time through set values, rest of time add to them. */
 	    if (i == 0)
diff --git a/src/ucsc/dnautil.c b/src/ucsc/dnautil.c
index 7d8a665..cb3a30d 100644
--- a/src/ucsc/dnautil.c
+++ b/src/ucsc/dnautil.c
@@ -474,6 +474,19 @@ temp = *pStart;
 *pEnd = size - temp;
 }
 
+boolean isAllNt(char *seq, int size)
+/* Return TRUE if all letters in seq are ACGTNU-. */
+{
+    int i;
+    dnaUtilOpen();
+    for (i=0; i<size-1; ++i)
+	{
+	    if (ntChars[(int)seq[i]] == 0)
+		return FALSE;
+	}
+    return TRUE;
+}
+
 char *reverseComplementSlashSeparated(char *alleleStr)
 /* Given a slash-separated series of sequences (a common representation of variant alleles),
  * returns a slash-sep series with the reverse complement of each sequence (if it is a
@@ -974,7 +987,6 @@ int i;
 int score = 10;
 int bestScore = 10;
 int bestPos = -1;
-int pastPoly = 0;
 int trimSize = 0;
 
 for (i=0; i<size; ++i)
@@ -1003,7 +1015,6 @@ for (i=0; i<size; ++i)
 	}
     if (score < 0)
 	{
-	pastPoly = i;
         break;
 	}
     }
@@ -1052,19 +1063,6 @@ for (i=0; i<size; ++i)
 return (dnaCount >= round(0.9 * size));
 }
 
-boolean isAllNt(char *seq, int size)
-/* Return TRUE if all letters in seq are ACGTNU-. */
-{
-int i;
-dnaUtilOpen();
-for (i=0; i<size-1; ++i)
-    {
-    if (ntChars[(int)seq[i]] == 0)
-	return FALSE;
-    }
-return TRUE;
-}
-
 boolean isAllDna(char *poly, int size)
 /* Return TRUE if size is great than 1 and letters in poly are 100% ACGTNU- */
 {
diff --git a/src/ucsc/net.c b/src/ucsc/net.c
index d40c12d..cf5d8e8 100644
--- a/src/ucsc/net.c
+++ b/src/ucsc/net.c
@@ -1445,8 +1445,8 @@ while(TRUE)
 	}
     if (startsWith("HTTP/", line))
         {
-	char *version, *code;
-	version = nextWord(&line);
+	char *code;
+	nextWord(&line);
 	code = nextWord(&line);
 	if (code == NULL)
 	    {
diff --git a/src/ucsc/udc.c b/src/ucsc/udc.c
index a868a4f..24a6938 100644
--- a/src/ucsc/udc.c
+++ b/src/ucsc/udc.c
@@ -566,19 +566,17 @@ if (magic != udcBitmapSig)
     }
 
 /* Allocate bitmap object, fill it in, and return it. */
-bits32 reserved32;
-bits64 reserved64;
 struct udcBitmap *bits;
 AllocVar(bits);
 bits->blockSize = fdReadBits32(fd, isSwapped);
 bits->remoteUpdate = fdReadBits64(fd, isSwapped);
 bits->fileSize = fdReadBits64(fd, isSwapped);
 bits->version = fdReadBits32(fd, isSwapped);
-reserved32 = fdReadBits32(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
-reserved64 = fdReadBits64(fd, isSwapped);
+fdReadBits32(fd, isSwapped);
+fdReadBits64(fd, isSwapped);
+fdReadBits64(fd, isSwapped);
+fdReadBits64(fd, isSwapped);
+fdReadBits64(fd, isSwapped);
 bits->localUpdate = status.st_mtime;
 bits->localAccess = status.st_atime;
 bits->isSwapped = isSwapped;
diff --git a/src/utils.c b/src/utils.c
index 50e57c0..0a8bdb7 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1,7 +1,6 @@
 #include "utils.h"
 
 SEXP _STRSXP_collapse(SEXP x, SEXP sep) {
-  SEXP ans;
   int len = 0;
   char *collapsed, *dest;
   char c_sep = CHAR(STRING_ELT(sep, 0))[0];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-bioc-rtracklayer.git



More information about the debian-med-commit mailing list