Skip to content

Commit

Permalink
Allow the use of ReTest during development
Browse files Browse the repository at this point in the history
  • Loading branch information
diegozea committed Dec 11, 2023
1 parent 2b1262d commit 55cbc99
Show file tree
Hide file tree
Showing 22 changed files with 166 additions and 155 deletions.
10 changes: 5 additions & 5 deletions test/Information/CorrectedMutualInformation.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@testset "CorrectedMutualInformation" begin

Gaoetal2011 = joinpath(pwd(), "data", "Gaoetal2011.fasta")
Gaoetal2011 = joinpath(DATA, "Gaoetal2011.fasta")

function gao11_buslje09(measure)
filename = string("data_Gaoetal2011_soft_Busljeetal2009_measure_", measure, ".txt")
joinpath(pwd(), "data", filename)
joinpath(DATA, filename)
end

## Column numbers for the output of Buslje et. al. 2009
Expand Down Expand Up @@ -223,9 +223,9 @@
@testset "Results from Buslje et. al. 2009" begin

@testset "Simple" begin
data = readdlm(joinpath(pwd(), "data",
data = readdlm(joinpath(DATA,
"data_simple_soft_Busljeetal2009_measure_MI.txt"), comments=true)
results = buslje09(joinpath(pwd(), "data", "simple.fasta"), FASTA,
results = buslje09(joinpath(DATA, "simple.fasta"), FASTA,
lambda=0.0, clustering=false, apc=false)

@test isapprox(Float64(data[1, SCORE]), results[MIToS_SCORE][1,2], atol=1e-6)
Expand Down Expand Up @@ -297,7 +297,7 @@
@testset "BLMI" begin

@testset "Simple" begin
file = joinpath(pwd(), "data", "simple.fasta")
file = joinpath(DATA, "simple.fasta")
busl = buslje09(file, FASTA)
blmi = BLMI(file, FASTA)

Expand Down
4 changes: 2 additions & 2 deletions test/Information/Gaps.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@testset "Pairwise Gap Percentage" begin

@testset "Simple" begin
file = joinpath(pwd(), "data", "simple.fasta")
file = joinpath(DATA, "simple.fasta")
mat = [ 0. 0.
0. 0. ]

Expand All @@ -12,7 +12,7 @@

@testset "Gaps" begin

file = joinpath(pwd(), "data", "gaps.txt")
file = joinpath(DATA, "gaps.txt")
cl = hobohmI(read(file, Raw), 62)
gu, gi = pairwisegapfraction(file, Raw)
ncl = nclusters(cl)
Expand Down
4 changes: 2 additions & 2 deletions test/Information/Iterations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# New methods to measure residues coevolution in proteins.
# BMC bioinformatics, 12(1), 206.

aln = read(joinpath(pwd(), "data", "Gaoetal2011.fasta"), FASTA)
aln = read(joinpath(DATA, "Gaoetal2011.fasta"), FASTA)
result = Float64[ 0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 1 1 0.296
Expand Down Expand Up @@ -36,7 +36,7 @@

table = ContingencyTable(Float64, Val{1}, GappedAlphabet())

gaps = read(joinpath(pwd(), "data", "gaps.txt"), Raw)
gaps = read(joinpath(DATA, "gaps.txt"), Raw)

# THAYQAIHQV 0
# THAYQAIHQ- 0.1
Expand Down
10 changes: 10 additions & 0 deletions test/MIToSTests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""
You need to `include` this file (and module) into your Julia session to run the tests using
`ReTest`. `ReTest` is not a dependency of `MIToS`, so you need to install it manually.
Then, you can do `MIToSTests.retest()` to setup the tests. After that, you can use
regular expressions to filter the tests you want to run, e.g. `MIToSTests.retest(r"MSA")`.
"""
module MIToSTests
using ReTest
include("tests.jl")
end
2 changes: 1 addition & 1 deletion test/MSA/Concatenation.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testset "hcat" begin
simple = joinpath(pwd(), "data", "simple.fasta")
simple = joinpath(DATA, "simple.fasta")
msa = read(simple, FASTA, generatemapping=true)
setannotresidue!(msa, "ONE", "example", "ab")
setannotresidue!(msa, "TWO", "example", "cd")
Expand Down
4 changes: 2 additions & 2 deletions test/MSA/General.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
AnnotatedMultipleSequenceAlignment
)

pf09645_sto = joinpath(pwd(), "data", "PF09645_full.stockholm")
gaoetal2011 = joinpath(pwd(), "data", "Gaoetal2011.fasta")
pf09645_sto = joinpath(DATA, "PF09645_full.stockholm")
gaoetal2011 = joinpath(DATA, "Gaoetal2011.fasta")

gaoetal_msas = [ read(gaoetal2011, FASTA, T) for T in msa_types ]
pfam_msas = [ read(pf09645_sto, Stockholm, T) for T in msa_types ]
Expand Down
2 changes: 1 addition & 1 deletion test/MSA/GetIndex.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@testset "getindex" begin
simple = joinpath(pwd(), "data", "simple.fasta")
simple = joinpath(DATA, "simple.fasta")

@testset "MSA" begin
msa = read(simple, FASTA, generatemapping=true)
Expand Down
2 changes: 1 addition & 1 deletion test/MSA/Hobohm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end
# DAYCMT 33.3 83.3
# DAYCMT 33.3 83.3

fasta = read(joinpath(pwd(), "data", "Gaoetal2011.fasta"), FASTA)
fasta = read(joinpath(DATA, "Gaoetal2011.fasta"), FASTA)
clusters = hobohmI(fasta, 62)

@test nclusters(clusters) == 2
Expand Down
22 changes: 11 additions & 11 deletions test/MSA/IO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
# > Pfam version 28.0, based on UniProt release 2014_07
@testset "Stockholm" begin

pf09645_sto = joinpath(pwd(), "data", "PF09645_full.stockholm")
rna_sto = joinpath(pwd(), "data", "upsk_rna.sto")
pf09645_sto = joinpath(DATA, "PF09645_full.stockholm")
rna_sto = joinpath(DATA, "upsk_rna.sto")

@testset "Read" begin

Expand Down Expand Up @@ -139,8 +139,8 @@

@testset "FASTA" begin

pf09645_fas = joinpath(pwd(), "data", "PF09645_full.fasta.gz")
gaoetal2011 = joinpath(pwd(), "data", "Gaoetal2011.fasta")
pf09645_fas = joinpath(DATA, "PF09645_full.fasta.gz")
gaoetal2011 = joinpath(DATA, "Gaoetal2011.fasta")

@testset "Read" begin

Expand Down Expand Up @@ -278,7 +278,7 @@

@testset "Non standard residues and mapping" begin

seqs = read(joinpath(pwd(), "data", "alphabet.fasta"), FASTA,
seqs = read(joinpath(DATA, "alphabet.fasta"), FASTA,
generatemapping=true)

@test vec(seqs[1,:]) == res"ARNDCQEGHILKMFPSTWYV"
Expand All @@ -292,7 +292,7 @@
@testset "Raw" begin

# AnnotatedMultipleSequenceAlignment
raw = read(joinpath(pwd(), "data", "gaps.txt"), Raw)
raw = read(joinpath(DATA, "gaps.txt"), Raw)
mat = getresidues(raw)
raw_string = """THAYQAIHQV
THAYQAIHQ-
Expand Down Expand Up @@ -360,16 +360,16 @@

# Example NBRF file: http://iubio.bio.indiana.edu/soft/molbio/readseq/classic/src/Formats
# "The sequence is free format and may be interrupted by blanks for ease of reading"
example = joinpath(pwd(), "data", "example.nbrf")
example = joinpath(DATA, "example.nbrf")
# Alignment file (PIR) from https://salilab.org/modeller/9v7/manual/node445.html
modeller = joinpath(pwd(), "data", "modeller.pir.gz")
modeller = joinpath(DATA, "modeller.pir.gz")
# http://emboss.sourceforge.net/docs/themes/seqformats/NbrfFormat.html
# "sequence may contain punctuation symbols to indicate various degrees of
# reliability of the data"
emboss = joinpath(pwd(), "data", "emboss.pir")
emboss = joinpath(DATA, "emboss.pir")
# http://caps.ncbs.res.in/pass2v3/pir.html
# Example from pass2 with spaces added at the end of the id lines.
pass2 = joinpath(pwd(), "data", "pass2.pir")
pass2 = joinpath(DATA, "pass2.pir")

@testset "Read" begin

Expand Down Expand Up @@ -461,7 +461,7 @@

@testset "Duplicated identifiers" begin

duplicated_ids_file = joinpath(pwd(), "data", "duplicated_ids.pir")
duplicated_ids_file = joinpath(DATA, "duplicated_ids.pir")
@test_throws ArgumentError read(duplicated_ids_file, PIR)
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/MSA/Identity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

@testset "MSA" begin

fasta = read(joinpath(pwd(), "data", "Gaoetal2011.fasta"), FASTA)
fasta = read(joinpath(DATA, "Gaoetal2011.fasta"), FASTA)
id = percentidentity(fasta)

@test id[1,1] == 100.0
Expand All @@ -80,7 +80,7 @@

@testset "Gaps" begin

aln = read(joinpath(pwd(), "data", "gaps.txt"), Raw)
aln = read(joinpath(DATA, "gaps.txt"), Raw)
id = percentidentity(aln)

@test id[1,1] == 100.0
Expand Down Expand Up @@ -110,7 +110,7 @@

@testset "Percent Similarity" begin

fasta = read(joinpath(pwd(), "data", "Gaoetal2011.fasta"), FASTA)
fasta = read(joinpath(DATA, "Gaoetal2011.fasta"), FASTA)

@testset "Gaps" begin

Expand Down
4 changes: 2 additions & 2 deletions test/MSA/MSAAnnotations.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@testset "MSA Annotations" begin

pfam = read(joinpath(pwd(), "data", "PF09645_full.stockholm"), Stockholm,
pfam = read(joinpath(DATA, "PF09645_full.stockholm"), Stockholm,
generatemapping=true, useidcoordinates=true)

F112_SSV1 = collect(string(".....QTLNSYKMAEIMYKILEKKGELTLEDILAQFEISVPSAYNIQRALKAIC",
"ERHPDECEVQYKNRKTTFKWIKQEQKEEQKQEQTQDNIAKIFDAQPANFEQTDQGFIKAKQ....."))

fasta = read(joinpath(pwd(), "data", "Gaoetal2011.fasta"), FASTA, generatemapping=true)
fasta = read(joinpath(DATA, "Gaoetal2011.fasta"), FASTA, generatemapping=true)

@testset "Mapping" begin

Expand Down
4 changes: 2 additions & 2 deletions test/MSA/MSAEditing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
AnnotatedMultipleSequenceAlignment
)

pf09645_sto = joinpath(pwd(), "data", "PF09645_full.stockholm")
gaoetal2011 = joinpath(pwd(), "data", "Gaoetal2011.fasta")
pf09645_sto = joinpath(DATA, "PF09645_full.stockholm")
gaoetal2011 = joinpath(DATA, "Gaoetal2011.fasta")

gaoetal_msas = [ read(gaoetal2011, FASTA, T) for T in msa_types ]
pfam_msas = [ read(pf09645_sto, Stockholm, T) for T in msa_types ]
Expand Down
4 changes: 2 additions & 2 deletions test/MSA/MSAStats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
AnnotatedMultipleSequenceAlignment
)

pf09645_sto = joinpath(pwd(), "data", "PF09645_full.stockholm")
gaoetal2011 = joinpath(pwd(), "data", "Gaoetal2011.fasta")
pf09645_sto = joinpath(DATA, "PF09645_full.stockholm")
gaoetal2011 = joinpath(DATA, "Gaoetal2011.fasta")

gaoetal_msas = [ read(gaoetal2011, FASTA, T) for T in msa_types ]
pfam_msas = [ read(pf09645_sto, Stockholm, T) for T in msa_types ]
Expand Down
2 changes: 1 addition & 1 deletion test/MSA/Shuffle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

N = length(msa_types)

pf09645_sto = joinpath(pwd(), "data", "PF09645_full.stockholm")
pf09645_sto = joinpath(DATA, "PF09645_full.stockholm")

msas = [ read(pf09645_sto, Stockholm, T) for T in msa_types ]
gaps = [ msa .== GAP for msa in msas ]
Expand Down
4 changes: 2 additions & 2 deletions test/PDB/Contacts.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@testset "Contacts" begin

txt(code) = joinpath(pwd(), "data", string(uppercase(code), ".pdb"))
txt(code) = joinpath(DATA, string(uppercase(code), ".pdb"))

@testset "Piccolo" begin
# Using data from http://www-cryst.bioc.cam.ac.uk/~richard/piccolo/piccolo.php?PDB=1IGY (28/Sep/2015)
Expand Down Expand Up @@ -97,7 +97,7 @@

@testset "1AKS" begin

pdb = read(joinpath(pwd(), "data", "1AKS.xml.gz"), PDBML)
pdb = read(joinpath(DATA, "1AKS.xml.gz"), PDBML)

CA = @residuesdict pdb model "1" chain "A" group "ATOM" residue All
CB = @residuesdict pdb model "1" chain "B" group "ATOM" residue All
Expand Down
4 changes: 2 additions & 2 deletions test/PDB/Kabsch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@
end

@testset "PDBResidue without alpha-carbon" begin
small_2WEL = read(joinpath(pwd(), "data", "2WEL_D_region.pdb"), PDBFile)
small_6BAB = read(joinpath(pwd(), "data", "6BAB_D_region.pdb"), PDBFile)
small_2WEL = read(joinpath(DATA, "2WEL_D_region.pdb"), PDBFile)
small_6BAB = read(joinpath(DATA, "6BAB_D_region.pdb"), PDBFile)

aln_2WEL, aln_6BAB, RMSD = superimpose(small_2WEL, small_6BAB)
@test length(aln_2WEL) == 3
Expand Down
8 changes: 4 additions & 4 deletions test/PDB/PDB.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@testset "Parse PDB and PDBML" begin

txt(code) = joinpath(pwd(), "data", string(uppercase(code), ".pdb"))
xml(code) = joinpath(pwd(), "data", string(uppercase(code), ".xml"))
txt(code) = joinpath(DATA, string(uppercase(code), ".pdb"))
xml(code) = joinpath(DATA, string(uppercase(code), ".xml"))

@testset "2VQC: Missings" begin

Expand Down Expand Up @@ -289,7 +289,7 @@
@testset "Foldseek" begin
# PDB files generated by Foldseek have only 66 columns; element identifiers
# are missing (represented as empty strings). Those files only contain CA atoms.
pdb_file = joinpath(pwd(), "data", "foldseek_example.pdb")
pdb_file = joinpath(DATA, "foldseek_example.pdb")
pdb = read(pdb_file, PDBFile)

# The example file has only 8 residues and one chain (A)
Expand All @@ -316,7 +316,7 @@ end

@testset "Write PDB files" begin

txt(code) = joinpath(pwd(), "data", string(uppercase(code), ".pdb"))
txt(code) = joinpath(DATA, string(uppercase(code), ".pdb"))

@testset "2VQC" begin
code = "2VQC"
Expand Down
2 changes: 1 addition & 1 deletion test/PDB/Sequences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ end

@testset "Extract protein sequences from PDB" begin

file(code) = joinpath(pwd(), "data", string(uppercase(code), ".pdb"))
file(code) = joinpath(DATA, string(uppercase(code), ".pdb"))

@testset "2VQC: Missings & selenomethionines" begin
res = read(file("2VQC"), PDBFile)
Expand Down
8 changes: 4 additions & 4 deletions test/Pfam/Pfam.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ end

@testset "PDB code" begin

msa = read(joinpath(pwd(), "data", "PF09645_full.stockholm"), Stockholm)
msa = read(joinpath(DATA, "PF09645_full.stockholm"), Stockholm)
@test getseq2pdb(msa)["F112_SSV1/3-112"] == [("2VQC","A")]
end

@testset "Mapping PDB/Pfam" begin

msa_file = joinpath(pwd(), "data", "PF09645_full.stockholm")
sifts_file = joinpath(pwd(), "data", "2vqc.xml.gz")
pdb_file = joinpath(pwd(), "data", "2VQC.xml")
msa_file = joinpath(DATA, "PF09645_full.stockholm")
sifts_file = joinpath(DATA, "2vqc.xml.gz")
pdb_file = joinpath(DATA, "2VQC.xml")
msa = read(msa_file, Stockholm, generatemapping=true, useidcoordinates=true)
cmap = msacolumn2pdbresidue(msa, "F112_SSV1/3-112", "2VQC", "A", "PF09645", sifts_file)
res = residuesdict(read(pdb_file, PDBML), "1", "A", "ATOM", All)
Expand Down
Loading

0 comments on commit 55cbc99

Please sign in to comment.