Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Statistical-Genetics
RAISS
Commits
b11049c0
Commit
b11049c0
authored
Mar 30, 2018
by
Hanna JULIENNE
Browse files
fix typo + concatenation of results
parent
8c2374aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
impute_jass/impute_jass/windows.py
View file @
b11049c0
...
...
@@ -103,11 +103,11 @@ def compute_window_and_size(start_ld_block, end_ld_block, window_size):
else
:
Nwindows
=
1
window_resize
=
np
.
ceil
(
int
(
end_ld_block
)
-
(
int
(
start_ld_block
)))
return
Nwindows
,
window_resize
def
format_result_df
(
imp
,
ref_panel
,
known
,
unknowns
):
result_dict
=
{
'pos'
:
ref_panel
.
loc
[
unknowns
,
'pos'
],
'A0'
:
ref_panel
.
loc
[
unknowns
,
"Ref_all"
],
...
...
@@ -119,7 +119,7 @@ def format_result_df(imp, ref_panel, known, unknowns):
"correct_inversion"
:
imp
[
"correct_inversion"
],
"Nsnp_to_impute"
:
len
(
known
)
}
column_order
=
[
'pos'
,
'A0'
,
"A1"
,
"Z"
,
"Var"
,
"ld_score"
,
"condition_number"
,
"correct_inversion"
,
"Nsnp_to_impute"
]
column_order
=
[
'pos'
,
'A0'
,
"A1"
,
"Z"
,
"Var"
,
"ld_score"
,
"condition_number"
,
"correct_inversion"
,
"Nsnp_to_impute"
]
batch_df
=
pd
.
DataFrame
(
result_dict
,
columns
=
column_order
)
return
batch_df
...
...
@@ -171,14 +171,14 @@ def impg_like_imputation(ld_file, ref_panel, zscore, window_size, buffer, lamb,
if
(
len
(
known
)
>
0
):
imp
=
impg_model
(
zt
,
sig_t
,
sig_i_t
,
lamb
=
lamb
,
rcond
=
rcond
,
batch
=
True
)
batch_df
=
format_result_df
(
imp
,
ref_panel
,
known
,
unknowns
)
:
batch_df
=
format_result_df
(
imp
,
ref_panel
,
known
,
unknowns
)
# keep only snp in the core window (and not in the buffer)
start_core_window
=
int
(
start_ld_block
)
+
i
*
window_resize
end_core_window
=
int
(
start_ld_block
)
+
(
i
+
1
)
*
window_resize
in_core_window
=
in_region
(
batch_df
.
pos
,
start_core_window
,
end_core_window
)
zscore_results
=
pd
.
concat
([
zscore_results
,
batch_df
.
loc
[
in_core_window
]])
zscore_results
=
pd
.
concat
([
zscore_results
,
batch_df
.
loc
[
in_core_window
,
zscore_results
.
columns
]])
i
=
i
+
1
print_progression
(
i
,
Nwindows
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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