Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Antonio Politi
NPCMaturation
Commits
17830484
Commit
17830484
authored
Apr 02, 2017
by
Antonio Politi
Browse files
compare sd of FA and matlab fit
parent
dcfd95c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
rcode/compareFA_sd_fcs.R
0 → 100644
View file @
17830484
# compare standard deviation of different measurments with fits std and FluctuationAnalyzer estimated std
# Author: Antonio Politi
library
(
'ggplot2'
)
# import data ----
setwd
(
'C:\\Users\\toni\\Dropbox\\NPCMaturation\\matlabcode\\FCS\\example_data\\Alexa'
)
fitfiles
<-
list.files
(
pattern
=
'*.1c_opt.cof'
)
corfiles
<-
list.files
(
pattern
=
'*.1c_opt.cor'
)
fitall
<-
list
()
for
(
i
in
seq_along
(
fitfiles
))
{
cof
<-
read.csv
(
fitfiles
[
i
],
sep
=
'\t'
)
cof
<-
cof
[,
c
(
1
,
2
,
3
,
4
,
5
)]
cof
<-
na.omit
(
cof
)
colnames
(
cof
)
<-
c
(
'tau'
,
'Ch1'
,
'fitCh1'
,
'Ch2'
,
'fitCh2'
)
cor
<-
read.csv
(
corfiles
[
i
],
sep
=
'\t'
)
colnames
(
cor
)
<-
c
(
'tau'
,
'Ch1'
,
'sdCh1'
,
'Ch2'
,
'sdCh2'
)
idx
<-
match
(
cof
$
tau
,
cor
$
tau
)
cof
$
sdfitCh1
<-
sqrt
((
cof
$
fitCh1
-
cof
$
Ch1
)
^
2
)
cof
$
sdfitCh2
<-
sqrt
((
cof
$
fitCh2
-
cof
$
Ch2
)
^
2
)
cof
<-
cbind
(
cof
,
cor
[
idx
,
c
(
'sdCh1'
,
'sdCh2'
)])
cof
$
id
<-
i
fitall
<-
rbind
(
fitall
,
cof
)
}
# plot data -----
msd
<-
aggregate
(
cbind
(
Ch1
,
sdCh1
,
sdfitCh1
)
~
tau
,
data
=
fitall
,
function
(
fitall
)
c
(
mean
=
mean
(
fitall
),
sd
=
sd
(
fitall
)))
ggplot
(
data
=
msd
)
+
geom_point
(
aes
(
x
=
tau
,
y
=
Ch1
[,
'sd'
],
color
=
'sd (avg. 6 rep.)'
))
+
geom_point
(
aes
(
x
=
tau
,
y
=
sdfitCh1
[,
'mean'
],
color
=
'sqrt((G_exp - G_fit)^2)'
))
+
geom_point
(
aes
(
x
=
tau
,
y
=
sdCh1
[,
'mean'
],
color
=
'sd_FA'
))
+
geom_point
(
aes
(
x
=
tau
,
y
=
sdCh1
[,
'mean'
]
/
sqrt
(
20
),
color
=
'sd_FA/sqrt(20)'
))
+
scale_x_continuous
(
trans
=
'log'
)
+
ylab
(
'Estimated standard deviation'
)
+
guides
(
color
=
guide_legend
(
title
=
NULL
))
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