function ss = abc_summarize(H) % Apply summary statistics to single haplotype matrix. % ss= abc_summarize(H) % % Summarize haplotype data in H. % assume the following settings: % 'Lyon, France' 8 'Leiden, The Netherlands' 11 'Gikongoro, Rwanda' 26 'Siavonga, Zambia' 21 % % Inputs: % H : Haplotype matrix % % Outputs: % ss : Vector with summary statistics % abc_summarize_struct.m % Written by Andreas Wollstein, Ludwig Maximilians University of Munich. % Copyright (c) 2015 % % This file is part of a set of Matlab scripts published with: % Bozicevic et al. 2015 Molecular Ecology % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program. If not, see . % summarize populations % assume H consists of 0 1 and nans if size(H,1) ~= 66 ss = zeros(1,38); return; end if size(H,2) < 3 ss = zeros(1,38); return; end p1 = 1:8; p2 = 9:19; p3 = 20:45; p4 = 46:66; H = double(H); s1 = (aSFS(H(p1,:))); s2 = (aSFS(H(p2,:))); s3 = (aSFS(H(p3,:))); s4 = (aSFS(H(p4,:))); s1 = s1(1:end-1); s2 = s2(1:end-1); s3 = s3(1:end-1); s4 = s4(1:end-1); s1 = fold(s1); s2 = fold(s2); s3 = fold(s3); s4 = fold(s4); H(H==1) = 3; H(H==0) = 1; f1 = Fstc(H(p1,:),H(p2,:)); f2 = Fstc(H(p1,:),H(p3,:)); f3 = Fstc(H(p1,:),H(p4,:)); f4 = Fstc(H(p2,:),H(p3,:)); f5 = Fstc(H(p2,:),H(p4,:)); f6 = Fstc(H(p3,:),H(p4,:)); % f1(f1<0) = nan; % f2(f2<0) = nan; % f3(f3<0) = nan; % f4(f4<0) = nan; % f5(f5<0) = nan; % f6(f6<0) = nan; ss = [s1 s2 s3 s4 nanmean(f1) nanmean(f2) nanmean(f3) nanmean(f4) nanmean(f5) nanmean(f6)]; end