Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
QTL
spell-qtl
Commits
daa92cfa
Commit
daa92cfa
authored
Mar 20, 2018
by
Damien Leroux
Browse files
Closes
#7
.
parent
68898dde
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/error.h
View file @
daa92cfa
...
...
@@ -291,7 +291,7 @@ struct msg_handler_t {
/*std::cout << "Message handler instance created." << std::endl;*/
}
~
state_t
()
{
close_log_file
();
}
void
check
(
bool
fatal
);
bool
check
(
bool
fatal
);
void
reset
();
void
run_hooks
()
{
for
(
auto
&
f
:
hooks
)
{
f
();
}
}
void
close_log_file
()
...
...
@@ -321,7 +321,7 @@ struct msg_handler_t {
static
const
char
*
i
()
{
return
instance
().
info
();
}
static
const
char
*
n
()
{
return
instance
().
normal
();
}
static
void
check
(
bool
fatal
)
{
instance
().
check
(
fatal
);
}
static
bool
check
(
bool
fatal
)
{
return
instance
().
check
(
fatal
);
}
static
void
reset
()
{
instance
().
reset
();
}
static
void
hook
(
std
::
function
<
void
()
>&&
f
)
{
instance
().
hooks
.
push_back
(
f
);
}
...
...
@@ -703,7 +703,7 @@ struct scoped_indent {
};
inline
void
msg_handler_t
::
state_t
::
check
(
bool
fatal
)
inline
bool
msg_handler_t
::
state_t
::
check
(
bool
fatal
)
{
msg_handler_t
::
scoped_lock_type
_
(
msg_handler_t
::
mutex
);
if
(
count
>
0
)
{
...
...
@@ -718,8 +718,10 @@ inline void msg_handler_t::state_t::check(bool fatal)
exit
(
-
count
);
}
else
{
reset
();
return
true
;
}
}
return
false
;
}
inline
void
msg_handler_t
::
state_t
::
reset
()
...
...
include/pedigree.h
View file @
daa92cfa
...
...
@@ -1473,6 +1473,18 @@ read_pedigree(const std::string& filename, char sep=';', size_t max_states=std::
for
(
const
auto
&
i
:
ret
.
items
)
{
msg_handler_t
::
cout
()
<<
"
\r
Processing entry "
<<
(
++
cur
)
<<
"/"
<<
ret
.
items
.
size
()
<<
" ["
<<
i
.
id
<<
':'
<<
i
.
p1
<<
':'
<<
i
.
p2
<<
"]...
\x1b
[K"
;
MSG_QUEUE_FLUSH
();
bool
fail
=
false
;
if
(
i
.
p1
!=
0
&&
ret
.
m_id
.
find
(
i
.
p1
)
==
ret
.
m_id
.
end
())
{
MSG_ERROR
(
"Unknown ID #"
<<
i
.
p1
<<
" in pedigree"
,
SPELL_STRING
(
"Add individual #"
<<
i
.
p1
<<
" to the pedigree file"
));
fail
=
true
;
}
if
(
i
.
p2
!=
0
&&
ret
.
m_id
.
find
(
i
.
p2
)
==
ret
.
m_id
.
end
())
{
MSG_ERROR
(
"Unknown ID #"
<<
i
.
p2
<<
" in pedigree"
,
SPELL_STRING
(
"Add individual #"
<<
i
.
p2
<<
" to the pedigree file"
));
fail
=
true
;
}
if
(
fail
)
{
return
{};
}
if
(
i
.
is_ancestor
())
{
ret
.
m_id
[
i
.
id
]
=
ret
.
ancestor
(
i
.
gen_name
);
}
else
if
(
i
.
is_dh
())
{
...
...
src/pedigree/main.cc
View file @
daa92cfa
...
...
@@ -35,6 +35,9 @@ int SPELL_PEDIGREE_MAIN(int argc, const char** argv)
print_usage
();
}
else
{
pedigree_type
ped
=
read_pedigree
(
settings
->
pedigree_filename
,
settings
->
csv_sep
,
settings
->
max_states
);
if
(
!
msg_handler_t
::
check
(
false
))
{
return
-
1
;
}
std
::
string
ped_output
;
if
(
settings
->
work_directory
==
""
)
{
settings
->
work_directory
=
"."
;
...
...
src/r-glue/spellmaptools.cc
View file @
daa92cfa
...
...
@@ -61,8 +61,8 @@ public:
EM
(
const
marker_vec
&
order
)
{
return
gamete_LV
.
EM
(
order
,
m_convergence_threshold
,
m_max_iterations
);
}
void
init_2pt_tr_at_inf
()
{
gamete_LV
.
init_2pt_tr_at_inf
();
}
double
twoMarkerLikelihood
(
int
i
,
double
r
)
{
return
gamete_LV
.
twoMarkerLikelihood
(
i
,
r
);
}
//
void init_2pt_tr_at_inf() { gamete_LV.init_2pt_tr_at_inf(); }
double
twoMarkerLikelihood
()
{
return
gamete_LV
.
twoMarkerLikelihood
AtInf
(
);
}
int
max_iterations
(
int
n
)
{
...
...
@@ -129,7 +129,7 @@ public:
double
best
=
em
.
likelihood
;
// instance->init_2pt_tr_at_inf();
// double inf_ref = instance->map_likelihood(minimap, at_worlds_end);
double
inf_ref
=
instance
->
twoMarkerLikelihood
(
0
,
.5
);
double
inf_ref
=
instance
->
twoMarkerLikelihood
();
double
value
=
best
-
inf_ref
;
// MSG_INFO("LOD(" << minimap[0] << " … " << minimap[1] << " => d=" << em.distances[0] << " best=" << best << " inf_ref=" << inf_ref << " value=" << value);
cache
.
emplace
(
key
,
value
);
...
...
@@ -231,7 +231,11 @@ SpellMapTools::SpellMapTools(std::string ped_filename, Rwrap::DataFrame observat
// MSG_DEBUG(__FILE__ << ':' << __LINE__);
data_time
=
std
::
time
(
nullptr
);
std
::
vector
<
std
::
string
>
args
=
{
"spell-pedigree"
,
"-wd"
,
wd
,
"-n"
,
name
,
"-p"
,
ped_filename
};
invoke_spell
(
SPELL_PEDIGREE_MAIN
,
args
);
int
ret
=
invoke_spell
(
SPELL_PEDIGREE_MAIN
,
args
);
if
(
ret
)
{
MSG_ERROR
(
"Something went wrong while loading the pedigree…"
,
""
);
return
;
}
}
else
{
// MSG_DEBUG(__FILE__ << ':' << __LINE__);
data_time
=
spell_ped_t
;
...
...
@@ -243,7 +247,7 @@ SpellMapTools::SpellMapTools(std::string ped_filename, Rwrap::DataFrame observat
// MSG_INFO("spell_mark_t=" << spell_mark_t);
/* Run spell-marker if needed */
if
(
spell_mark_t
<
data_time
)
{
if
(
spell_mark_t
<
data_time
&&
obs_gen
.
size
()
>
0
)
{
// MSG_DEBUG(__FILE__ << ':' << __LINE__);
std
::
stringstream
out
;
std
::
vector
<
std
::
string
>
args
=
{
"spell-marker"
,
"-wd"
,
wd
,
"-n"
,
name
,
"-Og"
,
"-Op"
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment