in reply to Re: Sorting issue
in thread Sorting issue
Thanks for the reply. I tried your suggestion, but it was not working as I found that there was repeats in the second column (frequency) of my input file. So, I changed the format of first column of output by concatenating the tags to the end. In that way, it looks unique. Now, I would like to sort on the first column of my output. I did create another hash to make it work. So far it is not successful. The codes that I changed are below. Any suggestions will be helpful
while (my $line=<$FILE1>) { chomp $line; $line=~s/\t/,/g; my @columns=split(/,/, $line); my $tags=$columns[0]; #$tag{$columns[0]}=\@columns; $tag{$tags}=$line; } foreach my $tags (keys %tag){ my $header; my $range=500000; my @columns=split(/,/,$tag{$tags}); $tags=$columns[0]; my $freq=$columns[1]; my $random_number=int(rand($range)); $header=">HWTI_".$freq."_".$random_number.$tags; $header=~tr/"//d; my $printline=$tag{$tags}; $printline=$header.",".$printline; print $FILE2 "$printline\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Sorting issue
by aaron_baugher (Curate) on Nov 05, 2011 at 02:54 UTC | |
by Cristoforo (Curate) on Nov 05, 2011 at 03:07 UTC | |
by aaron_baugher (Curate) on Nov 05, 2011 at 13:47 UTC | |
by bluray (Sexton) on Nov 05, 2011 at 14:53 UTC | |
by aaron_baugher (Curate) on Nov 05, 2011 at 19:18 UTC | |
by bluray (Sexton) on Nov 05, 2011 at 03:59 UTC | |
by aaron_baugher (Curate) on Nov 05, 2011 at 13:45 UTC |