dir='/Net/mus/data/www/19genomes/variants.tables/';
filename='chr1.alleles.txt';
whole=[dir filename];
fileID = fopen(whole);
%columns chromomsome, psebp, bp, no. alleles, major AF, 19 strains
i=1;
k=1
no_founders=19;
maxlen=100;
while ~feof(fileID)

tline = fgetl(fileID);
w=length(tline)
%pause
if w<maxlen
raw_founder_data = textscan(tline, '%f %f %f %f %f %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s ');
if k==1
else
    for j=1:no_founders
    if j==1 
        tempd=raw_founder_data{5+j};
    else
        tempd=horzcat(tempd, raw_founder_data{5+j});
    end
    end
    a=cellfun('length',tempd);
    d=max(a');
    if d==1
        
        raw_chromosome(i)=raw_founder_data{1};
        founder_pse_bp(i)=raw_founder_data{2};
        founder_data(i,:)=tempd;
        i=i+1;
    end
end
end
%founder_data=horzcat(founder_data, raw_founder_data{5+i});
k=k+1;
end
clearvars raw_founder_data
clearvars tempd
for i=1:length(raw_chromosome)
    ch=num2str(raw_chromosome(i));
    chr='chr';
    chr1=[chr ch];
    chromosome{i}=chr1;
end
clearvars raw_chromosome
filename1='founder_data_ch1';
save(filename1);

