-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
126 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
name = "BedgraphFiles" | ||
uuid = "85eb9095-274b-55ce-be28-9e90f41ac741" | ||
authors = ["Ciarán O'Mara <[email protected]>"] | ||
version = "2.1.0" | ||
version = "2.1.1" | ||
|
||
[deps] | ||
Bedgraph = "0bcc2ff6-69eb-520d-bede-0374fc5bd2fd" | ||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" | ||
DataValues = "e7dc6d0d-1eca-5fa6-8ad6-5aecde8b7ea5" | ||
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" | ||
IterableTables = "1c8ee90f-4401-5389-894e-7a04a3dc0f4d" | ||
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d" | ||
Requires = "ae029012-a4dd-5104-9daa-d747884805df" | ||
TableShowUtils = "5e66a065-1f0a-5976-b372-e0b8c017ca10" | ||
TableTraits = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" | ||
TableTraitsUtils = "382cd787-c1b6-5bf2-a167-d5b971a19bda" | ||
|
||
[compat] | ||
julia = "0.7, ^1" | ||
Bedgraph = "^1.1" | ||
FileIO = "^1.0.1" | ||
IteratorInterfaceExtensions = "^0.1.1, ^1" | ||
IterableTables = ">=0.9.0" | ||
TableShowUtils = "^0.2.0" | ||
TableTraits = "^0.4, ^1" | ||
TableTraitsUtils = "^0.3, ^0.4" | ||
|
||
[extras] | ||
Query = "1a8c2f83-1ff3-5112-b086-8aa67b057ba1" | ||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
Query = "1a8c2f83-1ff3-5112-b086-8aa67b057ba1" | ||
|
||
[targets] | ||
test = ["Test", "Query"] | ||
test = ["DataFrames", "Test", "Query"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@debug "BedgraphFiles loading DataFrames integration." | ||
|
||
function Base.convert(::Type{Bedgraph.Record}, row::DataFrames.DataFrameRow) :: Bedgraph.Record | ||
return Bedgraph.Record(row[1], row[2], row[3], row[4]) # Note: using index to allow flexible column names. | ||
end | ||
|
||
function Base.convert(::Type{Vector{Bedgraph.Record}}, df::DataFrames.DataFrame) :: Vector{Bedgraph.Record} | ||
|
||
records = Vector{Bedgraph.Record}(undef, size(df)[1]) | ||
|
||
for (i, row) in enumerate(eachrow(df)) | ||
records[i] = convert(Bedgraph.Record, row) | ||
end | ||
|
||
return records | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@testset "DataFrames" begin | ||
|
||
using DataFrames | ||
|
||
|
||
# DataFrame from Vector{Bedgraph.Record}. | ||
df = DataFrame(Bag.records) | ||
|
||
@test typeof(df) == DataFrame | ||
@test size(df) == (9,4) | ||
|
||
@test df[:chrom] == Bag.chroms | ||
@test df[:first] == Bag.firsts | ||
@test df[:last] == Bag.lasts | ||
@test df[:value] == Bag.values | ||
|
||
@test DataFrame(Bag.records) == Bag.records |> DataFrame | ||
|
||
|
||
# DataFrame from bedGraph file. | ||
df2 = DataFrame(load(Bag.file)) | ||
|
||
@test typeof(df2) == DataFrame | ||
@test size(df2) == (9,4) | ||
|
||
@test df2[:chrom] == Bag.chroms | ||
@test df2[:first] == Bag.firsts | ||
@test df2[:last] == Bag.lasts | ||
@test df2[:value] == Bag.values | ||
|
||
@test DataFrame(load(Bag.file)) == load(Bag.file) |> DataFrame | ||
|
||
|
||
# DataFrame from headerless bedGraph file. | ||
df3 = DataFrame(load(Bag.file_headerless)) | ||
@test typeof(df3) == DataFrame | ||
@test size(df3) == (9,4) | ||
|
||
@test df3[:chrom] == Bag.chroms | ||
@test df3[:first] == Bag.firsts | ||
@test df3[:last] == Bag.lasts | ||
@test df3[:value] == Bag.values | ||
|
||
@test DataFrame(load(Bag.file_headerless)) == load(Bag.file_headerless) |> DataFrame | ||
|
||
|
||
# Save and load from DataFrame. | ||
save(Bag.tmp_output_path, df) | ||
@test df == load(Bag.tmp_output_path) |> DataFrame | ||
|
||
df |> save(Bag.tmp_output_path) | ||
@test df == load(Bag.tmp_output_path) |> DataFrame | ||
|
||
end # test DataFrames |
Oops, something went wrong.
390742a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
Release notes:
There are no new features in this release. This release contains some minor internal improvements as well as a much-appreciated Project.toml update from @davidanthoff.
390742a
There was a problem hiding this comment.
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/936
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: