Expected Behavior
I have a use case where I would like to broadcast the Interval type. Below is a contrived example.
function example(i1, i2)
return metadata(i1) * metadata(i2)
end
interval = Interval("chr1", 1:1, '.', 2)
intervals = Interval.("chr1", [1:2, 3:4, 5:6], '.', 1:3)
@test collect(1:3) .* 2 == example.(intervals, interval)
Current Behavior
However, the above example results in the following sort of unintuitive error because Interval is not broadcastable.
Got exception outside of a @test
MethodError: no method matching iterate(::GenomicFeatures.Interval{Nothing})
Closest candidates are:
iterate(!Matched::Core.SimpleVector) at essentials.jl:604
iterate(!Matched::Core.SimpleVector, !Matched::Any) at essentials.jl:604
iterate(!Matched::ExponentialBackOff) at error.jl:214
Possible Solution / Implementation
Defining the following solves the issue.
Broadcast.broadcastable(x::IntervalTrees.AbstractInterval) = Ref(x)
While it's possible to define this in my own local projects or elsewhere, I wonder if it would be a useful addition here?
Expected Behavior
I have a use case where I would like to broadcast the
Intervaltype. Below is a contrived example.Current Behavior
However, the above example results in the following sort of unintuitive error because
Intervalis not broadcastable.Possible Solution / Implementation
Defining the following solves the issue.
While it's possible to define this in my own local projects or elsewhere, I wonder if it would be a useful addition here?