File: exoniphyDb2hints.pl

package info (click to toggle)
augustus 3.4.0%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 758,480 kB
  • sloc: cpp: 65,451; perl: 21,436; python: 3,927; ansic: 1,240; makefile: 1,032; sh: 189; javascript: 32
file content (42 lines) | stat: -rwxr-xr-x 1,301 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl
#
#  convert the exoniphy exon predictions to a file with hints to AUGUSTUS
#

use strict;
use Getopt::Long;
my ($usage, $cutoff, $priority, $grp, $seqname, $strand, $begin, $end);

#default values
$cutoff = 9; 
$priority = 4;

$usage .= "$0 -- convert exoniphy output to hints file\n";
$usage .= "Usage: $0 [--priority=p --cutoff=c]\n";
$usage .= "reads from stdin writes to stdout.\n";
$usage .= "takes input in tab separated format:\n";
$usage .= "name\tchrom\tstrand\tcdsStart\tcdsEnd\n";
$usage .= "You get this format on the UCSC system by typing e.g.\n";
$usage .= "echo \"select name, chrom, strand, cdsStart, cdsEnd from exoniphy order by chrom, cdsStart;\" | hgsql hg18 | grep -v cdsStart\n";

GetOptions('priority:i'=>\$priority,
           'cutoff:i'=>\$cutoff);

while (<>) {
    chomp;
    my @f = split /\t/, $_;
    next unless (@f > 4);
    $grp     = $f[0];
    $seqname = $f[1];
    $strand  = $f[2];
    $begin   = $f[3]+1;
    $end     = $f[4];

    print "$seqname\texoniphy\tCDS\t$begin\t$end\t0\t$strand\t.\tgrp=$grp;pri=$priority;src=X\n";
    $begin += $cutoff;
    $end   -= $cutoff;
    if ($begin > $end) {
	$begin = $end = int(($begin+$end)/2);
    }
    print "$seqname\texoniphy\tCDSpart\t$begin\t$end\t0\t$strand\t.\tgrp=$grp;pri=$priority;src=X\n";
}