Skip to content

Commit

Permalink
Fixes the tests to match the new, fixed, version
Browse files Browse the repository at this point in the history
  • Loading branch information
StuntsPT committed Aug 2, 2021
1 parent 7cf6cfb commit 56d10dd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pyRona/file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def lfmm_results_parser(lfmm_results_filename, assoc_threshold,
imut_indeces = [int(x) - 1 for x in immutables]
results = open(lfmm_results_filename, "r")
for snp, line in enumerate(results):

line = line.strip()
# line = [float(y) for x, y in enumerate(line.split(","))
# if x not in imut_indeces]
snp_assocs = [(str(snp + 1), covar_names[i]) for i, j in
Expand Down
Binary file modified tests/data/jar/LFMM_envdata.pickle
Binary file not shown.
Binary file modified tests/data/jar/file_parser.lfmm_results_parser.pickle
Binary file not shown.
9 changes: 5 additions & 4 deletions tests/test_file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_baypass_s_b_p():
"""
test_betai = fp.baypass_summary_betai_parser(
"../tests/data/Qsuber_GBS_mcmc_aux_summary_betai.out", 20,
["1", "2", "3"])
["1", "2", "3"], [str(x + 1) for x in range(16)])

with open("../tests/data/jar/"
"file_parser.baypass_summary_betai_parser.pickle", "rb") as fle:
Expand All @@ -75,7 +75,7 @@ def test_baypass_pij_parser():
"../tests/data/Qsuber_GBS_mcmc_aux_summary_pij.out",
fp.baypass_summary_betai_parser(
"../tests/data/Qsuber_GBS_mcmc_aux_summary_betai.out",
20, ["1", "2", "3"]))
20, ["1", "2", "3"], [str(x + 1) for x in range(16)]))

with open("../tests/data/jar/"
"file_parser.baypass_pij_parser.pickle", "rb") as fle:
Expand All @@ -91,12 +91,13 @@ def test_lfmm_res_parser():
lfmm_results = fp.lfmm_results_parser(
"../tests/data/Qsuber_lfmm_results.csv",
0.01,
["1", "2", "3"])
["1", "2", "3"],
[str(x) for x in range(16)])
with open("../tests/data/jar/file_parser.lfmm_results_parser.pickle",
"rb") as fle:
control_pvalues = pickle.load(fle)

assert str(lfmm_results) == str(control_pvalues)
assert lfmm_results == control_pvalues


def test_lfmm_to_pop_allele_freqs():
Expand Down
27 changes: 13 additions & 14 deletions tests/test_pyRona.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,17 +670,16 @@ def test_argument_parser():

test_arguments = pr.argument_parser(args)

control_arguments = (
"Namespace(bayes_factor=20.0, "
"baypass_pij_file='..tests/data/Qsuber_GBS_mcmc_aux_summary_pij.out',"
" baypass_summary_betai_file="
"'..tests/data/Qsuber_GBS_mcmc_aux_summary_betai.out',"
" future_covars_file='..tests/data/ENVFILE_rpc85',"
" immutables=[], map_filename=None, num_covars=3,"
" outfile='/home/baptista/Music/LOL',"
" outliers=True, plots='/tmp/indplots',"
" popnames_file='..tests/data/popnames_single_GEO.txt',"
" present_covars_file='..tests/data/ENVFILE', rtype='absdiff',"
" upstream='baypass', use_weights=True)")

assert str(test_arguments) == control_arguments
control_arguments = [
"Namespace(upstream='baypass'", " bayes_factor=20.0",
" baypass_pij_file='..tests/data/Qsuber_GBS_mcmc_aux_summary_pij.out')",
" baypass_summary_betai_file='..tests/data/Qsuber_GBS_mcmc_aux_summary_betai.out'",
" future_covars_file='..tests/data/ENVFILE_rpc85'",
" immutables=[]", " map_filename=None", " num_covars=3",
" outfile='/home/baptista/Music/LOL'",
" outliers=True", " plots='/tmp/indplots'",
" popnames_file='..tests/data/popnames_single_GEO.txt'",
" present_covars_file='..tests/data/ENVFILE'", " rtype='absdiff'",
" use_weights=True", " covar_names_file=None"]

assert sorted(str(test_arguments).strip().split(",")) == sorted(control_arguments)

0 comments on commit 56d10dd

Please sign in to comment.