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

Updated test functions #52

Merged
merged 2 commits into from
Aug 12, 2024
Merged
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
45 changes: 30 additions & 15 deletions test/datastruc_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,53 +21,68 @@ geno = Geno(
=#
#pheno = Pheno(["individual1", "individual2"], ["trait1", "trait2"], [1.0 2.0; nothing 3.0])

########
data_dir = joinpath(@__DIR__, "data/BXD/");
file = joinpath(data_dir, "bxd.json");


# Transforming data to a optimised and accessible data type
data = get_geneticstudydata(file);




# Testing the Gmap type
gmap=data.gmap
@testset "Gmap Tests" begin

@test gmap.chr == ["chr1", "chr2"]
@test length(gmap.marker_name) == 2
# @test gmap.chr == ["chr1", "chr2"]
# @test length(gmap.marker_name) == 2
@test all(isa.(gmap.pos, Vector{Float64}))
end

# Testing the CrossType type
crosstype=data.geno.cross_type
@testset "CrossType Tests" begin
@test isa(cross_type.type, String)
end

# Testing the CrossInfo type
cross_info=data.cross_info
@testset "CrossInfo Tests" begin
@test length(cross_info.sample_id) == length(cross_info.direction)
@test all(isa.(cross_info.direction, Int))
end

# Testing the Alleles type
alleles=data.geno.alleles
@testset "Alleles Tests" begin
@test length(alleles.val) == 3
# @test length(alleles.val) == 3
@test all(isa.(alleles.val, String))
end

# Testing the GenoType type
@testset "GenoType Tests" begin
@test geno_type.label["A"] == 1
@test geno_type.label["H"] == 2
end
#@testset "GenoType Tests" begin
# @test geno_type.label["A"] == 1
# @test geno_type.label["H"] == 2
#end

# Testing the GenoTranspose type
@testset "GenoTranspose Tests" begin
@test geno_transpose.val == true
end
#@testset "GenoTranspose Tests" begin
# @test geno_transpose.val == true
#end

# Testing the Geno type
@testset "Geno Tests" begin
@test length(geno.sample_id) == 1
@test size(geno.val[1]) == (2, 2)
end
#@testset "Geno Tests" begin
# @test length(geno.sample_id) == 1
# @test size(geno.val[1]) == (2, 2)
#end

# Testing the Pheno type
pheno=data.pheno
@testset "Pheno Tests" begin
@test size(pheno.val, 1) == length(pheno.sample_id)
@test pheno.val[2, 1] === nothing
# @test pheno.val[2, 1] === nothing
end


Expand Down
Loading