Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jass_preprocessing
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Statistical-Genetics
jass_preprocessing
Commits
d2f5af12
Commit
d2f5af12
authored
7 years ago
by
Hanna JULIENNE
Browse files
Options
Downloads
Patches
Plain Diff
module to align GWAS onto the reference panel
parent
b3fb8ef1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jass_preprocessing/jass_preprocessing/map_reference/map_reference.py
+6
-2
6 additions, 2 deletions
...cessing/jass_preprocessing/map_reference/map_reference.py
main_preprocessing.py
+19
-11
19 additions, 11 deletions
main_preprocessing.py
with
25 additions
and
13 deletions
jass_preprocessing/jass_preprocessing/map_reference/map_reference.py
+
6
−
2
View file @
d2f5af12
...
...
@@ -23,8 +23,12 @@ def map_on_ref_panel(gw_df , ref_panel):
ref_panel
[
'
key2
'
]
=
ref_panel
.
apply
(
key2
,
1
)
merge_GWAS
=
pd
.
merge
(
ref_panel
,
gw_df
,
how
=
'
inner
'
,
indicator
=
True
,
left_index
=
True
,
right_index
=
True
)
other_snp
=
pd
.
merge
(
ref_panel
,
gw_df
,
how
=
'
inner
'
,
indicator
=
True
,
left_on
=
'
key2
'
,
right_index
=
True
)
inter_index
=
ref_panel
.
index
.
intersection
(
gw_df
.
index
)
print
(
"
SNps {}
"
.
format
(
len
(
inter_index
)))
merge_GWAS
=
pd
.
merge
(
ref_panel
.
loc
[
inter_index
],
gw_df
.
loc
[
inter_index
],
how
=
'
inner
'
,
indicator
=
True
,
left_index
=
True
,
right_index
=
True
)
inter_index
=
gw_df
.
index
.
intersection
(
ref_panel
.
index
)
other_snp
=
pd
.
merge
(
ref_panel
.
loc
[
inter_index
],
gw_df
.
loc
[
inter_index
],
how
=
'
inner
'
,
indicator
=
True
,
left_on
=
'
key2
'
,
right_index
=
True
)
merge_GWAS
.
loc
[
other_snp
.
index
]
=
other_snp
return
(
merge_GWAS
)
...
...
This diff is collapsed.
Click to expand it.
main_preprocessing.py
+
19
−
11
View file @
d2f5af12
...
...
@@ -13,7 +13,7 @@ import pandas as pd
import
matplotlib.pyplot
as
plt
import
jass_preprocessing
as
jp
import
pandas
as
pd
import
seaborn
as
sns
perSS
=
0.7
netPath
=
"
/mnt/atlas/
"
# '/home/genstat/ATLAS/'
...
...
@@ -27,22 +27,22 @@ outFileName = netPath+'PCMA/1._DATA/ZSCORE_merged_ALL_NO_strand_ambiguous.hdf5'
def_missing
=
[
''
,
'
#N/A
'
,
'
#N/A
'
,
'
N/A
'
,
'
#NA
'
,
'
-1.#IND
'
,
'
-1.#QNAN
'
,
'
-NaN
'
,
'
-nan
'
,
'
1.#IND
'
,
'
1.#QNAN
'
,
'
N/A
'
,
'
NA
'
,
'
NULL
'
,
'
NaN
'
,
'
nan
'
,
'
na
'
,
'
.
'
]
out_summary
=
"
summary_GWAS.csv
"
ImpG_output_Folder
=
netPath
+
'
PCMA/1._DATA/ImpG_zfiles/
'
ImpG_output_Folder
=
netPath
+
'
PCMA/1._DATA/preprocessing_test/
'
gwas_map
=
pd
.
read_csv
(
GWAS_labels
,
sep
=
"
\t
"
,
index_col
=
0
)
GWAS_labels
gwas_map
=
pd
.
read_csv
(
GWAS_labels
,
sep
=
"
\t
"
,
index_col
=
0
,
nrows
=
10
)
GWAS_table
=
[
"
GWAS_DBP_recoded.txt
"
,
"
GWAS_MAP_recoded.txt
"
,
"
GWAS_PP_recoded.txt
"
,
"
GWAS_SBP_recoded.txt
"
]
GWAS_table
=
[
"
GWAS_DBP_recoded.txt
"
,
"
GWAS_MAP_recoded.txt
"
,
"
GWAS_PP_recoded.txt
"
,
"
GWAS_SBP_recoded
_dummy
.txt
"
]
gwas
=
jp
.
map_gwas
.
gwas_internal_link
(
GWAS_table
,
GWAS_path
)
gwas
column_dict
=
pd
.
read_csv
(
GWAS_labels
,
sep
=
'
\t
'
,
na_values
=
'
na
'
)
my_labels
=
column_dict
[
column_dict
[
'
filename
'
]
==
gwas
.
iloc
[
0
,
0
]]
column_dict
[[
'
freq
'
]]
# READ GWAS
GWAS_filename
=
GWAS_table
[
0
]
GWAS_filename
=
GWAS_table
[
3
]
GWAS_link
=
jp
.
map_gwas
.
walkfs
(
GWAS_path
,
GWAS_filename
)[
2
]
GWAS_link
...
...
@@ -54,12 +54,20 @@ gw_df.head()
ref
=
pd
.
read_csv
(
REF_filename
,
header
=
None
,
sep
=
"
\t
"
,
names
=
[
'
chr
'
,
"
pos
"
,
"
snp_id
"
,
"
ref
"
,
"
alt
"
,
"
MAF
"
],
index_col
=
"
snp_id
"
)
inter_index
=
ref
.
index
.
intersection
(
gw_df
.
index
)
test_merge
=
pd
.
merge
(
ref
.
loc
[
inter_index
],
gw_df
.
loc
[
inter_index
],
how
=
'
inner
'
,
indicator
=
True
,
left_index
=
True
,
right_index
=
True
)
print
(
jp
.
map_reference
.
map_on_ref_panel
)
mgwas
=
jp
.
map_reference
.
map_on_ref_panel
(
gw_df
,
ref
)
mgwas
mgwas
=
jp
.
map_reference
.
compute_snp_alignement
(
mgwas
)
mgwas
.
head
()
zscore
=
np
.
sqrt
(
ss
.
chi2
.
isf
(
mgwas
[
'
pval
'
],
1
))
*
np
.
sign
(
mgwas
.
z
)
*
mgwas
[
"
sign_flip
"
]
mgwas
=
jp
.
compute_score
.
compute_z_score
(
mgwas
)
mgwas
=
jp
.
compute_score
.
compute_sample_size
(
mgwas
,
"
/mnt/atlas/PCMA/1._DATA/RAW.GWAS/ICPB_bloodPress/
"
,
"
test_samp
"
)
mgwas
.
reset_index
(
inplace
=
True
)
mgwas
.
set_index
(
"
chr
"
,
inplace
=
True
)
n
p
.
isinf
(
ref
.
head
().
pos
).
any
()
j
p
.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment