%mIsostericityFilter_SummaryPrinter_10percent.m

OUTSummary      = strcat(OutputPath,PositionList,'_',FastaFilename,'_Statistics.out');
fidOUTSummary = fopen(OUTSummary,'w+');
% PrintArraySummary10per = [1 fidOUTSummary];
PrintArraySummary10per = [fidOUTSummary];

TotalBasepairs = length(AllowedCount(:,1));

if fidOUTSummary~=-1,
    for f=1:length(PrintArraySummary10per),
        fprintf(PrintArraySummary10per(f),'\n');
        %     fprintf(PrintArraySummary10per(f),'%s\n',OUTSummary);
        fprintf(PrintArraySummary10per(f),'%s\t%g\n\n','Total basepairs',TotalBasepairs);
%         fprintf(PrintArraySummary10per(f),'\t%s\t%s\t%s\n','% of Positions','Average % of Sequences here that follow the criteria','% of Positions here that are totally Isosteric');
        fprintf(PrintArraySummary10per(f),'\t%s\t%s\n','% of Positions','% of Positions here that are totally Isosteric');
        for P=ChosenDomains,
            fprintf(PrintArraySummary10per(f),'%s%s%g%s\n', DomainNames{P},' (',DomainLimits(P+1)-DomainLimits(P),' sequences)');
%             fprintf(PrintArraySummary10per(f),'%s\t%g\t%g\t%g\n', '<10% Forbidden or Gaps', round(Rounding*100*AllowedPerc(P)/(TotalBasepairs*Rounding)),     round(Rounding*100*AllowedCountPerc(P)/(AllowedPerc(P)*NSeq_all(P)*Rounding)),         round(Rounding*100*sum(IsostericANDAllowed(:,P))/(AllowedPerc(P)*Rounding)));
%             fprintf(PrintArraySummary10per(f),'%s\t%g\t%g\t%s\n', '>10% Forbidden        ', round(Rounding*100*ForbiddenPerc(P)/(TotalBasepairs*Rounding)),   round(Rounding*100*ForbiddenCountPerc(P)/(ForbiddenPerc(P)*NSeq_all(P)*Rounding)),     '-');%,round(Rounding*100*sum(IsostericANDForbidden(:,P))/(ForbiddenPerc(P)*Rounding)));
%             fprintf(PrintArraySummary10per(f),'%s\t%g\t%g\t%s\n', '>10% Gaps             ', round(Rounding*100*GapsPerc(P)/(TotalBasepairs*Rounding)),        round(Rounding*100*GapsCountPerc(P)/(GapsPerc(P)*NSeq_all(P)*Rounding)),               '-');%,round(Rounding*100*sum(IsostericANDGaps(:,P))/(GapsPerc(P)*Rounding)));
%             fprintf(PrintArraySummary10per(f),'\n');
            fprintf(PrintArraySummary10per(f),'%s\t%g\t%g\n', '<10% Forbidden or Gaps', round(Rounding*100*AllowedPerc(P)/(TotalBasepairs*Rounding)),     round(Rounding*100*sum(IsostericANDAllowed(:,P))/(AllowedPerc(P)*Rounding)));
            fprintf(PrintArraySummary10per(f),'%s\t%g\t%s\n', '>10% Forbidden        ', round(Rounding*100*ForbiddenPerc(P)/(TotalBasepairs*Rounding)),   '-');
            fprintf(PrintArraySummary10per(f),'%s\t%g\t%s\n', '>10% Gaps             ', round(Rounding*100*GapsPerc(P)/(TotalBasepairs*Rounding)),        '-');
            fprintf(PrintArraySummary10per(f),'\n');
        end
    end

    fclose(fidOUTSummary);
else fprintf('\n%s\n','Error printing Statistics xls file, please make sure it is not opened');
end