| 1 | # -*-CPerl-*- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Last changed Time-stamp: <2017-06-10 19:08:57 michl> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | package Bio::ViennaNGS::SpliceJunc; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Bio::ViennaNGS; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Bio::ViennaNGS::Fasta; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use IPC::Cmd qw(can_run run); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Path::Class; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use version; our $VERSION = version->declare("$Bio::ViennaNGS::VERSION"); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | our @EXPORT = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | our @EXPORT_OK = qw(bed6_ss_from_bed12 bed6_ss_from_rnaseq | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | bed6_ss_to_bed12 intersect_sj ss_isCanonical); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # bed6_ss_from_bed12( $bed12,$dest,$window,$can,$fastaO) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # Extracts splice junctions from BED12 annotation. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # Writes a BED6 file for each transcript found in the BED12, listing | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # all splice sites of this transcript, optionally flanking it with a | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # window of +/-$window nt. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub bed6_ss_from_bed12{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bed6_ss_from_bed12: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my ($bed12,$dest,$window,$can,$fastaobjR) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my ($i,$tr_name,$pos5,$pos3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my ($splicesites,$c,$totalsj,$cansj) = (0)x4; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my @bedline = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $this_function = (caller(0))[3]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | croak "ERROR [$this_function] $bed12 does not exists\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | unless (-e $bed12); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | croak "ERROR [$this_function] $dest does not exist" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | unless (-d $dest); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | open(BED12IN, "< $bed12") or croak $!; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | while(<BED12IN>){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my ($chr,$chromStart,$chromEnd,$name,$score,$strand,$thickStart, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | $thickEnd,$itemRgb,$blockCount,$blockSizes,$blockStarts) = split("\t"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my @blockSize = split(/,/,$blockSizes); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my @blockStart = split(/,/,$blockStarts); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | unless (scalar @blockSize == scalar @blockStart){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | croak "ERROR: unequal element count in blockStarts and blockSizes\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $fn = sprintf("%s_%d-%d_%s.annotatedSS.bed6",$chr,$chromStart,$chromEnd,$name); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $bed6_fn = file($dest,$fn); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $tr_count = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if ($blockCount >1){ # only transcripts with 2 or more exons (!!!) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | open(BED6OUT, "> $bed6_fn") or croak "cannot open BED6OUT $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | for ($i=0;$i<$blockCount-1;$i++){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $totalsj++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $pos5 = $chromStart+$blockStart[$i]+$blockSize[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | $pos3 = $chromStart+$blockStart[$i+1]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | if($can){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $c = ss_isCanonical($chr,$pos5,$pos3,$fastaobjR); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $cansj++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $tr_name = sprintf("%s.%02d",$name,$tr_count++); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | @bedline = join("\t",$chr,eval($pos5-$window), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | eval($pos5+$window),$tr_name,$c,$strand); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | print BED6OUT "@bedline\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | @bedline = join("\t",$chr,eval($pos3-$window), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | eval($pos3+$window),$tr_name,$c,$strand); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | print BED6OUT "@bedline\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } # end for | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | close(BED6OUT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } # end if | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } # end while | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | close(BED12IN); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # bed6_ss_from_rnaseq ($bed_in,$dest,$window,$mincov,$can,$fastaO) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # Extracts splice junctions from mapped RNA-seq data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # Writes a BED6 file for each splice junction present in the input, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # optionally flanking it with a window of +/-$window nt. Only splice | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # junctions supported by at least $mcov reads are considered. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub bed6_ss_from_rnaseq{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bed6_ss_from_rnaseq: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my ($bed_in,$dest,$window,$mcov,$can,$fastaobjR) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my ($reads,$proper,$passed,$pos5,$pos3); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $c = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my @bedline = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my $this_function = (caller(0))[3]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | croak "ERROR [$this_function] $bed_in does not exist\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | unless (-e $bed_in); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | croak "ERROR [$this_function] $dest does not exist" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | unless (-d $dest); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | open(INBED, "< $bed_in") or croak $!; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | while(<INBED>){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my ($chr, $start, $end, $info, $score, $strand) = split("\t"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $end = $end-2; # required for segemehl's BED6 files | |||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | if ($info =~ /^splits\:(\d+)\:(\d+)\:(\d+):(\w):(\w)/){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $reads = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $proper = $4; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | $passed = $5; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | next unless ($proper eq 'N'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | next unless ($passed =~ /[PFM]$/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | next if($reads < $mcov); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | croak "ERROR [$this_function] unsupported INFO field in input BED:\n$info\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $pos5 = $start; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $pos3 = $end; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | if($can){$c = ss_isCanonical($chr,$pos5,$pos3,$fastaobjR);} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $fn = sprintf("%s_%d-%d.mappedSS.bed6",$chr,$start,$end); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $bed6_fn = file($dest,$fn); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | open(BED6OUT, "> $bed6_fn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | @bedline = join("\t",$chr,eval($start-$window), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | eval($start+$window),$info,$c,$strand); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | print BED6OUT "@bedline\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | @bedline = join("\t",$chr,eval($end-$window), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | eval($end+$window),$info,$c,$strand); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | print BED6OUT "@bedline\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | close(BED6OUT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | close(INBED); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # bed6_ss_to_bed12 ($bed_in,$dest,$window,$mcov) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # Produce BED12 from BED6 file holdig splice junctions from mapped | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # RNA-seq data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub bed6_ss_to_bed12{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bed6_ss_to_bed12: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my ($bed_in,$dest,$window,$mcov,$circ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | my ($reads,$proper,$passed,$pos5,$pos3,$basename,$fn,$bed12_fn); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my @result = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my @bedline = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $this_function = (caller(0))[3]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | croak "ERROR [$this_function] $bed_in does not exist\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | unless (-e $bed_in); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | croak "ERROR [$this_function] $dest does not exist" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | unless (-d $dest); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $basename = fileparse($bed_in,qr/\.[^.]*/); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $fn = $basename.".bed12"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $bed12_fn = file($dest,$fn); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | open(BED12OUT, "> $bed12_fn"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | open(INBED, "< $bed_in") or croak $!; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | while(<INBED>){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my ($chr, $start, $end, $info, $score, $strand) = split("\t"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if ($info =~ /^splits\:(\d+)\:(\d+)\:(\d+):(\w):(\w)/){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $reads = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $proper = $4; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $passed = $5; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if ($circ == 1){ # skip 'N' (normal), 'L' (left) and 'R' (right) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | next unless ($proper =~ /[C]$/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | else { # skip 'L', 'R' and 'C' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | next unless ($proper =~ /[N]$/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | next unless ($passed =~ /[PM]$/); # ignore 'F' | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | next if($reads < $mcov); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | croak "ERROR [$this_function] unsupported INFO field in input BED:\n$info\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $pos5 = $start; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $pos3 = $end; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | @bedline = join("\t",$chr,eval($start-$window), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | eval($end+$window),$info,$score,$strand,$start,$end, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | "0","2","1,1","0,".eval($end-$start-1)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | print BED12OUT "@bedline\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | close(INBED); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | close(BED12OUT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | push (@result, $bed12_fn); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | return @result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # intersect_sj($p_annot,$p_mapped,$dest,$prefix,$window,$mil) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # Intersect splice junctions determined by RNA-seq with annotated | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # splice junctions. Determine novel and existing splice junctions. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | # Writes BED6 files for existing and novel splice junctions to $dest | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # and reurns an array with the absolute path to the two resulting BED | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | # files | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub intersect_sj{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
intersect_sj: not called CC=26 SCAR=65.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my ($p_annot,$p_mapped,$dest,$prefix,$window,$mil) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my ($dha,$dhm); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $processed = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my @junctions = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my @transcript_beds = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my %asj = (); # annotated splice junctions hash | |||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my $this_function = (caller(0))[3]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | my $bedtools = can_run('bedtools') or | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | croak "ERROR [$this_function] bedtools not found"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | my $sortBed = can_run('sortBed') or | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | croak "ERROR [$this_function] sortBed not found"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | croak "ERROR [$this_function] $p_annot does not exist\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | unless (-d $p_annot); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | croak "ERROR [$this_function] $p_mapped does not exist\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | unless (-d $p_mapped); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | croak "ERROR [$this_function] $dest does not exist\n" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | unless (-d $dest); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | # get a list of all files in $p_annot | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | opendir($dha, $p_annot) or croak "Cannot opendir $p_annot: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | while(readdir $dha) { push @transcript_beds, $_; } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | closedir($dha); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # get a list of all splice junctions seen in RNA-seq data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | opendir($dhm, $p_mapped) or croak "Cannot opendir $p_mapped: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | @junctions = grep { /^(chr\d+)\_(\d+)-(\d+)\.mappedSS\.bed6/ } readdir($dhm); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | # process splice junctions seen in RNA-seq data | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | foreach my $file (@junctions){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $processed++; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | croak "Unexpected file name pattern\n" unless ($file =~ /(chr\d+)\_(\d+)-(\d+)/); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my $sc = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my $s5 = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $s3 = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $pattern = $sc."_".$s5."-".$s3; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | my @annotated_beds = grep { /^(chr\d+)\_(\d+)-(\d+)/ && $2<=$s5 && $3>=$s3 && $sc eq $1} @transcript_beds; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
/^(chr\d+)\_(\d+)-(\d+)/ && $2 <= $s5 && $3 >= $s3 && $sc eq $1
/^(chr\d+)\_(\d+)-(\d+)/ and $2 <= $s5 and $3 >= $s3
/^(chr\d+)\_(\d+)-(\d+)/ and $2 <= $s5
MC/DC0%0/4
/^(chr\d+)\_(\d+)-(\d+)/ && $2 <= $s5 && $3 >= $s3 && $sc eq $1
/^(chr\d+)\_(\d+)-(\d+)/
$2 <= $s5
$3 >= $s3
$sc eq $1
Truth table0%0/5
A and B and C && D
A= /^(chr\d+)\_(\d+)-(\d+)/B= $2 <= $s5C= $3 >= $s3D= $sc eq $1
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | #print"\t intersecting against ".(eval $#annotated_beds+1)." transcripts: @annotated_beds \n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # intersect currently opened SJ against all transcripts in @annotated_beds | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | foreach my $i (@annotated_beds){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $a = file($p_mapped,$file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | my $b = file($p_annot,$i); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $intersect_cmd = "$bedtools intersect -a $a -b $b -c -nobuf"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | open(INTERSECT, $intersect_cmd."|"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | while(<INTERSECT>){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ($_ =~ /1$/) { $asj{$pattern} = 1;} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | close(INTERSECT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | if ( $processed % 1000 == 0){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | print STDERR "processed $processed splice junctions\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | closedir($dhm); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # go through the mapped splice junctions files once again and | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | # separate novel from existing splice junctions | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | if (length($prefix)>0){$prefix .= ".";} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $outname_exist = file($dest, $prefix."exist.SS.bed"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my $outname_exist_u = file($dest, $prefix."exist.SS.u.bed"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $outname_novel = file($dest, $prefix."novel.SS.bed"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $outname_novel_u = file($dest, $prefix."novel.SS.u.bed"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | open (EXISTOUT, "> $outname_exist_u"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | open (NOVELOUT, "> $outname_novel_u"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # write new ones to NOVELOUT; existing ones to EXISTOUT | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | foreach my $file (@junctions){ | |||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | if ($file =~ m/^(chr\d+\_\d+-\d+)/){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $pattern = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my $fn = file($p_mapped,$file); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | open (SJ, "< $fn") or croak "Cannot open $fn $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | while(<SJ>){ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $_ = m/^(chr\w+)\s(\d+)\s(\d+)\s(splits:\d+:\d+:\d+:\w:\w)\s(\d+)\s([+-01])/; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | my $chr = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | my $start = $2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | my $end = $3; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my $name = $4; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my $score = $5; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $strand = $6; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my @bedline = join("\t",$chr,eval($start+$window), | |||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | eval($start+$window+1),$name,$score,$strand); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | if (exists $asj{$pattern}){ # annotated splice junction | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | print EXISTOUT "@bedline\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | else { # novel splice junction | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | print NOVELOUT "@bedline\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } # end while | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | close(SJ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } # end if | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | else{ carp "Error with parsing BED6 junction file names __FILE__ __LINE__\n";} | |||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | close(EXISTOUT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | close(NOVELOUT); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | # sort the resulting bed files | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $cmd = "$bedtools sort -i $outname_exist_u > $outname_exist"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my ( $success, $error_message, $full_buf, $stdout_buf, $stderr_buf ) = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | run( command => $cmd, verbose => 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | if( !$success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | print STDERR "ERROR [$this_function] Call to $bedtools unsuccessful\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | print STDERR "ERROR: this is what the command printed:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | print join "", @$full_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | croak $!; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | unlink($outname_exist_u); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $cmd = "$bedtools sort -i $outname_novel_u > $outname_novel"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ( $success, $error_message, $full_buf, $stdout_buf, $stderr_buf ) = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | run( command => $cmd, verbose => 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | if( !$success ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | print STDERR "ERROR [$this_function] Call to $bedtools unsuccessful\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | print STDERR "ERROR: this is what the command printed:\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | print join "", @$full_buf; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | croak $!; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | unlink($outname_novel_u); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | printf STDERR "processed $processed splice junctions\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my @result = (); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | push(@result, $outname_exist); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | push(@result, $outname_novel); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | return @result; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # ss_isCanonical ( $chr,$p5,$p3,$fastaO ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # Checks whether a given splice junction is canonical, ie. whether the | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | # first and last two nucleotides of the enclosed intron correspond to | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # a certain nucleotide motif. $chr is the chromosome name, $p5 and $p3 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | # the 5' and 3' ends of the splice junction and $fastaobjR is a | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # Bio::PrimarySeq::Fasta object holding the underlying reference | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # genome. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | # Th most common canonical splice junction motif is GT-AG (shown | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | # below). Other canonical motifs are GC->AG and AT->AC. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | # ------------------> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | # 5'===]GT..........AG[====3' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | # <----------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | # 3'===]GA..........TG[====5' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | sub ss_isCanonical{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ss_isCanonical: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | my ($chr,$p5,$p3,$fo) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | my ($seqL,$seqR,$pattern); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my $ss_motif_length = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | my $this_function = (caller(0))[3]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my $c = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $seqL = $fo->stranded_subsequence($chr,$p5+1,$p5+$ss_motif_length,"+"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $seqR = $fo->stranded_subsequence($chr,$p3-$ss_motif_length+1,$p3,"+"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $pattern = sprintf("%s|%s",$seqL,$seqR); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | #print STDERR "[$this_function] p5->p3 ($p5 -- $p3) $seqL -- $seqR\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | if ($pattern =~ /^GT|AG$/) { $c = 1000;} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | elsif ($pattern =~ /^CT|AC$/) { $c = 1000; } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | elsif ($pattern =~ /^GC|AG$/) { $c = 1000; } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | elsif ($pattern =~ /^CT|GC$/) { $c = 1000; } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | elsif ($pattern =~ /^AT|AC$/) { $c = 1000; } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | elsif ($pattern =~ /^GT|AT$/) { $c = 1000; } | |||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | else { $c = 0;} | |||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | return $c; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||