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
Maximilian Beckers
FDRthresholding
Commits
aefff9ba
Commit
aefff9ba
authored
Feb 03, 2019
by
Maximilian Beckers
Browse files
local stud
parent
ef071628
Changes
2
Hide whitespace changes
Inline
Side-by-side
confidenceMapUtil/FDRutil.py
View file @
aefff9ba
...
...
@@ -277,21 +277,23 @@ def checkNormality(map, windowSize, boxCoord):
print
(
output
);
#------------------------------------------------------------------------------------
def
normal
izeMap
(
map
,
mean
,
var
):
def
student
izeMap
(
map
,
mean
,
var
):
#****************************************
#********* normalize map ****************
#****************************************
if
np
.
isscalar
(
var
):
norm
Map
=
np
.
subtract
(
map
,
mean
);
norm
Map
=
np
.
multiply
(
norm
Map
,
(
1.0
/
(
math
.
sqrt
(
var
))));
stud
Map
=
np
.
subtract
(
map
,
mean
);
stud
Map
=
np
.
multiply
(
stud
Map
,
(
1.0
/
(
math
.
sqrt
(
var
))));
else
:
#if local variances are known, use them
var
[
var
==
0
]
=
1000
;
normMap
=
np
.
subtract
(
map
,
mean
);
normMap
=
np
.
divide
(
normMap
,
np
.
sqrt
(
var
));
return
normMap
;
var
[
var
==
0
]
=
1000
;
studMap
=
np
.
subtract
(
map
,
mean
);
studMap
=
np
.
divide
(
studMap
,
np
.
sqrt
(
var
));
var
[
var
==
1000
]
=
0.0
;
studMap
[
var
==
0.0
]
=
0.0
;
return
studMap
;
#-----------------------------------------------------------------------------------
...
...
@@ -307,13 +309,13 @@ def calcQMap(map, mean, var, ECDF, windowSize, boxCoord, mask, method, test):
#calculate the test statistic
if
np
.
isscalar
(
var
):
#map[map == 0.0] = -100000000;
map
=
np
.
subtract
(
map
,
mean
);
tMap
=
np
.
multiply
(
map
,
(
1.0
/
(
math
.
sqrt
(
var
))));
t
map
=
np
.
subtract
(
map
,
mean
);
tMap
=
np
.
multiply
(
t
map
,
(
1.0
/
(
math
.
sqrt
(
var
))));
map
=
np
.
copy
(
tMap
);
else
:
var
[
var
==
0.0
]
=
1000.0
;
#just to avoid division by zero
map
=
np
.
subtract
(
map
,
mean
);
tMap
=
np
.
divide
(
map
,
np
.
sqrt
(
var
));
t
map
=
np
.
subtract
(
map
,
mean
);
tMap
=
np
.
divide
(
t
map
,
np
.
sqrt
(
var
));
var
[
var
==
1000.0
]
=
0.0
;
#upadte the mask, necessary as resmap is masking as well
mask
=
np
.
multiply
(
mask
,
var
);
...
...
confidenceMapUtil/confidenceMapMain.py
View file @
aefff9ba
...
...
@@ -113,6 +113,8 @@ def calculateConfidenceMap(em_map, apix, noiseBox, testProc, ecdf, lowPassFilter
# calculate the qMap
qMap
=
FDRutil
.
calcQMap
(
em_map
,
mean
,
var
,
ECDF
,
wn
,
boxCoord
,
circularMaskData
,
method
,
testProc
);
#em_map = FDRutil.studentizeMap(em_map, mean, var);
# if a explicit thresholding is wished, do so
if
fdr
is
not
None
:
...
...
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