Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
inPhase code repository
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
fritsch
inPhase code repository
Commits
68829ea8
Commit
68829ea8
authored
2 years ago
by
fritsch
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
6a4deedd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Data Analysis/analyzeInPhaseMat.m
+111
-0
111 additions, 0 deletions
Data Analysis/analyzeInPhaseMat.m
with
111 additions
and
0 deletions
Data Analysis/analyzeInPhaseMat.m
0 → 100644
+
111
−
0
View file @
68829ea8
function
[
dataFitsInd
,
dataFitsPooled
,
dataFused
]
=
analyzeInPhaseMat
(
pathIn
)
if
~
exist
(
'pathIn'
,
'var'
)
% user interaction to get folder that should be worked on
pathIn
=
uigetdir
;
end
filei_recursive
=
dir
([
pathIn
'/**/ResultsNew.mat'
]);
nFiles
=
length
(
filei_recursive
);
% list of control variables
listControlVar
=
{
'labelingFraction'
,
'saltConcentration'
,
'pH'
,
'drugConcentration'
};
% reset counters
counterFused
=
0
;
counterFitsInd
=
1
;
for
k
=
1
:
nFiles
tic
% path to the current results file
currFilePath
=
fullfile
(
filei_recursive
(
k
)
.
folder
,
filei_recursive
(
k
)
.
name
);
% diplay current folder and filename
disp
([
'Folder '
,
num2str
(
k
),
' of '
,
num2str
(
nFiles
)])
disp
([
'Current Path: '
,
currFilePath
])
% load the new results file
clear
(
'Results'
)
load
(
currFilePath
,
'Results'
);
% check for data with no detected emulsion droplets and remove
fieldNames1
=
fieldnames
(
Results
);
for
kk
=
1
:
numel
(
fieldNames1
)
fieldNames2
=
fieldnames
(
Results
.
(
fieldNames1
{
kk
}));
for
kkk
=
1
:
length
(
fieldNames2
)
indx
(
kk
,
kkk
)
=
isempty
(
Results
.
(
fieldNames1
{
kk
})
.
(
fieldNames2
{
kkk
}));
end
end
indx
=
sum
(
indx
'
)
>
0
;
Results
=
rmfield
(
Results
,
fieldNames1
(
indx
));
% prepare output of all data files fused into one struct
fieldi
=
fieldnames
(
Results
);
for
kk
=
1
:
length
(
fieldi
)
currName
=
[
'Experiment_'
,
num2str
(
kk
+
counterFused
,
'%04d'
)];
dataFused
.
(
currName
)
=
Results
.
(
fieldi
{
kk
});
end
counterFused
=
counterFused
+
length
(
fieldi
);
% scan through list of control variables
for
kk
=
1
:
length
(
listControlVar
)
controlVars
{
kk
}
=
unique
(
cell2mat
(
structCrawler
(
Results
,
listControlVar
{
kk
})
'
));
nAssays
(
kk
)
=
length
(
controlVars
{
kk
});
end
indx
=
nAssays
>
1
;
% individual temperatures are fitted
% if any other control variable was changed in one experiment it will
% be also separated and fitted individually for each temperature
if
sum
(
nAssays
)
==
length
(
listControlVar
)
temperatures
=
unique
(
cell2mat
(
structCrawler
(
Results
,
'temperature'
)
'
));
for
kk
=
1
:
length
(
temperatures
)
currResults
=
sortPDExperiments
(
Results
,
'temperature'
,
temperatures
(
kk
));
dataFitsInd
(
counterFitsInd
)
=
fitLinearConcSeries_V03_wBW
(
currResults
);
counterFitsInd
=
counterFitsInd
+
1
;
end
else
for
kk
=
1
:
nAssays
(
indx
)
currVar
=
controlVars
{
indx
};
currResults
=
sortPDExperiments
(
Results
,
listControlVar
{
indx
},
currVar
(
kk
));
temperatures
=
unique
(
cell2mat
(
structCrawler
(
currResults
,
'temperature'
)
'
));
for
kkk
=
1
:
length
(
temperatures
)
currResultsT
=
sortPDExperiments
(
currResults
,
'temperature'
,
temperatures
(
kkk
));
dataFitsInd
(
counterFitsInd
)
=
fitLinearConcSeries_V03_wBW
(
currResultsT
);
counterFitsInd
=
counterFitsInd
+
1
;
end
end
end
toc
end
% aggregate all datasets of same control variables and fit them pooled
for
k
=
1
:
length
(
listControlVar
)
controlVars
{
k
}
=
unique
(
cell2mat
(
structCrawler
(
dataFused
,
listControlVar
{
k
})
'
));
nAssays
(
k
)
=
length
(
controlVars
{
k
});
end
counterFitsFused
=
1
;
currVar1
=
unique
(
cell2mat
(
structCrawler
(
dataFused
,
listControlVar
{
1
})
'
));
for
k
=
1
:
length
(
currVar1
)
currResults1
=
sortPDExperiments
(
dataFused
,
listControlVar
{
1
},
currVar1
(
k
));
currVar2
=
unique
(
cell2mat
(
structCrawler
(
currResults1
,
listControlVar
{
2
})
'
));
for
kk
=
1
:
length
(
currVar2
)
currResults2
=
sortPDExperiments
(
currResults1
,
listControlVar
{
2
},
currVar2
(
kk
));
currVar3
=
unique
(
cell2mat
(
structCrawler
(
currResults2
,
listControlVar
{
3
})
'
));
for
kkk
=
1
:
length
(
currVar3
)
currResults3
=
sortPDExperiments
(
currResults2
,
listControlVar
{
3
},
currVar3
(
kkk
));
temperatures
=
unique
(
cell2mat
(
structCrawler
(
currResults3
,
'temperature'
)
'
));
for
kkkk
=
1
:
length
(
temperatures
)
currResults4
=
sortPDExperiments
(
currResults3
,
'temperature'
,
temperatures
(
kkkk
));
dataFitsPooled
(
counterFitsFused
)
=
fitLinearConcSeries_V03_wBW
(
currResults4
);
counterFitsFused
=
counterFitsFused
+
1
;
end
end
end
end
end
\ No newline at end of file
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