folders = dir('*DT1*');
z = zeros(1,251);
vals = [0,0];

for i = 1:length(folders)
    cd(folders(i).name)
    if exist('temp_assembly_peer_prediction.mat') ~= 0
        
        load temp_assembly_peer_prediction
        subplot(2,1,1)
        for j = 1:size(dev,1)
            d = mean(dev(j,:,:),3);
            dc = mean(devControl(j,:,:),3);
            [a b] = min(d);
            [ac bc] = min(dc);
            scatter(b,(a-mean(d))./(ac-mean(dc)),'.k')
            hold on  
            if (a-mean(d))./(ac-mean(dc)) > 1.5 && b > 1
            z = z + zscore(d);
            end
            vals = [vals;b,(a-mean(d))./(ac-mean(dc))];
        end
        
        
        axis([0 250 min(z) max(z)])
        hold on
        total_pairs(i) = size(dev,1);
    end
    if exist('assemblies/104_assembly_peer_prediction.mat') ~= 0
        files = dir('assemblies/*.mat');
        for f = 1:length(files)
            load(['assemblies/' files(f).name],'dev','devControl')
            d = mean(dev,3)';
            dc = mean(devControl,3)'
            
            ;
            [a b] = min(d);
            [ac bc] = min(dc);
            scatter(b,(a-mean(d))./(ac-mean(dc)),'.k')
            hold on  
            if (a-mean(d))./(ac-mean(dc)) > 1.5 && b > 1
            z = z + zscore(d);
            end
            vals = [vals;b,(a-mean(d))./(ac-mean(dc))];
        end
    end
    cd ..    
end

subplot(2,1,2)
plot(z)
subplot(2,1,1)
axis([0 250 0 50])
line([0 250],[2 2],'color','r')
title(sum(total_pairs))
