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
702de52a
Commit
702de52a
authored
Feb 13, 2017
by
Antonio Politi
Browse files
Ask for directory
parent
89010012
Changes
4
Hide whitespace changes
Inline
Side-by-side
matlabcode/FCS/master_workflow_fit_dye.m
View file @
702de52a
function
master_workflow_fit_dye
function
master_workflow_fit_dye
(
wd
)
% MASTER_WORKFLOW_FIT_DYE call workflow_fit_dye for several directorie
% specified in the script
%
% Antonio Politi, EMBL, January 2017
wd
=
'Z:\AntonioP_elltier1\CelllinesImaging\MitoSysPipelines'
;
cd
(
wd
);
if
nargin
<
1
wd
=
uigetdir
(
'.'
,
'Specify main directory where to search for Alexa dye folders'
);
%wd = 'Z:\AntonioP_elltier1\CelllinesImaging\MitoSysPipelines';
cd
(
wd
);
end
if
~
exist
(
fullfile
(
wd
,
'ProcessingHelpFiles'
));
mkdir
(
fullfile
(
wd
,
'ProcessingHelpFiles'
));
end
...
...
@@ -26,4 +29,5 @@ for idir = 1:length(indirCell)
indir
=
indirCell
{
idir
};
display
([
'master_workflow_fit_dye processing directory '
num2str
(
idir
)
' '
indir
])
workflow_fit_dye
(
indir
,
kappaVal
,
outputdir
,
'1c'
);
end
\ No newline at end of file
matlabcode/FCS/testWriteresToSubfolder.m
0 → 100644
View file @
702de52a
function
main
()
%%
resfile
=
'Z:\AntonioP_elltier1\CelllinesImaging\MitoSysPipelines\161216_WAPLgfpc\MitoSys2\2c_proc_weight0.res'
;
matlabcode/FCS/workflow_fit_dye.m
View file @
702de52a
function
[
focVol
]
=
workflow_fit_dye
(
indir
,
kappaVal
,
outputdir
,
FAsession
)
% COMPUTEDIRECTORY perform fitting of dye in a specific directory. program
% assumes that traces of one experiment are all in one directory
% assumes that traces of one experiment are all in one directory
!
% INPUT:
% inidir - directory where to extract files
% kappaVal - a vector of kappa values
...
...
@@ -161,7 +161,7 @@ else
%% find best fit
mNorm
=
mean
(
normN
,
2
);
% mean of normalized norms along experiments
[
val
,
pos
]
=
min
(
mean
(
normN
,
2
));
% find minimum at pos
kappa
=
kappaVal
(
pos
);
% kappa value
kappa
=
kappaVal
(
pos
);
% kappa value
end
%% Compute means from mean tauD1 and mean N. Using directly the data could increase error on focal volume (^3)
for
i
=
1
:
lk
...
...
@@ -232,11 +232,10 @@ for iC = 1:2
end
end
%% update xml files
%% update xml files
and write a res file
if
~
ZEN
for
iD
=
1
:
length
(
dataC
)
node
=
xmlFA
.
readnode
(
xmlFAfiles
{
iD
});
[
path
,
fout
,
ext
]
=
fileparts
(
xmlFAfiles
{
iD
});
fname_out
=
fullfile
(
path
,
[
fout
'_opt'
ext
]);
idxs
=
MO
.
getDataIndexes
(
dataC
{
iD
},
MO
.
tauBoundary
);
...
...
@@ -261,6 +260,9 @@ if ~ZEN
xmlFA
.
writenode
(
fname_out
,
node
);
end
end
%% plot results
for
iC
=
1
:
2
if
(
dataC
{
1
}(
1
,
iC
*
2
)
==
0
)
% do not process if channel has not been acquired
...
...
matlabcode/FCS/workflow_fit_protein.m
View file @
702de52a
function
workflow_fit_protein
(
resfile
,
FAsession
)
function
outfiles
=
workflow_fit_protein
(
resfile
,
FAsession
)
% WORKFLOW_FIT_PROTEIN perform fitting of protein data using as input a res file from FA
% INPUT:
% resfile - a result file containing the directory where to extract files
...
...
@@ -17,19 +17,33 @@ if nargin < 1
return
end
resfile
=
fullfile
(
pathname
,
resfile
);
end
[
pathname
,
resbase
,
ext
]
=
fileparts
(
resfile
);
flintfile
=
fullfile
(
pathname
,
[
resbase
'.fint'
]);
if
nargin
<
2
FAsession
=
'2c'
;
end
if
~
exist
(
resfile
)
display
([
'Could not find resfile'
resfile
]);
end
%% Initialization
% load model class
clear
(
'MO'
);
MO
=
proteinFcsmodel
();
% read FA result table
if
exist
(
flintfile
)
flintT
=
readtable
(
flintfile
,
'Delimiter'
,
'\t'
,
'FileType'
,
'text'
);
else
flintT
=
[];
end
restable2c
=
readtable
(
resfile
,
'Delimiter'
,
'\t'
,
'Header'
,
1
,
'FileType'
,
'text'
,
'TreatAsEmpty'
,{
'NA'
});
restable1c
=
restable2c
;
% stat entries
restable1c
.
P11Name
=
repmat
({
'pValueLRT'
},
length
(
restable1c
.
P11Name
),
1
);
restable1c
.
P12Name
=
repmat
({
'pValueFtest'
},
length
(
restable1c
.
P11Name
),
1
);
...
...
@@ -40,8 +54,17 @@ restable2c.P11Name = repmat({'pValueLRT'}, length(restable1c.P11Name),1);
restable2c
.
P12Name
=
repmat
({
'pValueFtest'
},
length
(
restable1c
.
P11Name
),
1
);
restable2c
.
P13Name
=
repmat
({
'PAIC'
},
length
(
restable1c
.
P11Name
),
1
);
restable2c
.
P14Name
=
repmat
({
'BIC'
},
length
(
restable1c
.
P11Name
),
1
);
%% write fluorescence intensity to table
if
~
isempty
(
flintT
)
restable1c
.
class
=
flintT
.
class
;
restable2c
.
class
=
flintT
.
class
;
for
px
=
[
1
,
3
,
5
,
9
];
for
iCh
=
1
:
2
restable1c
(:,
sprintf
(
'flint%dCh%d'
,
px
,
iCh
))
=
flintT
(:,
sprintf
(
'Ch%d_%d_%d_'
,
iCh
,
px
,
px
));
restable2c
(:,
sprintf
(
'flint%dCh%d'
,
px
,
iCh
))
=
flintT
(:,
sprintf
(
'Ch%d_%d_%d_'
,
iCh
,
px
,
px
));
end
end
end
%% this write empty entries as NaN (must double check afterwards in particular for annotation)
...
...
@@ -82,16 +105,6 @@ switch cond
ZEN
=
1
;
end
%% define file prefix for images
if
ZEN
prefix
=
'parZEN'
;
else
prefix
=
'parFAcorr'
;
end
if
~
MO
.
weightChi2
prefix
=
[
prefix
'_unw'
];
end
%% load data into cell array dataC
display
([
'Load correlation data for '
resfile
])
...
...
@@ -197,8 +210,10 @@ end
%%
tmpfiles
=
{
fullfile
(
fileparts
(
resfile
),
[
'1c_tmp.res'
]),
...
fullfile
(
fileparts
(
resfile
),
[
'2c_tmp.res'
])};
outfiles
=
{
fullfile
(
fileparts
(
resfile
),
[
'1c_proc_weight'
num2str
(
MO
.
weightChi2
)
'.res'
]),
...
fullfile
(
fileparts
(
resfile
),
[
'2c_proc_weight'
num2str
(
MO
.
weightChi2
)
'.res'
])};
outfiles
=
{
fullfile
(
fileparts
(
resfile
),
[
'1c_opt'
weightStr
{
MO
.
weightChi2
+
1
}
'.res'
]),
...
fullfile
(
fileparts
(
resfile
),
[
'2c_opt'
weightStr
{
MO
.
weightChi2
+
1
}
'.res'
])};
tables
=
{
restable1c
,
restable2c
};
for
ifile
=
1
:
2
writetable
(
tables
{
ifile
},
tmpfiles
{
ifile
},
'WriteVariableNames'
,
false
,
'Delimiter'
,
'\t'
,
'FileType'
,
'text'
);
...
...
@@ -207,7 +222,12 @@ for ifile = 1:2
fileout
=
fopen
(
outfiles
{
ifile
},
'w'
);
for
i
=
1
:
2
tline
=
fgetl
(
filepre
);
fwrite
(
fileout
,
sprintf
(
'%s\n'
,
tline
)
);
if
i
==
2
% add extra column name for fluorescence intensity and class
str1
=
strjoin
(
restable1c
.
Properties
.
VariableNames
(
170
:
end
),
'\t'
);
tline
=
strjoin
({
tline
,
str1
},
'\t'
);
end
fwrite
(
fileout
,
sprintf
(
'%s\n'
,
tline
)
);
end
fclose
(
filepre
);
fclose
(
fileout
);
...
...
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