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

Qqplot bug #200

Merged
merged 4 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions src/outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function qqplot(output, results)
for pvalue_col ∈ pvalue_cols
pvalues = -log10.(filter(x -> !isnan(x), results[!, pvalue_col]))
n = length(pvalues)
# If only 1 non-NA p-value, exit function
if n <= 1
return
olivierlabayle marked this conversation as resolved.
Show resolved Hide resolved
end
unif_quantiles = log10_uniform_quantiles(n)
qqplot!(ax, unif_quantiles, pvalues, qqline=:identity, label=replace(string(pvalue_col), "_PVALUE" => ""))
end
Expand Down
5 changes: 5 additions & 0 deletions test/outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ include(joinpath(TESTDIR, "testutils.jl"))
tmle = failed_estimate["TMLE"]
@test tmle["PVALUE"] === NaN
@test tmle["EFFECT_SIZE"] == "Failed"

# Check subsetted results & optional QQplot generation
olivierlabayle marked this conversation as resolved.
Show resolved Hide resolved
sub_results = results[1:1, :]
TargeneCore.qqplot(TargeneCore.make_filepath_from_prefix(tmpdir; filename = "Non_existent_QQ.png"), sub_results)
@test !isfile(joinpath(tmpdir, "Non_existent_QQ.png"))
end

end
Expand Down
Loading