mirror of
https://github.com/MillironX/beefblup.git
synced 2024-12-22 00:58:17 +00:00
Use Julia error/warn systems instead of printing to stdout
This commit is contained in:
parent
f985f4a700
commit
610c80e7c9
3 changed files with 23 additions and 16 deletions
|
@ -1,8 +1,8 @@
|
||||||
id,birthdate,dam,sire,year,sex,weaning_weight
|
id,birthdate,dam,sire,year,sex,species,weaning_weight
|
||||||
1,1/1/1990,,,1990,male,354
|
1,1/1/1990,,,1990,male,cow,354
|
||||||
2,1/1/1990,,,1990,female,251
|
2,1/1/1990,,,1990,female,cow,251
|
||||||
3,1/1/1991,,1,1991,male,327
|
3,1/1/1991,,1,1991,male,cow,327
|
||||||
4,1/1/1991,,1,1991,female,328
|
4,1/1/1991,,1,1991,female,cow,328
|
||||||
5,1/1/1991,2,1,1991,male,301
|
5,1/1/1991,2,1,1991,male,cow,301
|
||||||
6,1/1/1991,2,,1991,female,270
|
6,1/1/1991,2,,1991,female,cow,270
|
||||||
7,1/1/1992,,,1992,male,330
|
7,1/1/1992,,,1992,male,cow,330
|
||||||
|
|
|
13
gtktest.jl
Normal file
13
gtktest.jl
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using Gtk
|
||||||
|
openpath = open_dialog_native(
|
||||||
|
"Select a datasheet")
|
||||||
|
# GtkNullContainer(),
|
||||||
|
# ("*.csv", GtkFileFilter("*.csv", name="Comma-separated values"))
|
||||||
|
# )
|
||||||
|
|
||||||
|
# savepath = save_dialog_native(
|
||||||
|
# "Save your results",
|
||||||
|
# GtkNullContainer(),
|
||||||
|
# (GtkFileFilter("*.txt", name="Results file"),
|
||||||
|
# "*.txt")
|
||||||
|
# )
|
|
@ -18,7 +18,6 @@ using Gtk
|
||||||
# Main entry-level function - acts just like the script
|
# Main entry-level function - acts just like the script
|
||||||
function beefblup()
|
function beefblup()
|
||||||
|
|
||||||
### Prompt User
|
|
||||||
# Ask for an input spreadsheet
|
# Ask for an input spreadsheet
|
||||||
path = open_dialog_native(
|
path = open_dialog_native(
|
||||||
"Select a beefblup worksheet",
|
"Select a beefblup worksheet",
|
||||||
|
@ -75,10 +74,7 @@ fixedfx = select(data, Not([:id, :birthdate, :sire, :dam]))[:,1:end-1]
|
||||||
# Find any columns that need to be deleted
|
# Find any columns that need to be deleted
|
||||||
for i in 1:ncol(fixedfx)
|
for i in 1:ncol(fixedfx)
|
||||||
if length(unique(fixedfx[:,i])) <= 1
|
if length(unique(fixedfx[:,i])) <= 1
|
||||||
colname = names(fixedfx)[i]
|
@warn string("column '", names(fixedfx[i]), "' does not have any unique animals and will be removed from this analysis")
|
||||||
print("Column '")
|
|
||||||
print(colname)
|
|
||||||
print("' does not have any unique animals and will be removed from this analysis\n")
|
|
||||||
deletecols!(fixedfx,i)
|
deletecols!(fixedfx,i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -92,9 +88,7 @@ end
|
||||||
|
|
||||||
# If there are more groups than animals, then the analysis cannot continue
|
# If there are more groups than animals, then the analysis cannot continue
|
||||||
if sum(numgroups) >= numanimals
|
if sum(numgroups) >= numanimals
|
||||||
println("There are more contemporary groups than animals. The analysis will
|
throw(ErrorException("there are more contemporary groups than animals"))
|
||||||
now abort.")
|
|
||||||
exit()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Define a "normal" animal as one of the last in the groups, provided that
|
# Define a "normal" animal as one of the last in the groups, provided that
|
||||||
|
|
Loading…
Reference in a new issue