Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- # chain line
- my ($ch_score, $ch_name, $ch_size, $ch_target_strand, $ch_target_start, $ch_target_end,
- $ch_query_name, $ch_query_size, $ch_query_strand, $ch_query_start, $ch_query_end, $ch_id);
- # track positions
- my $current_pos;
- my $current_end;
- while(<>) {
- chomp;
- if( /chain/ ) {
- my @arr = split ' ';
- ($ch_score, $ch_name, $ch_size, $ch_target_strand, $ch_target_start, $ch_target_end, $ch_query_name, $ch_query_size, $ch_query_strand, $ch_query_start, $ch_query_end, $ch_id) = ($arr[1],$arr[2],$arr[3],$arr[4],$arr[5],$arr[6],$arr[7],$arr[8],$arr[9],$arr[10],$arr[11],$arr[12]);
- print "$ch_name\tname\tmatch\t$ch_query_start\t$ch_query_end\t.\t.\t.\tID=$ch_id;target=$ch_query_name\n";
- $current_pos=$ch_query_start;
- $current_end=$ch_query_start;
- }
- else {
- my @match = split '\t';
- if($match[0]) {
- $current_end = $current_pos+$match[0];
- print "$ch_query_name\tname\tmatch_part\t$current_pos\t$current_end\t.\t.\t.\tParent=$ch_id;target=$ch_name\n";
- $current_pos = $current_end;
- }
- if($match[1]) {
- $current_end = $current_pos+$match[1];
- print "$ch_query_name\tname\tgap\t$current_pos\t$current_end\t.\t.\t.\tParent=$ch_id;target=$ch_name\n";
- $current_pos = $current_end;
- }
- if($match[2]) {
- print "$ch_query_name\tname\tinsertion\t$current_pos\t$current_pos\t.\t.\t.\tParent=$ch_id;target=$ch_name;len=$ch_size;len2=$match[2]\n";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment