Commit 9b7852c9 authored by Jens Behrmann's avatar Jens Behrmann

Add script for the estimation of isotope size

parent d9682638
%% Isotope Size estimation
% Script to produce estimation results from supplemental material,
% section 1.1.1
% load data
[data, ~, ~] = setup_dataADvsSQ();
% select mass range
massRange = 520:1:4950;
massRange = massRange * 1.0005; % account for mass defect
%% Compute isotope patterns over mass range
isotopMatrix = zeros(length(massRange), length(data.mzVector));
skeletonMatrix = zeros(21, length(massRange));
for i = 1 : length(massRange)
[skeleton, gPattern, ~] = isotopicPattern(massRange(i), data.mzVector, 0.15, false);
isotopMatrix(i, :) = gPattern;
skeletonMatrix(:, i) = skeleton;
end
%% Plot number of peaks of isotope patterns over mass range
numPeaks = sum(skeletonMatrix > 0, 1);
figure;
plot(massRange, numPeaks)
%% Plot example isotope pattern with cut-off threshold
figure;
intensityThres = 1e-5;
mask = (isotopMatrix < intensityThres);
plot(data.mzVector, isotopMatrix(1386, :))
hold on
plot(data.mzVector, mask(1386,:))
xlabel('mass range [Da]')
ylabel('Intensity')
%% Plot size of bins per isotope pattern
intensityThres = 1e-5;
isotopMatrix(isotopMatrix < intensityThres) = 0;
numBins = sum(isotopMatrix > 0 , 2);
figure;
plot(massRange, numBins)
% add line corresponding to receptive field
hold on;
plot(massRange, 43* ones(length(numBins), 1))
xlabel('mass range [Da]')
ylabel('number of bins')
%legend('Estimation of Isotope Pattern Bins', 'Receptive Field Size')
%% Plot example from real data
data.setNormalization('tic')
tumorData = data.data(partition.classes.data ~= 0, :);
figure;
plot(data.mzVector, tumorData(100,:), 'b')
hold on
plot(data.mzVector, mask(1386,:), 'r')
% scaling
maskArea = data.mzVector > 1902 & data.mzVector < 1914;
maxInArea = max(tumorData(100, maskArea));
figure;
plot(data.mzVector, mask(1386,:), 'r')
scaledModel = isotopMatrix(1386, :);
scaledModel = maxInArea* (scaledModel / max(scaledModel));
hold on; plot(mzVector, scaledModel)
Markdown is supported
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