Help with analysis data based on particular column content

Input file:

Total_counts	1306726155	100%
Number_of_count_true	855020282
Number_of_count_true_1	160014283
Number_of_count_true_2	44002825
Number_of_count_true_3	18098424
Number_of_count_true_4	24693745
Number_of_count_false	115421870
Number_of_count_true	51048447
Total_number_of_false

Desired output file:

Total_counts	1306726155	100%
Number_of_count_true	855020282           65.43%
Number_of_count_true_1	160014283           12.25%
Number_of_count_true_2	44002825             3.37%
Number_of_count_true_3	18098424             1.39%
Number_of_count_true_4	24693745             1.89%
Number_of_count_false	115421870            8.83%
Number_of_count_true	51048447             3.91%
Total_number_of_false       1191304285   91.17%

Condition:

  1. All those column 2 that matched "Number_of_count" is divided with the column 2 in "Total_counts" and multiple 100% to generate the figure in column 3;
    eg. 855020282/1306726155*100%=65.43%

  2. Column 2 of "Total_number_of_false" is generated based on minus of column 2 in "Total_counts" with column 2 in "Number_of_count_false";
    eg. 1306726155-51048447=1191304285

  3. Column 3 of "Total_number_of_false" is generated based on minus of column 3 in "Total_counts" with column 3 in "Number_of_count_false";
    eg. 100%-8.83%=91.17%

Thanks for any advice.

Not sure if there is a typo or if I misunderstood, but this might come close to what you wanted or can be used as a start:

awk 'NR==1 {a=$2; printf("%-30s%20s%11s\n", $1,$2,$3); next} !/^Total/ {s2+=$2; p3=$2*100/a; s3+=p3; printf("%-30s%20s%10.2f%s\n", $1, $2, p3, pr)} END {printf("%-30s%20s%10.2f%s\n", $1, s2, s3, pr)}' pr="%" infile
Total_counts                            1306726155       100%
Number_of_count_true                     855020282     65.43%
Number_of_count_true_1                   160014283     12.25%
Number_of_count_true_2                    44002825      3.37%
Number_of_count_true_3                    18098424      1.39%
Number_of_count_true_4                    24693745      1.89%
Number_of_count_false                    115421870      8.83%
Number_of_count_true                      51048447      3.91%
Total_number_of_false                   1268299876     97.06%

Please keep in mind, it would be nice that you show some effort yourself, as you have 80 posts already and might be familiar to such tasks, thanks.

perl -lane '
if (/Total_counts/) { $tot = $F[1]; print }
(/Number_of_count/) && printf "%s\t%s\t%6.2f\%\n", $F[0], $F[1], $F[1]*100/$tot;
(/Number_of_count_false/) && ($false += $F[1]);
(/Total_number_of_false/) && printf "%s\t%d\t%6.2f\%\n", $F[0], $tot-$false, ($tot-$false)*100/$tot' inputfile