4 use Data
::Dump qw
(ddx
);
6 my $gtff = '/bak/seqdata/genomes/TigerRefGenome/P_tigris.gene.gtf';
10 my ($lastStrand,%GTF,%tcds,$lastchr,%OUTF);
12 open I
,'-|',"gzip -dc $ARGV[0]" or die;
13 my @Types = ('I',1,2,3,'N');
15 open $OUTF{$_},'|-',"gzip -9c >vcfout.$_.vcf.gz";
24 if (/^##contig=<ID=(\w+),length=(\d+)>$/) {
37 my ($chr,undef,$type,$start,$end,undef,$strand) = split /\t/;
39 next unless exists $GTF{$chr};
40 if ($type eq 'transcript') {
42 my $len = $end-$start;
43 substr $GTF{$chr},$start-1,$len,'I'x
$len;
45 if (defined $lastStrand) {
46 my @Poses = keys %{$tcds{$chr}};
47 if ($lastStrand eq '+') {
48 @Poses = sort { $a <=> $b } @Poses;
50 @Poses = sort { $b <=> $a } @Poses;
54 substr $GTF{$chr},$_-1,1,"$step";
56 $step = 1 if $step > 3;
62 } elsif ($type eq 'exon') {
63 for ($start .. $end) {
64 $tcds{$chr}{$_} = 'E';
66 $lastStrand = $strand;
69 print STDERR
int(100*$tl/$wcl)/100,"% $tl \r" unless $tl % 1000;
71 if (defined $lastStrand) {
72 my @Poses = keys %{$tcds{$lastchr}};
73 if ($lastStrand eq '+') {
74 @Poses = sort { $a <=> $b } @Poses;
76 @Poses = sort { $b <=> $a } @Poses;
80 substr $GTF{$lastchr},$_-1,1,"$step";
82 $step = 1 if $step > 3;
89 #print unpack('c',$GTF{'scaffold53'}{44227}),"|\n";
90 #print $GTF{'scaffold53'}{44227},"|\n";
93 for (sort keys %GTF) {
94 print X
join("\t",$_,$GTF{$_}),"\n";
100 my ($chr,$pos) = split /\t/;
101 my $str = $GTF{$chr};
102 my $type = substr $str,$pos-1,1;
104 my $fh = $OUTF{$type};