Skip to content

Commit

Permalink
Merge branch 'release/v1.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
CiaranOMara committed Jan 15, 2020
2 parents d4a5c80 + 2543d77 commit e7ce4e3
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 144 deletions.
37 changes: 25 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,50 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [1.0.3]
## [1.0.4] - 2020-01-15
### Changed
- General housekeeping (code).

## [1.0.3] - 2020-01-07
### Changed
- Add ColorTypes "0.9" to compat.
- Add FixedPointNumbers "0.7" to compat.

### Fixed
- CompatHelper configuration.

## [1.0.2]
## [1.0.2] - 2020-01-07
### Fixed
- Corrected typo in Strand constructor.

## [1.0.1]
## [1.0.1] - 2020-01-04 (yanked)
### Changed
- General housekeeping.

## [1.0.0]
- Version 1.0 updates ([#15](https://github.com/BioJulia/GenomicFeatures.jl/pull/15))
## [1.0.0] - 2018-09-10
### Added
- Issue and PR templates.
- Code of Conduct and Contributing files.
- Support for julia v0.7 and v1.0.

### Removed
- :exclamation: Support for julia prior to v0.7.

## [0.2.1]
## [0.2.1] - 2017-06-27
### Added
- Read and write methods for Strand ([#4](https://github.com/BioJulia/GenomicFeatures.jl/pull/4)).
- Read and write methods for Strand type ([#4](https://github.com/BioJulia/GenomicFeatures.jl/pull/4)).

## [0.2.0]
## [0.2.0] - 2017-06-25
### Added
- Optional filter functions to `eachoverlap`, and a `findfirst` function ([#3](https://github.com/BioJulia/GenomicFeatures.jl/pull/3)).

## [0.1.0]
- Move code from Bio.jl.
- Add support for GFF3 and BigWig.
## [0.1.0] - 2017-06-17
### Added
- Code from Bio.jl.
- Support for GFF3 and BigWig.

[Unreleased]: https://github.com/BioJulia/GenomicFeatures.jl/compare/v1.0.3...HEAD
[Unreleased]: https://github.com/BioJulia/GenomicFeatures.jl/compare/v1.0.4...HEAD
[1.0.4]: https://github.com/BioJulia/GenomicFeatures.jl/compare/v1.0.3...v1.0.4
[1.0.3]: https://github.com/BioJulia/GenomicFeatures.jl/compare/v1.0.2...v1.0.3
[1.0.2]: https://github.com/BioJulia/GenomicFeatures.jl/compare/v1.0.1...v1.0.2
[1.0.1]: https://github.com/BioJulia/GenomicFeatures.jl/compare/v1.0.0...v1.0.1
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GenomicFeatures"
uuid = "899a7d2d-5c61-547b-bef9-6698a8d05446"
authors = ["Kenta Sato <[email protected]>", "Ben J. Ward <[email protected]>", "Ciarán O’Mara <[email protected]>"]
version = "1.0.3"
version = "1.0.4"

[deps]
Automa = "67c07d97-cdcb-5c2c-af73-a7f9c32a568b"
Expand Down
3 changes: 1 addition & 2 deletions src/bbi/bbi.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# BBI - Shared Parts of bigWig and bigBed
# =======================================
#
# Detailed description of bigWig and bigBed file formats are found in the paper
# and its supplement:
# Detailed description of bigWig and bigBed file formats are found in the paper and its supplement:
# https://doi.org/10.1093/bioinformatics/btq351
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2922891/bin/supp_btq351_bbiSuppFINAL.doc
#
Expand Down
3 changes: 1 addition & 2 deletions src/bbi/btree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ function chromlist(tree::BTree)
end

function write_btree(stream::IO, chromlist::Vector{Tuple{String,UInt32,UInt32}})
# This function stores all chromosomes in the root node as a leaf because it
# is simple to implement.
# This function stores all chromosomes in the root node as a leaf because it is simple to implement.
blksize = length(chromlist)
keysize = Base.maximum(sizeof(name) for (name, _) in chromlist)
valsize = 8
Expand Down
16 changes: 8 additions & 8 deletions src/bigwig/stats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
Compute the coverage of values in `[chromstart, chromend]` of `chrom`.
If `usezoom` is `true`, this function tries to use precomputed statistics (zoom)
in the file. This is often faster but not exact in most cases.
If `usezoom` is `true`, this function tries to use precomputed statistics (zoom) in the file.
This is often faster but not exact in most cases.
"""
function coverage(reader::Reader, chrom::AbstractString, chromstart::Integer, chromend::Integer; usezoom=false)::Int
chromid = reader.chroms[chrom][1]
Expand All @@ -34,8 +34,8 @@ end
Compute the mean of values in `[chromstart, chromend]` of `chrom`.
This function returns `NaN32` if there are no data in that range. See `coverage`
for the `usezoom` keyword argument.
This function returns `NaN32` if there are no data in that range.
See `coverage` for the `usezoom` keyword argument.
"""
function mean(reader::Reader, chrom::AbstractString, chromstart::Integer, chromend::Integer; usezoom=false)::Float32
chromid = reader.chroms[chrom][1]
Expand Down Expand Up @@ -66,8 +66,8 @@ end
Compute the minimum of values in `[chromstart, chromend]` of `chrom`.
This function returns `NaN32` if there are no data in that range. See `coverage`
for the `usezoom` keyword argument.
This function returns `NaN32` if there are no data in that range.
See `coverage` for the `usezoom` keyword argument.
"""
function minimum(reader::Reader, chrom::AbstractString, chromstart::Integer, chromend::Integer; usezoom=false)::Float32
chromid = reader.chroms[chrom][1]
Expand All @@ -86,8 +86,8 @@ end
Compute the maximum of values in `[chromstart, chromend]` of `chrom`.
This function returns `NaN32` if there are no data in that range. See `coverage`
for the `usezoom` keyword argument.
This function returns `NaN32` if there are no data in that range.
See `coverage` for the `usezoom` keyword argument.
"""
function maximum(reader::Reader, chrom::AbstractString, chromstart::Integer, chromend::Integer; usezoom=false)::Float32
chromid = reader.chroms[chrom][1]
Expand Down
26 changes: 8 additions & 18 deletions src/coverage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
"""
coverage(intervals)
Compute the coverage of a collection of intervals and return an
`IntervalCollection` that contains run-length encoded coverage data.
Compute the coverage of a collection of intervals and return an `IntervalCollection` that contains run-length encoded coverage data.
For example, given intervals like:
[------] [------------]
[---------------]
This function would return a new set of disjoint intervals with annotated
coverage like:
This function would return a new set of disjoint intervals with annotated coverage like:
[1][-2-][-1-][--2--][--1--]
"""
Expand All @@ -40,8 +38,7 @@ function coverage(stream, seqname_isless::Function=isless)

while true
if interval.seqname != coverage_seqname
coverage_process_lasts_heap!(cov, current_coverage, coverage_seqname,
coverage_first, lasts)
coverage_process_lasts_heap!(cov, current_coverage, coverage_seqname, coverage_first, lasts)
if !(isempty(coverage_seqname) || seqname_isless(coverage_seqname, interval.seqname))
error("Intervals must be sorted to compute coverage.")
end
Expand Down Expand Up @@ -70,8 +67,7 @@ function coverage(stream, seqname_isless::Function=isless)
current_coverage -= 1
else
@assert pos >= coverage_first
push!(cov, Interval{UInt32}(coverage_seqname, coverage_first,
pos, STRAND_BOTH, current_coverage))
push!(cov, Interval{UInt32}(coverage_seqname, coverage_first, pos, STRAND_BOTH, current_coverage))
current_coverage -= 1
coverage_first = pos + 1
end
Expand All @@ -83,9 +79,7 @@ function coverage(stream, seqname_isless::Function=isless)
current_coverage += 1
else
if current_coverage > 0
push!(cov, Interval{UInt32}(coverage_seqname, coverage_first,
first(interval) - 1, STRAND_BOTH,
current_coverage))
push!(cov, Interval{UInt32}(coverage_seqname, coverage_first, first(interval) - 1, STRAND_BOTH, current_coverage))
end
current_coverage += 1
coverage_first = first(interval)
Expand All @@ -101,8 +95,7 @@ function coverage(stream, seqname_isless::Function=isless)
end
end

coverage_process_lasts_heap!(cov, current_coverage, coverage_seqname,
coverage_first, lasts)
coverage_process_lasts_heap!(cov, current_coverage, coverage_seqname, coverage_first, lasts)

return cov
end
Expand All @@ -113,17 +106,14 @@ end

# Helper function for coverage. Process remaining interval end points after
# all intervals have been read.
function coverage_process_lasts_heap!(cov::IntervalCollection{UInt32},
current_coverage, coverage_seqname,
coverage_first, lasts)
function coverage_process_lasts_heap!(cov::IntervalCollection{UInt32}, current_coverage, coverage_seqname, coverage_first, lasts)
while !isempty(lasts)
pos = DataStructures.heappop!(lasts)
if pos == coverage_first - 1
current_coverage -= 1
else
@assert pos >= coverage_first
push!(cov, Interval{UInt32}(coverage_seqname, coverage_first,
pos, STRAND_BOTH, current_coverage))
push!(cov, Interval{UInt32}(coverage_seqname, coverage_first, pos, STRAND_BOTH, current_coverage))
current_coverage -= 1
coverage_first = pos + 1
end
Expand Down
16 changes: 6 additions & 10 deletions src/gff3/reader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ end
Create a reader for data in GFF3 format.
The first argument specifies the data source. When it is a filepath that ends
with *.bgz*, it is considered to be block compression file format (BGZF) and the
function will try to find a tabix index file (<filename>.tbi) and read it if
any. See <http://www.htslib.org/doc/tabix.html> for bgzip and tabix tools.
The first argument specifies the data source.
When it is a filepath that ends with *.bgz*, it is considered to be block compression file format (BGZF) and the function will try to find a tabix index file (<filename>.tbi) and read it if any.
See <http://www.htslib.org/doc/tabix.html> for bgzip and tabix tools.
Arguments
---------
Expand Down Expand Up @@ -129,11 +128,9 @@ end


"""
Return all directives that preceded the last GFF entry parsed as an array of
strings.
Return all directives that preceded the last GFF entry parsed as an array of strings.
Directives at the end of the file can be accessed by calling `close(reader)`
and then `directives(reader)`.
Directives at the end of the file can be accessed by calling `close(reader)` and then `directives(reader)`.
"""
function directives(reader::Reader)
ret = String[]
Expand All @@ -157,8 +154,7 @@ end
"""
Return a BioSequences.FASTA.Reader initialized to parse trailing FASTA data.
Throws an exception if there is no trailing FASTA, which can be checked using
`hasfasta`.
Throws an exception if there is no trailing FASTA, which can be checked using `hasfasta`.
"""
function getfasta(reader::Reader)
if !hasfasta(reader)
Expand Down
3 changes: 2 additions & 1 deletion src/gff3/record.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ end
"""
content(record::Record)::String
Get the content of `record`. Leading '#' letters are removed.
Get the content of `record`.
Leading '#' letters are removed.
"""
function content(record::Record)
checkfilled(record)
Expand Down
3 changes: 1 addition & 2 deletions src/indexes/bgzfindex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#
# An index type for BGZFStream.
#
# The details of the internal is specified in
# https://samtools.github.io/hts-specs/SAMv1.pdf.
# The details of the internal is specified in https://samtools.github.io/hts-specs/SAMv1.pdf.
#
# This file is a part of BioJulia.
# License is MIT: https://github.com/BioJulia/Bio.jl/blob/master/LICENSE.md
Expand Down
6 changes: 2 additions & 4 deletions src/indexes/overlap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ function done(iter::TabixOverlapIterator, state)
end
while state.chunkid lastindex(state.chunks)
chunk = state.chunks[state.chunkid]
# The `virtualoffset(source)` is not synchronized with the current
# reading position because data are buffered in `buffer` for parsing
# text. So we need to check not only `virtualoffset` but also
# `nb_available`, which returns the current buffered data size.
# The `virtualoffset(source)` is not synchronized with the current reading position because data are buffered in `buffer` for parsing text.
# So we need to check not only `virtualoffset` but also `nb_available`, which returns the current buffered data size.
while bytesavailable(buffer) > 0 || BGZFStreams.virtualoffset(source) < chunk.stop
read!(iter.reader, state.record)
c = icmp(state.record, iter.interval)
Expand Down
3 changes: 1 addition & 2 deletions src/indexes/tabix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ end
Return chunks possibly overlapping with the range specified by `interval`.
Note that records within the returned chunks are not guaranteed to actually
overlap the query interval.
Note that records within the returned chunks are not guaranteed to actually overlap the query interval.
"""
function overlapchunks(tabix::Tabix, interval::Interval)
seqid = findfirst(isequal(interval.seqname), tabix.names)
Expand Down
48 changes: 24 additions & 24 deletions src/interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ struct Interval{T} <: IntervalTrees.AbstractInterval{Int64}
metadata::T
end

function Interval(seqname::AbstractString, first::Integer, last::Integer,
strand::Union{Strand,Char}=STRAND_BOTH, metadata=nothing)
function Interval(seqname::AbstractString, first::Integer, last::Integer, strand::Union{Strand,Char}=STRAND_BOTH, metadata=nothing)
return Interval{typeof(metadata)}(seqname, first, last, strand, metadata)
end

function Interval(seqname::AbstractString, range::UnitRange{T},
strand::Union{Strand,Char}=STRAND_BOTH, metadata=nothing) where T<:Integer
function Interval(seqname::AbstractString, range::UnitRange{T}, strand::Union{Strand,Char}=STRAND_BOTH, metadata=nothing) where T<:Integer
return Interval{typeof(metadata)}(seqname, first(range), last(range), strand, metadata)
end

Expand Down Expand Up @@ -59,45 +57,48 @@ end
IntervalTrees.first(i::Interval) = i.first
IntervalTrees.last(i::Interval) = i.last

function Base.isless(a::Interval{T}, b::Interval{T},
seqname_isless::Function=isless) where T
function Base.isless(a::Interval{T}, b::Interval{T}, seqname_isless::Function=isless) where T
if a.seqname != b.seqname
return seqname_isless(a.seqname, b.seqname)::Bool
elseif a.first != b.first
end

if a.first != b.first
return a.first < b.first
elseif a.last != b.last
end

if a.last != b.last
return a.last < b.last
elseif a.strand != b.strand
end

if a.strand != b.strand
return a.strand < b.strand
else
return false
end

return false
end

"""
Check if two intervals are well ordered.
Intervals are considered well ordered if a.seqname <= b.seqnamend and
a.first <= b.first.
Intervals are considered well ordered if a.seqname <= b.seqnamend and a.first <= b.first.
"""
function isordered(a::Interval{T}, b::Interval{T},
seqname_isless::Function=isless) where T
function isordered(a::Interval{T}, b::Interval{T}, seqname_isless::Function=isless) where T
if a.seqname != b.seqname
return seqname_isless(a.seqname, b.seqname)::Bool
elseif a.first != b.first
end

if a.first != b.first
return a.first < b.first
else
return true
end

return true
end

"""
Return true if interval `a` entirely precedes `b`.
"""
function precedes(a::Interval{T}, b::Interval{T},
seqname_isless::Function=isless) where T
return (a.last < b.first && a.seqname == b.seqname) ||
seqname_isless(a.seqname, b.seqname)::Bool
function precedes(a::Interval{T}, b::Interval{T}, seqname_isless::Function=isless) where T
return (a.last < b.first && a.seqname == b.seqname) || seqname_isless(a.seqname, b.seqname)::Bool
end

function Base.:(==)(a::Interval{T}, b::Interval{T}) where T
Expand All @@ -115,8 +116,7 @@ end

function Base.show(io::IO, i::Interval)
if get(io, :compact, false)
print(io, i.seqname, ":", i.first, "-", i.last, " ", i.strand,
" ", i.metadata === nothing ? "nothing" : i.metadata)
print(io, i.seqname, ":", i.first, "-", i.last, " ", i.strand, " ", i.metadata === nothing ? "nothing" : i.metadata)
else
println(io, summary(i), ':')
println(io, " sequence name: ", i.seqname)
Expand Down
Loading

7 comments on commit e7ce4e3

@CiaranOMara
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error while trying to register: Unexpected error in registration

@CiaranOMara
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DilumAluthge, I think there has been a resurgence of the error with JuliaRegistries/General#7617.

@CiaranOMara
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waiting for the merge of JuliaRegistries/General#7990.

@DilumAluthge
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@CiaranOMara
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/7995

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.4 -m "<description of version>" e7ce4e36210407fb9f05e36c303c562aad30d9c0
git push origin v1.0.4

Please sign in to comment.