Skip to content

Commit

Permalink
fixes to GenomicDataFrame to pass tests with new GenomeInfo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter M. Haverty committed Sep 21, 2018
1 parent 38d6cd5 commit bc1aed6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion benchmark/timings.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ language,language_version,date,length,start,width,ends,strand,chromosomes,indexi
julia,0.6.2,2018-05-11,2.5033950805664062e-5,0.02172088623046875,0.016653060913085938,0.003154993057250977,0.0005910396575927734,0.010876893997192385,9.059906005859377e-6,0.00011491775512695312,8.29309892654419,0.09844279289245604,1.664133071899414,0.08970117568969727,0.007980108261108398,0.10997200012207033,0.043940067291259766,0.0001819133758544922,NaN
julia,0.6.3,2018-06-15,9.059906005859377e-6,0.005581855773925781,0.007038116455078125,0.009682178497314451,0.00011014938354492188,0.006683826446533203,9.059906005859377e-6,0.00016999244689941406,0.9087679386138916,0.1486611366271973,1.7835981845855713,0.14378786087036133,0.002040863037109375,0.13267898559570312,0.015294075012207031,2.4080276489257812e-5,9.489059448242188e-5
julia,0.6.3,2018-06-16,0.002122163772583008,0.018936872482299805,0.01643204689025879,0.00332498550415039,0.0004088878631591797,0.01216411590576172,8.106231689453125e-6,0.00011801719665527344,0.7376258373260498,0.12804388999938965,1.600618839263916,0.1149129867553711,0.001374006271362305,0.11236095428466795,0.013430118560791016,2.5987625122070312e-5,6.604194641113281e-5
julia,0.6.3,2018-06-25,1.5974044799804688e-5,0.005467891693115234,0.006964921951293945,0.013832807540893555,0.0005309581756591797,0.006727933883666992,6.9141387939453125e-6,6.29425048828125e-5,0.621068000793457,0.14697885513305664,1.6481969356536865,0.126054048538208,0.0014541149139404297,0.11136293411254883,0.013569831848144531,3.0994415283203125e-5,7.605552673339844e-5
julia,0.6.3,2018-06-25,1.5974044799804688e-5,0.005467891693115234,0.006964921951293945,0.013832807540893556,0.0005309581756591797,0.006727933883666992,6.9141387939453125e-6,6.29425048828125e-5,0.621068000793457,0.14697885513305664,1.6481969356536863,0.126054048538208,0.0014541149139404297,0.11136293411254884,0.013569831848144531,3.0994415283203125e-5,7.605552673339844e-5
julia,1.1.0-DEV.299,2018-09-21,0.0021920204162597656,0.010051965713500977,0.008591175079345703,0.0069959163665771484,0.0006549358367919922,0.0031499862670898438,1.1920928955078125e-5,4.506111145019531e-5,0.27182817459106445,0.06595492362976074,1.661776065826416,0.06243705749511719,0.008456945419311523,0.054190874099731445,0.014487981796264648,1.2159347534179688e-5,6.508827209472656e-5
17 changes: 9 additions & 8 deletions src/GenomicDataFrame_type.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ A DataFrame-like class with a GenomicVector as an index.
gt[1:2,1:2]
```
"""
struct GenomicDataFrame{T1 <: AbstractGenomicVector, T2 <: AbstractDataFrame} <: AbstractDataFrame
struct GenomicDataFrame{T1 <: AbstractGenomicVector, T2 <: AbstractDataFrame}
rowindex::T1
table::T2
function GenomicDataFrame{T1,T2}(rowindex,table) where {T1 <: AbstractGenomicVector,T2 <: AbstractDataFrame}
nrow = size(table,1)
if nrow != 0 && length(rowindex) != nrow
throw(ArgumentError("GenomicDataFrame requires that `length(rowindex) == size(table,1)`"))
end
new(rowindex,table)
end
function GenomicDataFrame{T1,T2}(rowindex,table) where {T1 <: AbstractGenomicVector,T2 <: AbstractDataFrame}
nrow = size(table,1)
if nrow != 0 && length(rowindex) != nrow
throw(ArgumentError("GenomicDataFrame requires that `length(rowindex) == size(table,1)`"))
end
new(rowindex,table)
end
end

GenomicDataFrame(gv,dt) = GenomicDataFrame{typeof(gv),typeof(dt)}(gv,dt)
rowindex(gt::GenomicDataFrame) = copy(gt.rowindex)
table(gt::GenomicDataFrame) = copy(gt.table)
Expand Down
6 changes: 3 additions & 3 deletions src/GenomicVectors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export genopos
# types
import Base: ==, getindex, setindex!
import GenomicFeatures: Interval, IntervalCollection, Strand, strand, leftposition, rightposition
export GenomeInfo, AbstractGenomicVector, GenomicPositions, GenomicRanges
export GenomicDataFrame, GenomicVectorIterator
export GenomeInfo, AbstractGenomicVector, GenomicPositions, GenomicRanges, GenomicVectorIterator
export GenomicDataFrame

# GenomeInfo
export chr_ends, chr_lengths, chr_offsets, chr_names, same_genome
Expand All @@ -33,7 +33,7 @@ export findoverlaps, overlap_table, eachrange
export disjoin, gaps, coverage, collapse

# Delegations
import Base: similar, copy, unique, size, length, lastindex, issubset, vcat, union, intersect, setdiff, symdiff, append!, prepend!, resize!
import Base: similar, copy, unique, size, length, lastindex, issubset, vcat, union, intersect, setdiff, symdiff, append!, prepend!, resize!, reduce

# GenomicDataFrame
export rowindex, table
Expand Down

0 comments on commit bc1aed6

Please # to comment.