Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCall code for translation back and for to R Rle objects loads when R… #24

Merged
merged 2 commits into from
Sep 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,6 @@ matrix:
allow_failures:
- julia: nightly

before_install:
# linux
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -s -c)/"; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq -y; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install git r-base r-base-dev r-recommended -y; fi

# osx
# faster than using homebrew/science tap
# but no permalink to release download
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then wget "https://cran.rstudio.com/bin/macosx/$(wget -qO- https://cran.rstudio.com/bin/macosx/ | sed -n 's/.*href="\(R-[^"]*.pkg\)".*/\1/p' | head -n 1)"; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then sudo installer -pkg R-*.pkg -target /; fi

script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia --color=yes -e 'using Pkg; Pkg.build()'
Expand Down
78 changes: 31 additions & 47 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[CategoricalArrays]]
deps = ["Compat", "Future", "Missings", "Printf", "Reexport", "Requires"]
git-tree-sha1 = "94d16e77dfacc59f6d6c1361866906dbb65b6f6b"
deps = ["Compat", "DataAPI", "Future", "JSON", "Missings", "Printf", "Reexport", "Unicode"]
git-tree-sha1 = "5f4400b24adb1fbed17a9dcc1e8ab8aaf5b03d1f"
uuid = "324d7699-5711-5eae-9e2f-1d82baa6b597"
version = "0.5.2"
version = "0.6.0"

[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "84aa74986c5b9b898b0d1acaf3258741ee64754f"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "2.1.0"

[[Conda]]
deps = ["Compat", "JSON", "VersionParsing"]
git-tree-sha1 = "b625d802587c2150c279a40a646fba63f9bd8187"
uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d"
version = "1.2.0"
[[DataAPI]]
git-tree-sha1 = "8903f0219d3472543fc4b2f5ebaf675a07f817c0"
uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
version = "1.0.1"

[[DataFrames]]
deps = ["CategoricalArrays", "Compat", "IteratorInterfaceExtensions", "Missings", "PooledArrays", "Printf", "REPL", "Reexport", "SortingAlgorithms", "Statistics", "StatsBase", "TableTraits", "Tables", "Unicode"]
Expand All @@ -28,10 +27,15 @@ uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
version = "0.18.1"

[[DataStructures]]
deps = ["InteractiveUtils", "OrderedCollections", "Random", "Serialization", "Test"]
git-tree-sha1 = "ca971f03e146cf144a9e2f2ce59674f5bf0e8038"
deps = ["InteractiveUtils", "OrderedCollections"]
git-tree-sha1 = "0809951a1774dc724da22d26e4289bbaab77809a"
uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
version = "0.15.0"
version = "0.17.0"

[[DataValueInterfaces]]
git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6"
uuid = "e2d170a0-9d28-54be-80f0-106bbe20a464"
version = "1.0.0"

[[Dates]]
deps = ["Printf"]
Expand Down Expand Up @@ -59,10 +63,10 @@ uuid = "82899510-4779-5014-852e-03e436cf321d"
version = "1.0.0"

[[JSON]]
deps = ["Dates", "Distributed", "Mmap", "Sockets", "Test", "Unicode"]
git-tree-sha1 = "1f7a25b53ec67f5e9422f1f551ee216503f4a0fa"
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "b34d7cef7b337321e97d22242c3c2b91f476748e"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.20.0"
version = "0.21.0"

[[LibGit2]]
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
Expand All @@ -82,10 +86,9 @@ deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Missings]]
deps = ["Dates", "InteractiveUtils", "SparseArrays", "Test"]
git-tree-sha1 = "d1d2585677f2bd93a97cfeb8faa7a0de0f982042"
git-tree-sha1 = "29858ce6c8ae629cf2d733bffa329619a1c843d0"
uuid = "e1d29d7a-bbdc-5cf2-9ac0-f12de2c33e28"
version = "0.4.0"
version = "0.4.2"

