Skip to content

Commit

Permalink
Version 1.0 updates (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben J. Ward authored Sep 9, 2018
1 parent 4acbbd6 commit 8fc34ff
Show file tree
Hide file tree
Showing 37 changed files with 648 additions and 440 deletions.
19 changes: 3 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,15 @@ os:
- linux
- osx
julia:
- 0.6
- 0.7
- 1.0
- nightly
matrix:
allow_failures:
- julia: nightly
notifications:
email: false
git:
depth: 99999999

## uncomment and modify the following lines to manually install system packages
#addons:
# apt: # apt-get for linux
# packages:
# - gfortran
#before_script: # homebrew for mac
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi

## uncomment the following lines to override the default test script
#script:
# - julia -e 'Pkg.clone(pwd()); Pkg.build("GenomicFeatures"); Pkg.test("GenomicFeatures"; coverage=true)'
after_success:
# push coverage results to Codecov
- julia -e 'cd(Pkg.dir("GenomicFeatures")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
- julia -e 'cd(joinpath(Pkg.dir("GenomicFeatures"), "docs/src")); mkdir("assets"); cd("assets"); run(pipeline(`curl https://codeload.github.com/BioJulia/assets/tar.gz/master`, `tar -xz --strip=2 assets-master/doc_assets`))'
- julia -e 'cd(Pkg.dir("GenomicFeatures")); Pkg.add("Documenter"); include(joinpath("docs", "make.jl"))'
89 changes: 76 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,76 @@
GenomicFeatures.jl
==================

[![Docs Latest][docs-latest-img]][docs-latest-url]
[![Build Status][travisci-img]][travisci-url]
[![codecov.io][codecov-img]][codecov-url]

[travisci-img]: https://travis-ci.org/BioJulia/GenomicFeatures.jl.svg?branch=master
[travisci-url]: https://travis-ci.org/BioJulia/GenomicFeatures.jl
[codecov-img]: http://codecov.io/github/BioJulia/GenomicFeatures.jl/coverage.svg?branch=master
[codecov-url]: http://codecov.io/github/BioJulia/GenomicFeatures.jl?branch=master
[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg
[docs-latest-url]: https://biojulia.github.io/GenomicFeatures.jl/latest/
# <img src="sticker.svg" width="30%" align="right" /> GenomicFeatures

[![latest release][release-img]][release-url]
[![MIT license][license-img]][license-url]
[![stable documentation][docs-stable-img]][docs-stable-url]
[![latest documentation][docs-latest-img]][docs-latest-url]
![lifecycle][lifecycle-maturing]
[![Chat on Discord][discord-img]][discord-url]

## Description

GenomicFeatures provides utilities for working with interval based genomic
annotations. It builds on [IntervalTrees]() to provide a data-structures,
algorithms and IO tools for various formats such as BED, GFF3, bigWig and
bigBed.

## Installation

Install GenomicFeatures from the Julia REPL:

```julia
using Pkg
add("GenomicFeatures")
#Pkg.add("GenomicFeatures") for julia prior to v 0.7
```

If you are interested in the cutting edge of the development, please check out
the master branch to try new features before release.

## Testing

GenomicFeatures is tested against julia `0.6` and current `0.7-dev` on Linux,
OS X, and Windows.

| **Latest release** | **Latest build status** |
|:------------------:|:-----------------------:|
| [![julia06][juliapkg06-img]][juliapkg-url] [![julia07][juliapkg07-img]][juliapkg-url] | [![travis][travis-img]][travis-url] [![appveyor][appveyor-img]][appveyor-url] [![coverage][codecov-img]][codecov-url] |

## Contributing and Questions

We appreciate contributions from users including reporting bugs, fixing issues,
improving performance and adding new features.

Take a look at the [CONTRIBUTING](CONTRIBUTING.md) file provided with this
package for detailed contributor and maintainer guidelines.

If you have a question about contributing or using this package, come on over
and chat to us on [Discord][discord-url], or you can try the
[Bio category of the Julia discourse site](https://discourse.julialang.org/c/domain/bio).

[release-img]: https://img.shields.io/github/release/BioJulia/GenomicFeatures.jl.svg?style=flat-square
[release-url]: https://github.com/BioJulia/GenomicFeatures.jl/releases/latest
[license-img]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square
[license-url]: https://github.com/BioJulia/GenomicFeatures.jl/blob/master/LICENSE
[docs-stable-img]: https://img.shields.io/badge/docs-stable-blue.svg?style=flat-square
[docs-stable-url]: https://biojulia.github.io/GenomicFeatures.jl/stable
[docs-latest-img]: https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square
[docs-latest-url]: https://biojulia.github.io/GenomicFeatures.jl/latest/
[lifecycle-experimental]: https://img.shields.io/badge/lifecycle-experimental-orange.svg?style=flat-square
[lifecycle-maturing]: https://img.shields.io/badge/lifecycle-maturing-blue.svg?style=flat-square
[lifecycle-stable]: https://img.shields.io/badge/lifecycle-stable-brightgreen.svg?style=flat-square
[lifecycle-retired]: https://img.shields.io/badge/lifecycle-retired-orange.svg?style=flat-square
[lifecycle-archived]: https://img.shields.io/badge/lifecycle-archived-red.svg?style=flat-square
[lifecycle-dormant]: https://img.shields.io/badge/lifecycle-dormant-blue.svg?style=flat-square
[lifecycle-questioning]: https://img.shields.io/badge/lifecycle-questioning-blue.svg?style=flat-square
[discord-img]: https://img.shields.io/badge/discord-chat-blue.svg?style=flat-square&logo=discord&colorB=%237289DA
[discord-url]: https://discord.gg/z73YNFz
[juliapkg06-img]: http://pkg.julialang.org/badges/GenomicFeatures_0.6.svg?style=flat-square
[juliapkg07-img]: http://pkg.julialang.org/badges/GenomicFeatures_0.7.svg?style=flat-square
[juliapkg-url]: http://pkg.julialang.org/?pkg=GenomicFeatures
[travis-img]: https://img.shields.io/travis/BioJulia/GenomicFeatures.jl/master.svg?label=Linux+/+macOS
[travis-url]: https://travis-ci.org/BioJulia/GenomicFeatures.jl
[appveyor-img]: https://ci.appveyor.com/api/projects/status/dnup6vbbvai92bl8/branch/master?svg=true
[appveyor-url]: https://ci.appveyor.com/project/BenJWard/genomicfeatures-jl/branch/master
[codecov-img]: http://codecov.io/github/BioJulia/GenomicFeatures.jl/coverage.svg?branch=master
[codecov-url]: http://codecov.io/github/BioJulia/GenomicFeatures.jl?branch=master
24 changes: 12 additions & 12 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
julia 0.6
Automa 0.2
BioCore 1.0
BioSequences 0.6
BufferedStreams 0.3
BGZFStreams 0.1
ColorTypes 0.5
DataStructures 0.5
FixedPointNumbers 0.3
IntervalTrees 0.3
Libz 0.2
URIParser 0.1
julia 0.7
Automa 0.7
BioCore 2.0.2
BioSequences 1.0
BufferedStreams 1.0.0
BGZFStreams 0.3
ColorTypes 0.7.4
DataStructures 0.11.0
FixedPointNumbers 0.5.2
IntervalTrees 1.0
Libz 1.0
URIParser 0.4
47 changes: 23 additions & 24 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.7
- julia_version: 1
- julia_version: nightly

## uncomment the following lines to allow failures on nightly julia
## (tests will run but not make your overall status red)
matrix:
allow_failures:
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: nightly

branches:
only:
Expand All @@ -21,24 +26,18 @@ notifications:
on_build_status_changed: false

install:
- ps: "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
# If there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"GenomicFeatures\"); Pkg.build(\"GenomicFeatures\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia -e "Pkg.test(\"GenomicFeatures\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"

# # Uncomment to support code coverage upload. Should only be enabled for packages
# # which would have coverage gaps without running on Windows
# on_success:
# - echo "%JL_CODECOV_SCRIPT%"
# - C:\julia\bin\julia -e "%JL_CODECOV_SCRIPT%"
22 changes: 19 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
using Documenter, GenomicFeatures

makedocs()
makedocs(
format = :html,
sitename = "GenomicFeatures.jl",
pages = [
"Home" => "index.md",
"Intervals" => "intervals.md",
"I/O" => [
"BED" => "io/bed.md",
"GFF3" => "io/gff3.md",
"BigWig" => "io/bigwig.md",
"BigBed" => "io/bigbed.md"
]
],
authors = "Kenta Sato, D. C. Jones, Ben J. Ward, The BioJulia Organisation and other contributors."
)
deploydocs(
deps = Deps.pip("mkdocs", "pygments", "mkdocs-material"),
repo = "github.com/BioJulia/GenomicFeatures.jl.git",
julia = "0.5",
julia = "0.6",
osname = "linux",
target = "build",
deps = nothing,
make = nothing
)
45 changes: 0 additions & 45 deletions docs/mkdocs.yml

This file was deleted.

1 change: 1 addition & 0 deletions src/GenomicFeatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import BGZFStreams
import BioCore: BioCore, seqname, leftposition, rightposition, isoverlapping, isfilled, hasseqname, hasleftposition, hasrightposition, metadata
import DataStructures
import IntervalTrees
import Base.@propagate_inbounds

include("strand.jl")
include("interval.jl")
Expand Down
8 changes: 4 additions & 4 deletions src/bbi/btree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end
function chromlist(tree::BTree)
list = Tuple{String,UInt32,UInt32}[]
# traverse tree
key = Vector{UInt8}(tree.header.key_size)
key = Vector{UInt8}(undef, tree.header.key_size)
stack = UInt64[tree.offset + sizeof(BTreeHeader)]
while !isempty(stack)
offset = pop!(stack)
Expand All @@ -70,8 +70,8 @@ function chromlist(tree::BTree)
for i in 1:node.count
if isleaf(node)
read!(tree.stream, key)
i = findfirst(key, 0x00)
chromname = i == 0 ? String(copy(key)) : String(key[1:i-1])
i = findfirst(isequal(0x00), key)
chromname = i === nothing ? String(copy(key)) : String(key[1:i-1])
chromid = read(tree.stream, UInt32)
chromsize = read(tree.stream, UInt32)
push!(list, (chromname, chromid, chromsize))
Expand Down Expand Up @@ -100,7 +100,7 @@ function write_btree(stream::IO, chromlist::Vector{Tuple{String,UInt32,UInt32}})
n += write(stream, BTreeNode(0x01, 0x00, length(chromlist)))

# write the root node
key = Vector{UInt8}(keysize)
key = Vector{UInt8}(undef, keysize)
for (name, id, len) in sort(chromlist, by=x->x[1]) # sort by name
fill!(key, 0x00)
@assert sizeof(name) keysize
Expand Down
4 changes: 2 additions & 2 deletions src/bbi/compress.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function compress!(dst::Vector{UInt8}, src::Vector{UInt8})::UInt64
code = ccall(
(:compress, Libz.zlib),
Cint,
(Ptr{Void}, Ref{Culong}, Ptr{Void}, Culong),
(Ptr{Cvoid}, Ref{Culong}, Ptr{Cvoid}, Culong),
dst, sz, src, sizeof(src))
if code != Libz.Z_OK
Libz.zerror(code)
Expand All @@ -19,7 +19,7 @@ function uncompress!(dst::Vector{UInt8}, src::Vector{UInt8})::UInt64
code = ccall(
(:uncompress, Libz.zlib),
Cint,
(Ptr{Void}, Ref{Culong}, Ptr{Void}, Culong),
(Ptr{Cvoid}, Ref{Culong}, Ptr{Cvoid}, Culong),
dst, sz, src, sizeof(src))
if code != Libz.Z_OK
Libz.zerror(code)
Expand Down
6 changes: 3 additions & 3 deletions src/bbi/rtree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function write_rtree(stream::IO, blocks::Vector{Block})
seek(stream, offset)
@assert position(stream) == offset
write(stream, RTreeNodeFormat(isleaf(node) ? 0x01 : 0x00, 0x00, length(node.children)))
for i in 1:endof(node.children)
for i in 1:lastindex(node.children)
child = node.children[i]
if isleaf(node)
write(stream, RTreeLeafNode(child.lo, child.up, offsets[i], datasizes[i]))
Expand Down Expand Up @@ -285,13 +285,13 @@ function build_inmemory_rtree(blocks::Vector{Block}, blocksize::Int)
d = cld(length(blocks), blocksize)
children = InMemoryRTree[]
for i in 1:blocksize
idx = (i-1)*d+1:min(i*d,endof(blocks))
idx = (i-1)*d+1:min(i*d,lastindex(blocks))
push!(children, rec(view(blocks, idx)))
end
return InMemoryRTree(children)
end
end
return rec(view(blocks, 1:endof(blocks)))
return rec(view(blocks, 1:lastindex(blocks)))
end

function readbound(stream::IO)
Expand Down
Loading

0 comments on commit 8fc34ff

Please sign in to comment.