Hi all,
I am trying to make the script to sort the data at the max to min at the decided position.
in put :
10 0
20 0
24 0
26 0
34 0
39 0
49 0
55 0
56 0
65 0
65 0
I hope out put file:
decided position 3 24 0
20 0
10 0
decided position 3 39 0
34 0
26 0
etc ....................
my script
#!/usr/bin/perl;
use strict;
use warnings;
my ($a1, $b, $file,$n,$i, $x, $all, @array,@b, $so);
ファイル名の指定
print "\n\n***********************************************************************\n";
print "********* Finding max and min of forward and reverse program *********\n";
print "\nInsert the file(例:Biojet.txt or biojet.fasta):";
$file = <STDIN>;
if (!open (IN,"$file")){
print "ファイルの読み込みに失敗しました.\n";
}
print "insert the decided position:";
$n = <STDIN>;
#ファイルの最後までループ
$i = 0;
$x = 0;
while (<IN>){
if ($_ =~ /\#/){
next;
}
$all++;
($a1,$b) = split(/\t/,$_);
$so =$a1;
#改行コードを取り除く
chomp ($b);
#$iのカウントを増やす
$i++;
if ($i <= $n) {
my @array = <$a1>;
#@array = sort @array;
@b = sort { $b <=> $a} @array;
print "$_\n";}
}
close IN;
It just sort at one time and I can sort form max value to min value. Could you please show me how to solve this problem.
Thank you very much!