Skip to content

Convert SnpArray into matrix{Int} doesn't obey conversion convention #79

@biona001

Description

@biona001

According to documentation, 0x01 encodes missing (NaN), 0x02 encode 1, 0x03 encodes 2. But if we convert a SnpArray into matrix of subtype Int, 0x01 will become 1, 0x02 = 2, and 0x03 = 3.

using SnpArrays
const mouse = SnpArray(SnpArrays.datadir("mouse.bed"))
julia> convert(Matrix{Float64}, mouse)[1:10]
10-element Array{Float64,1}:
 1.0
 1.0
 2.0
 1.0
 2.0
 1.0
 1.0
 1.0
 1.0
 2.0
julia> convert(Matrix{Int64}, mouse)[1:10]
10-element Array{Int64,1}:
 2
 2
 3
 2
 3
 2
 2
 2
 2
 3

Is this by design or a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions