hi,
i need to change this output
821 940 0.31 - 0 id "g1";
989 1205 0.53 - 1 id "g1";
2141 2621 0.37 - 2 id "g1";
2681 2847 0.89 - 1 id "g1";
2921 2925 0.71 - 0 id "g1";
5897 6076 0.55 + 0 id "g2";
6129 6202 0.58 + 0 id "g2";
6265 6381 0.57 + 1 id "g2";
into something like this. i.e. i need to rearrange the first two columns in this way if the id is identical. Can someone suggest how this can be done?
g1 (821..940,989,1205,2141..2621,2681..2847,2921..2925)
g2 (5424..5801,5897..6076,6129..6202,6265..6381)
i am thinking something along the line, but couldnt really get it to work.. thanks for any help
my $file = shift;
open FILE, $file;
while (my $line = <FILE>)
{
my $id = "id \"(.*)\"";
@line = split /\t/,$line;
if ($line =~ m/$id/)
{
our $coord = "$line[0]..$line[1],";
print "$coord";
}
}
i need to change this output
821 940 0.31 - 0 id "g1";
989 1205 0.53 - 1 id "g1";
2141 2621 0.37 - 2 id "g1";
2681 2847 0.89 - 1 id "g1";
2921 2925 0.71 - 0 id "g1";
5897 6076 0.55 + 0 id "g2";
6129 6202 0.58 + 0 id "g2";
6265 6381 0.57 + 1 id "g2";
into something like this. i.e. i need to rearrange the first two columns in this way if the id is identical. Can someone suggest how this can be done?
g1 (821..940,989,1205,2141..2621,2681..2847,2921..2925)
g2 (5424..5801,5897..6076,6129..6202,6265..6381)
i am thinking something along the line, but couldnt really get it to work.. thanks for any help
my $file = shift;
open FILE, $file;
while (my $line = <FILE>)
{
my $id = "id \"(.*)\"";
@line = split /\t/,$line;
if ($line =~ m/$id/)
{
our $coord = "$line[0]..$line[1],";
print "$coord";
}
}