Commit 78e3eb81 authored by Hanna  JULIENNE's avatar Hanna JULIENNE
Browse files

testing new weighting

parent 74ab312b
reports/figures/LD_simulated.png

6.99 KB | W: | H:

reports/figures/LD_simulated.png

11.1 KB | W: | H:

reports/figures/LD_simulated.png
reports/figures/LD_simulated.png
reports/figures/LD_simulated.png
reports/figures/LD_simulated.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -149,4 +149,4 @@ if __name__ == '__main__':
Ssize.N_effective = Ssize.N_effective.astype(int, copy=False)
Ssize.to_csv("../../data/external/meta_data/N_effective.csv")
print(Ssize.head())
simulate_Z_scores("../../data/processed/Simulated/Genotypes/genotype2.csv", "../../data/processed/Simulated/Genotypes/LD_matrix2.csv", Ssize,"../../data/processed/Simulated/Zscores/Zscore", amp=0.25)
simulate_Z_scores("../../data/processed/Simulated/Genotypes/genotype3.csv", "../../data/processed/Simulated/Genotypes/LD_matrix3.csv", Ssize,"../../data/processed/Simulated/Zscores/Zscore", amp=0.25)
library(Matrix)
library(bindata)
nvar = 200 # Number of SNPs
nvar = 100 # Number of SNPs
P = runif(nvar, 0.1, 0.9)
......@@ -19,7 +19,7 @@ for( i in 1:(nvar-1)){
p11_range = get_possible_p11(p1,p2)
print(p11_range)
p11 = p11_range[1] + (p11_range[2] - p11_range[1]) * 0.6
p11 = p11_range[1] + (p11_range[2] - p11_range[1]) * 0.9
C12 = p11 - p1 * p2
cov_mat[i, j] = C12
......@@ -32,10 +32,10 @@ CC <- cov2cor(cov_mat)
## Simulate 10000 x-y pairs, and check that they have the specified
## correlation structure
larg=50
larg=100
dec_mat = matrix(rep(0, nvar^2), ncol=nvar)
dec <- exp(seq(0,-3, len=larg+1))
dec <- exp(seq(0,-1, len=larg+1))
for(i in 1:nvar){
upb = min(i+larg, nvar)
......@@ -55,5 +55,5 @@ x1 <- rmvbin(Nind, margprob = P, bincorr = CC_dec)
print("## Generate genotype 2: ")
x2 <- rmvbin(Nind, margprob = P, bincorr = CC_dec)
print("## save genotype:")
write.table(x1 + x2, "../../data/processed/Simulated/Genotypes/genotype2.csv", sep="\t")
write.table(CC_dec, "../../data/processed/Simulated/Genotypes/LD_matrix2.csv", sep="\t")
write.table(x1 + x2, "../../data/processed/Simulated/Genotypes/genotype3.csv", sep="\t")
write.table(CC_dec, "../../data/processed/Simulated/Genotypes/LD_matrix3.csv", sep="\t")
......@@ -25,7 +25,7 @@ def format_result_df(imp, id_masked, Z_known ,known):
result_dict_known = {
'pos': known,
"Z" : Z_known,
"Var": -1,
"Var": 0,
"ld_score" : -1,
"condition_number": -1,
"correct_inversion":-1,
......
......@@ -6,7 +6,7 @@ library(viridisLite)
setwd("/mnt/zeus/GGS/PROJECT_imputation_covidhg/hgcovid_imputation/src/visualization")
LD = fread("../../data/processed/Simulated/Genotypes/LD_matrix2.csv")
LD = fread("../../data/processed/Simulated/Genotypes/LD_matrix3.csv")
LD_mat = as.matrix(LD[,-1])
dimnames(LD_mat)[[2]] = NULL
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment