Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- my $inf = shift;
- open IN, $inf;
- my %cds;
- # slurpy block
- while (<IN>){
- chomp;
- my @F = split;
- if (/Parent=([^;]+)/){
- my $id = "$1";
- $cds{$id}->{start}||=$F[3];
- $cds{$id}->{stop}||=$F[4];
- $cds{$id}->{start}=$F[3] if $F[3] < $cds{$id}->{start};
- $cds{$id}->{stop}=$F[4] if $F[4] > $cds{$id}->{stop};
- }
- }
- close IN;
- # fixie block
- # while (my ($k,$v)= eadch %cds){
- # print "funky "
- # }
- open IN, $inf;
- while (<IN>){
- if (/ID=([^;\n]+)/){
- my @F=split;
- my ($newStart,$newStop) = ($cds{$1}->{start},$cds{$1}->{stop});
- my ($oldStart,$oldStop) = ($F[3],$F[4]);
- s/$oldStart/$newStart/;
- s/$oldStop/$newStop/;
- }
- print
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement