function getSimParameter(inFolder,outFile,numSeq,shortest,longest)
list=dir(inFolder);
c=1;
for i=3:1:size(list,1)
    ID=list(i).name;
    a=fastaread([inFolder,'/',ID]);
    seq=a.Sequence;
    if size(seq,2)<longest
        continue
    end
    SimSetting(c,1).ID=ID;
    SimSetting(c,1).Len=size(seq,2);
    c=c+1;
end

sum=0;
for i=1:1:size(SimSetting,1)
    sum=sum+SimSetting(i,1).Len;
end
for i=1:1:size(SimSetting,1)
    SimSetting(i,1).LenPercent=SimSetting(i,1).Len/sum;
end

for i=1:1:size(SimSetting,1)
    if SimSetting(i).Len<longest
        continue
    end
    SimSetting(i).num=max(1,round(numSeq*SimSetting(i).LenPercent));
end

sum=0;
for i=1:1:size(SimSetting,1)
    sum=sum+SimSetting(i).num;
end

if sum<numSeq
    del=numSeq-sum;
    add=randperm(size(SimSetting,1));
    for i=1:1:del
        SimSetting(add(i)).num=SimSetting(add(i)).num+1;
    end
end

if numSeq<sum
    del=sum-numSeq;
    minu=randperm(size(SimSetting,1));
    m=0;
    mm=1;
    while m<del
        if SimSetting(minu(mm)).num==1
            mm=mm+1;
            continue
        end
        SimSetting(minu(mm)).num=SimSetting(minu(mm)).num-1;
        m=m+1;
        mm=mm+1;
    end
end

SimParameter.SimSetting=SimSetting;
SimParameter.shortest=shortest;
SimParameter.longest=longest;
save(outFile,'SimParameter')
    
