Guest User

Untitled

a guest
Apr 18th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. use strict;
  3.  
  4. # chain line
  5. my ($ch_score, $ch_name, $ch_size, $ch_target_strand, $ch_target_start, $ch_target_end,
  6. $ch_query_name, $ch_query_size, $ch_query_strand, $ch_query_start, $ch_query_end, $ch_id);
  7.  
  8. # track positions
  9. my $current_pos;
  10. my $current_end;
  11.  
  12. while(<>) {
  13. chomp;
  14.  
  15. if( /chain/ ) {
  16. my @arr = split ' ';
  17. ($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]);
  18. print "$ch_name\tname\tmatch\t$ch_query_start\t$ch_query_end\t.\t.\t.\tID=$ch_id;target=$ch_query_name\n";
  19. $current_pos=$ch_query_start;
  20. $current_end=$ch_query_start;
  21. }
  22. else {
  23. my @match = split '\t';
  24. if($match[0]) {
  25. $current_end = $current_pos+$match[0];
  26. print "$ch_query_name\tname\tmatch_part\t$current_pos\t$current_end\t.\t.\t.\tParent=$ch_id;target=$ch_name\n";
  27. $current_pos = $current_end;
  28. }
  29. if($match[1]) {
  30. $current_end = $current_pos+$match[1];
  31. print "$ch_query_name\tname\tgap\t$current_pos\t$current_end\t.\t.\t.\tParent=$ch_id;target=$ch_name\n";
  32. $current_pos = $current_end;
  33. }
  34. if($match[2]) {
  35. 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";
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment