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
Statistical-Genetics
RAISS
Commits
3b326494
Commit
3b326494
authored
Mar 16, 2021
by
hjulienn
Browse files
modify load LD plink matrix function
parent
f75d1071
Changes
2
Hide whitespace changes
Inline
Side-by-side
raiss/ld_matrix.py
View file @
3b326494
...
...
@@ -74,7 +74,7 @@ def load_plink_ld(plink_ld, ref_chr_df):
plink_ld
=
plink_ld
+
".ld"
plink_ld
=
pd
.
read_csv
(
plink_ld
,
sep
=
"\s+"
)
mat_ld
=
plink_ld
.
pivot
(
index
=
'SNP_A'
,
columns
=
'SNP_B'
,
values
=
'R'
)
un_index
=
mat_ld
.
index
.
un
ion
(
mat_ld
.
columns
)
un_index
=
mat_ld
.
index
.
intersect
ion
(
mat_ld
.
columns
)
mat_ld
=
mat_ld
.
reindex
(
index
=
un_index
,
columns
=
un_index
)
mat_ld
.
fillna
(
0
,
inplace
=
True
)
sym
=
np
.
where
(
np
.
abs
(
mat_ld
.
values
)
>
np
.
abs
(
mat_ld
.
values
.
transpose
()),
mat_ld
.
values
,
mat_ld
.
values
.
transpose
())
...
...
raiss/stat_models.py
View file @
3b326494
...
...
@@ -104,5 +104,6 @@ def raiss_model(zt, sig_t, sig_i_t, lamb=0.01, rcond=0.01, batch=True):
var_norm
=
var_in_boundaries
(
var
,
lamb
)
R2
=
((
1
+
lamb
)
-
var_norm
)
print
(
R2
)
mu
=
mu
/
np
.
sqrt
(
R2
)
return
({
"var"
:
var
,
"mu"
:
mu
,
"ld_score"
:
ld_score
,
"condition_number"
:
condition_number
,
"correct_inversion"
:
correct_inversion
})
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