Skip to content

Commit

Permalink
Merge pull request #52 from Durbadal0/main
Browse files Browse the repository at this point in the history
Updated test functions
  • Loading branch information
GregFa authored Aug 12, 2024
2 parents 5a922e3 + 98e5f02 commit 782ce16
Showing 1 changed file with 30 additions and 15 deletions.
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

0 comments on commit 782ce16

Please sign in to comment.