-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-ref-splice-sites.pl
More file actions
executable file
·60 lines (54 loc) · 1.48 KB
/
check-ref-splice-sites.pl
File metadata and controls
executable file
·60 lines (54 loc) · 1.48 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl
use strict;
use GffTranscriptReader;
use FastaReader;
use Translation;
my $REF="/home/bmajoros/1000G/assembly/combined/ref/1.fasta";
my $GFF="/home/bmajoros/1000G/assembly/local-genes.gff";
my %hash;
my $reader=new GffTranscriptReader;
my $genes=$reader->loadGenes($GFF);
my $numGenes=@$genes;
for(my $i=0 ; $i<$numGenes ; ++$i) {
my $gene=$genes->[$i];
my $id=$gene->getId();
$hash{$id}=$gene;
}
my $reader=new FastaReader($REF);
while(1) {
my ($def,$seq)=$reader->nextSequence();
last unless $def;
$def=~/>(\S+)/ || die $def;
my $id=$1;
my $gene=$hash{$id};
die $id unless $gene;
my $numTrans=$gene->getNumTranscripts();
for(my $i=0 ; $i<$numTrans ; ++$i) {
my $transcript=$gene->getIthTranscript($i);
my $strand=$transcript->{strand};
my $chr=$transcript->{substrate};
my $exons=$transcript->{exons};
@$exons=sort {$a->getBegin() <=> $b->getBegin()} @$exons;
my $numExons=@$exons;
for(my $i=0 ; $i<$numExons ; ++$i) {
my $exon=$exons->[$i];
my $begin=$exon->getBegin(); my $end=$exon->getEnd();
if($i>0) {
my $signal=substr($seq,$begin-2,2);
if($strand eq "-") {
$signal=Translation::reverseComplement(\$signal);
print "donor\t$signal\n";
}
else { print "acceptor\t$signal\n" }
}
if($i+1<$numExons) {
my $signal=substr($seq,$end,2);
if($strand eq "-") {
$signal=Translation::reverseComplement(\$signal);
print "acceptor\t$signal\n";
}
else { print "donor\t$signal\n" }
}
}
}
}