[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
Expand All @@ -96,26 +99,25 @@ git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.1.0"

[[Parsers]]
deps = ["Dates", "Test"]
git-tree-sha1 = "ef0af6c8601db18c282d092ccbd2f01f3f0cd70b"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "0.3.7"

[[Pkg]]
deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[[PooledArrays]]
deps = ["Test"]
git-tree-sha1 = "6ea4cfb9136d3ff2b9d30d6696cd72166a3b837c"
git-tree-sha1 = "6e8c38927cb6e9ae144f7277c753714861b27d14"
uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
version = "0.5.1"
version = "0.5.2"

[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[RCall]]
deps = ["CategoricalArrays", "Conda", "DataFrames", "DataStructures", "Dates", "Libdl", "Missings", "REPL", "Random", "Requires", "StatsModels", "Test", "WinReg"]
git-tree-sha1 = "58958d1ce1923a5e5f20999caa4d7f0df38e1ca9"
uuid = "6f49c342-dc21-5d91-9882-a32aef131414"
version = "0.13.2"

[[REPL]]
deps = ["InteractiveUtils", "Markdown", "Sockets"]
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Expand Down Expand Up @@ -169,23 +171,17 @@ git-tree-sha1 = "8a0f4b09c7426478ab677245ab2b0b68552143c7"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
version = "0.30.0"

[[StatsModels]]
deps = ["Compat", "DataFrames", "StatsBase", "Test"]
git-tree-sha1 = "b5a735dcd2be05f0af86709750d4d5f62ca4a25d"
uuid = "3eaba693-59b7-5ba5-a881-562e759f1c8d"
version = "0.5.0"

[[TableTraits]]
deps = ["IteratorInterfaceExtensions"]
git-tree-sha1 = "b1ad568ba658d8cbb3b892ed5380a6f3e781a81e"
uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c"
version = "1.0.0"

[[Tables]]
deps = ["IteratorInterfaceExtensions", "LinearAlgebra", "Requires", "TableTraits", "Test"]
git-tree-sha1 = "e2abd466ca2f00a1bb8cb80024d59745cc8f91a6"
deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "TableTraits", "Test"]
git-tree-sha1 = "aaed7b3b00248ff6a794375ad6adf30f30ca5591"
uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
version = "0.2.0"
version = "0.2.11"

[[Test]]
deps = ["Distributed", "InteractiveUtils", "Logging", "Random"]
Expand All @@ -197,15 +193,3 @@ uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

[[VersionParsing]]
deps = ["Compat"]
git-tree-sha1 = "c9d5aa108588b978bd859554660c8a5c4f2f7669"
uuid = "81def892-9a0e-5fdd-b105-ffc91e053289"
version = "1.1.3"

[[WinReg]]
deps = ["Test"]
git-tree-sha1 = "808380e0a0483e134081cc54150be4177959b5f4"
uuid = "1b915085-20d7-51cf-bf83-8f477d6f5128"
version = "0.3.1"
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ version = "0.8.1"
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "1.0"
StatsBase = ">= 0.6.0"
RCall = ">= 0.7.4"
julia = "1.0"
12 changes: 6 additions & 6 deletions src/RLEVectors.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module RLEVectors

using Requires
using Statistics
using StatsBase
using RCall
using DataFrames

# RLEVector type
Expand Down Expand Up @@ -54,9 +54,6 @@ import DataFrames: AbstractDataFrame, DataFrame, Index, index, nrow, ncol
export RLEDataFrame, nrow, ncol, columns, index, names
export rowSums, rowMeans, rowMedians, colSums, colMeans, colMedians

# RCall
import RCall: sexp, rcopy, RClass, rcopytype, @R_str, S4Sxp

### Includes
include("utils.jl")
include("runs.jl")
Expand All @@ -69,8 +66,11 @@ include("group_generics.jl")
include("collections_api.jl")
include("math.jl")
include("sorting.jl")
include("rcall.jl")
include("precompile.jl")
_precompile_()

end # Module RLEVectors
function __init__()
@require RCall="6f49c342-dc21-5d91-9882-a32aef131414" include("rcall.jl")
end

end # module RLEVectors
12 changes: 7 additions & 5 deletions src/rcall.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
function sexp(f::RLEVector)
R"library(GenomicRanges)"
using .RCall

function RCall.sexp(f::RLEVector)
RCall.R"library(GenomicRanges)"
v = values(f)
w = widths(f)
R"Rle($v, $w)"
RCall.R"Rle($v, $w)"
end

function rcopy(::Type{RLEVector}, s::Ptr{S4Sxp})
RLEVector(rcopy(s[:values]), cumsum(rcopy(s[:lengths])))
RLEVector(Rcall.rcopy(s[:values]), cumsum(RCall.rcopy(s[:lengths])))
end

rcopytype(::Type{RClass{:Rle}}, s::Ptr{S4Sxp}) = RLEVector
rcopytype(::Type{RCall.RClass{:Rle}}, s::Ptr{RCall.S4Sxp}) = RLEVector