| 1 | package Bio::ToolBox::Parser::bed; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp qw(carp cluck croak confess); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use base 'Bio::ToolBox::Parser'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Bio::ToolBox::Data; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Module::Load; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | our $VERSION = '2.02'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 12 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 12 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 14 | 12 | return $class->SUPER::new(@_); | |||||||||||||||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 20 | ▶ | sub open_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open_file: called CC=17 SCAR=34.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 20 | ▶ | my $filename = shift || undef; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || undef
MC/DC0%0/1
shift() || undef
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | # check file | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 20 | ▶ | if ( $filename and $self->file and $filename ne $self->file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$filename and $self->file and $filename ne $self->file
$filename and $self->file
MC/DC0%0/3
$filename and $self->file and $filename ne $self->file
$filename
$self->file
$filename ne $self->file
Truth table25%1/4
A and B and C
A= $filenameB= $self->fileC= $filename ne $self->file
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | confess 'FATAL: Must open new files with new Parser object!'; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 20 | ▶ | $filename ||= $self->file; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$filename ||= $self->file
MC/DC0%0/2
$filename ||= $self->file
$filename
$self->file
Truth table33%1/3
A ||= B
A= $filenameB= $self->file
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 20 | ▶ | unless ($filename) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | cluck "ERROR: No file name passed!\n"; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 20 | ▶ | if ( defined $self->{fh} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | # check file format type | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 20 | ▶ | my $filetype = $self->filetype || undef; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->filetype || undef
MC/DC0%0/1
$self->filetype || undef
$self->filetype
Truth table50%1/2
A
A= $self->filetype
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 20 | ▶ | unless ($filetype) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ( my $flavor, $filetype ) = Bio::ToolBox::Data->taste_file($filename); | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | unless ( $flavor eq 'bed' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | confess 'FATAL: File is not a BED file!!! How did we get here?'; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->{filetype} = $filetype; | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | # determine converter subroutine and set column expectations | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 20 | ▶ | if ( $filetype eq 'gappedPeak' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | $self->{convertor_sub} = \&_parse_gappedPeak; | |||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | $self->do_exon(1); # always parse sub peaks as exons | |||||||||||||||||||||||||||||||||||||||||
| 48 | # gappedPeak is essentially bed12 with extra columns | ||||||||||||||||||||||||||||||||||||||||||
| 49 | # we will use existing code from the ucsc parser to convert bed12 to seqfeatures | ||||||||||||||||||||||||||||||||||||||||||
| 50 | # we need more object stuff that the ucsc parser expects | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 4 | load 'Bio::ToolBox::Parser::ucsc::builder'; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 4 | $self->{bed} = 15; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 4 | $self->{id2count} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 4 | $self->{refseqsum} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 4 | $self->{refseqstat} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | $self->{kgxref} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 4 | $self->{ensembldata} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | elsif ( $filetype eq 'narrowPeak' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | $self->{bed} = 10; | |||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | $self->{convertor_sub} = \&_parse_narrowPeak; | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | elsif ( $filetype eq 'broadPeak' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | $self->{bed} = 9; | |||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->{convertor_sub} = \&_parse_broadPeak; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | elsif ( $filetype eq 'bedGraph' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->{bed} = 4; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | $self->{convertor_sub} = \&_parse_bedGraph; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | elsif ( $filetype eq 'bed12' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 6 | $self->{bed} = 12; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 6 | $self->{convertor_sub} = \&_parse_bed12; | |||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | # we will use existing code from the ucsc parser to convert bed12 to seqfeatures | ||||||||||||||||||||||||||||||||||||||||||
| 76 | # we need more object stuff that the ucsc parser expects | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 6 | load 'Bio::ToolBox::Parser::ucsc::builder'; | |||||||||||||||||||||||||||||||||||||||||
| 78 | 6 | $self->{id2count} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 6 | $self->{refseqsum} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 6 | $self->{refseqstat} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 6 | $self->{kgxref} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 6 | $self->{ensembldata} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | # an ordinary bed file | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 6 | $self->{bed} = ( $filetype =~ /bed(\d+)/ )[0]; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 6 | $self->{convertor_sub} = \&_parse_bed; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | # Open file | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 20 | ▶ | my $fh = Bio::ToolBox::Data->open_to_read_fh($filename) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | or croak "FATAL: Unable to open file '$filename'!"; | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | # finish | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 20 | $self->{fh} = $fh; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 20 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 8 | ▶ | sub typelist { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
typelist: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 8 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 8 | my $ft = $self->filetype; | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | # return generic lists based on what is expected | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 8 | ▶ | if ( $ft eq 'bed12' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 2 | return 'mRNA,ncRNA,exon,CDS'; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | ▶ | elsif ( $ft eq 'narrowPeak' or $ft eq 'broadPeak' ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$ft eq "narrowPeak" or $ft eq "broadPeak"
MC/DC50%1/2
$ft eq "narrowPeak" or $ft eq "broadPeak"
$ft eq "narrowPeak"
$ft eq "broadPeak"
Truth table66%2/3
A or B
A= $ft eq "narrowPeak"B= $ft eq "broadPeak"
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 2 | return 'peak'; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | elsif ( $ft eq 'gappedPeak' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 2 | return 'gappedPeak,peak'; | |||||||||||||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 113 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # return generic | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | return 'feature'; | |||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 138 | ▶ | sub next_feature { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_feature: called CC=8 SCAR=21.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 138 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | # check that we have an open filehandle and not finished | ||||||||||||||||||||||||||||||||||||||||||
| 123 | 138 | ▶ | unless ( $self->fh ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | croak 'FATAL: no Bed file loaded to parse!'; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 138 | ▶ | return if $self->{'eof'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | # loop through the file | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 138 | ▶ | while ( my $line = $self->fh->getline ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 132 | ▶ | if ( $line =~ /^#/ or $line =~ /^(?:track | browser)/x or $line !~ /\w+/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$line =~ /^#/ or $line =~ /^(?:track | browser)/x or not $line =~ /\w+/
$line =~ /^#/ or $line =~ /^(?:track | browser)/x
MC/DC66%2/3
$line =~ /^#/ or $line =~ /^(?:track | browser)/x or not $line =~ /\w+/
$line =~ /^#/
$line =~ /^(?:track | browser)/x
not $line =~ /\w+/
Truth table75%3/4
A or B or not(C)
A= $line =~ /^#/B= $line =~ /^(?:track | browser)/xC= not $line =~ /\w+/
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 8 | push @{ $self->{comments} }, $line; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 8 | $self->{line_count}++; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 8 | next; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 124 | chomp $line; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 124 | my $feature = &{ $self->{convertor_sub} }( $self, $line ); | |||||||||||||||||||||||||||||||||||||||||
| 137 | 124 | $self->{line_count}++; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 124 | ▶ | unless ($feature) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | printf STDERR "unable to make feature for line %d!\n", $self->{line_count}; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | # return the object, we do this while loop once per valid line | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 124 | return $feature; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | # presumed end of file | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 14 | $self->{'eof'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 14 | $self->fh->close; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 14 | return; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | *parse_table = \&parse_file; | |||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | *parse_table if 0; # avoid once warning | |||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 14 | ▶ | sub parse_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_file: called CC=8 SCAR=21.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | # check that we have an open filehandle | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 14 | ▶ | unless ( $self->fh ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | carp 'ERROR: no file loaded to parse!'; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 14 | ▶ | return 1 if $self->{'eof'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 14 | printf " Parsing %s format file....\n", $self->filetype; | |||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 14 | ▶ | while ( my $feature = $self->next_feature ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | # there are possibly lots and lots of features here | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # we shouldn't have to check IDs for uniqueness, but to maintain compatibility | ||||||||||||||||||||||||||||||||||||||||||
| 172 | # with other parsers and for consistency, we do | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 118 | my $id = $feature->primary_id; | |||||||||||||||||||||||||||||||||||||||||
| 174 | 118 | ▶ | if ( exists $self->{loaded}{$id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 4 | my $i = 1; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 4 | $id = $feature->primary_id . ".$i"; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 4 | ▶ | while ( exists $self->{loaded}{$id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $id = $feature->primary_id . ".$i"; | |||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | # we have a unique id, now change it | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 4 | $feature->primary_id($id); | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | # record the feature | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 118 | $self->{loaded}{$id} = $feature; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 118 | push @{ $self->{top_features} }, $feature; | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | # check chromosome | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 118 | my $s = $feature->seq_id; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 118 | ▶ | unless ( exists $self->{seq_ids}{$s} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 18 | $self->{seq_ids}{$s} = $feature->end; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 118 | ▶ | $self->{seq_ids}{$s} = $feature->end if $feature->end > $self->{seq_ids}{$s}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 14 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 16 | ▶ | sub _parse_narrowPeak { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_narrowPeak: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 201 | 16 | my ( $self, $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 16 | my @data = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 16 | ▶ | unless ( scalar(@data) == 10 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | croak sprintf( "FATAL: narrowPeak line %d '%s' doesn't have 10 elements!", | ||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $self->{line_count}, $line ); | |||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | # generate the basic SeqFeature | ||||||||||||||||||||||||||||||||||||||||||
| 209 | my $feature = $self->{sfclass}->new( | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 16 | -seq_id => $data[0], | |||||||||||||||||||||||||||||||||||||||||
| 211 | -start => $data[1] + 1, | ||||||||||||||||||||||||||||||||||||||||||
| 212 | -end => $data[2], | ||||||||||||||||||||||||||||||||||||||||||
| 213 | -name => $data[3], | ||||||||||||||||||||||||||||||||||||||||||
| 214 | -score => $data[4], | ||||||||||||||||||||||||||||||||||||||||||
| 215 | -strand => $data[5], | ||||||||||||||||||||||||||||||||||||||||||
| 216 | -primary_tag => 'peak', | ||||||||||||||||||||||||||||||||||||||||||
| 217 | -primary_id => sprintf( "%s:%d-%d", $data[0], $data[1], $data[2] ), | ||||||||||||||||||||||||||||||||||||||||||
| 218 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | # add extra columns | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 16 | $feature->add_tag_value( 'signalValue', $data[6] ); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 16 | $feature->add_tag_value( 'pValue', $data[7] ); | |||||||||||||||||||||||||||||||||||||||||
| 223 | 16 | $feature->add_tag_value( 'qValue', $data[8] ); | |||||||||||||||||||||||||||||||||||||||||
| 224 | 16 | $feature->add_tag_value( 'peak', $data[9] ); | |||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 16 | return $feature; | |||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub _parse_broadPeak { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_broadPeak: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my ( $self, $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my @data = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | unless ( scalar(@data) == 9 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | croak sprintf( "FATAL: broadPeak line %d '%s' doesn't have 9 elements!", | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $self->{line_count}, $line ); | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | # generate the basic SeqFeature | ||||||||||||||||||||||||||||||||||||||||||
| 238 | my $feature = $self->{sfclass}->new( | ||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | -seq_id => $data[0], | |||||||||||||||||||||||||||||||||||||||||
| 240 | -start => $data[1] + 1, | ||||||||||||||||||||||||||||||||||||||||||
| 241 | -end => $data[2], | ||||||||||||||||||||||||||||||||||||||||||
| 242 | -name => $data[3], | ||||||||||||||||||||||||||||||||||||||||||
| 243 | -score => $data[4], | ||||||||||||||||||||||||||||||||||||||||||
| 244 | -strand => $data[5], | ||||||||||||||||||||||||||||||||||||||||||
| 245 | -primary_tag => 'peak', | ||||||||||||||||||||||||||||||||||||||||||
| 246 | -primary_id => sprintf( "%s:%d-%d", $data[0], $data[1], $data[2] ), | ||||||||||||||||||||||||||||||||||||||||||
| 247 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | # add extra columns | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | $feature->add_tag_value( 'signalValue', $data[6] ); | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $feature->add_tag_value( 'pValue', $data[7] ); | |||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $feature->add_tag_value( 'qValue', $data[8] ); | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | return $feature; | |||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub _parse_bedGraph { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_bedGraph: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | my ( $self, $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my @data = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | unless ( scalar(@data) == 4 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | croak sprintf( "FATAL: bedGraph line %d '%s' doesn't have 4 elements!", | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | $self->{line_count}, $line ); | |||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | # generate the basic SeqFeature | ||||||||||||||||||||||||||||||||||||||||||
| 266 | return $self->{sfclass}->new( | ||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | -seq_id => $data[0], | |||||||||||||||||||||||||||||||||||||||||
| 268 | -start => $data[1] + 1, | ||||||||||||||||||||||||||||||||||||||||||
| 269 | -end => $data[2], | ||||||||||||||||||||||||||||||||||||||||||
| 270 | -score => $data[3], | ||||||||||||||||||||||||||||||||||||||||||
| 271 | -primary_id => sprintf( "%s:%d-%d", $data[0], $data[1], $data[2] ), | ||||||||||||||||||||||||||||||||||||||||||
| 272 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 22 | ▶ | sub _parse_bed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_bed: called CC=5 SCAR=18.6
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 22 | my ( $self, $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 22 | my @data = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||
| 278 | 22 | ▶ | unless ( scalar(@data) == $self->{bed} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | croak sprintf( "FATAL: Bed line %d '%s' doesn't have %d elements!", | ||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $self->{line_count}, $line, $self->{bed} ); | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | # generate the basic SeqFeature | ||||||||||||||||||||||||||||||||||||||||||
| 284 | return $self->{sfclass}->new( | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 22 | ▶ | -seq_id => $data[0], | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
$data[3] || undef
$data[4] || undef
$data[5] || undef
MC/DC0%0/1
$data[3] || undef
$data[3]
MC/DC0%0/1
$data[4] || undef
$data[4]
MC/DC0%0/1
$data[5] || undef
$data[5]
Truth table50%1/2
A
A= $data[3]
Truth table50%1/2
A
A= $data[4]
Truth table50%1/2
A
A= $data[5]
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | -start => $data[1] + 1, | ||||||||||||||||||||||||||||||||||||||||||
| 287 | -end => $data[2], | ||||||||||||||||||||||||||||||||||||||||||
| 288 | -name => $data[3] || undef, | ||||||||||||||||||||||||||||||||||||||||||
| 289 | -score => $data[4] || undef, | ||||||||||||||||||||||||||||||||||||||||||
| 290 | -strand => $data[5] || undef, | ||||||||||||||||||||||||||||||||||||||||||
| 291 | -primary_id => sprintf( "%s:%d-%d", $data[0], $data[1], $data[2] ), | ||||||||||||||||||||||||||||||||||||||||||
| 292 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 70 | ▶ | sub _parse_bed12 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_bed12: called CC=9 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 70 | my ( $self, $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 297 | 70 | my @data = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||
| 298 | 70 | ▶ | unless ( scalar(@data) == $self->{bed} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | croak sprintf( "FATAL: Bed line %d '%s' doesn't have %d elements!", | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | $self->{line_count}, $line, $self->{bed} ); | |||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | # we will take advantage of pre-existing code in the UCSC parser to convert | ||||||||||||||||||||||||||||||||||||||||||
| 304 | # a bed12 line to a fully-fledged processed transcript | ||||||||||||||||||||||||||||||||||||||||||
| 305 | # we just have to go through a genePred format first | ||||||||||||||||||||||||||||||||||||||||||
| 306 | # fortunately, the two are pretty similar in structure | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | # now convert from bed12 | ||||||||||||||||||||||||||||||||||||||||||
| 309 | # Chromosome Start End Name Score Strand thickStart thickEnd itemRGB blockCount blockSizes blockStarts | ||||||||||||||||||||||||||||||||||||||||||
| 310 | # to genePred | ||||||||||||||||||||||||||||||||||||||||||
| 311 | # name chrom strand txStart txEnd cdsStart cdsEnd exonCount exonStarts exonEnds | ||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | # add missing data | ||||||||||||||||||||||||||||||||||||||||||
| 314 | 70 | ▶ | $data[6] ||= $data[2]; # cdsStart | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$data[6] ||= $data[2]
MC/DC0%0/2
$data[6] ||= $data[2]
$data[6]
$data[2]
Truth table33%1/3
A ||= B
A= $data[6]B= $data[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 70 | ▶ | $data[7] ||= $data[2]; # cdsEnd | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$data[7] ||= $data[2]
MC/DC0%0/2
$data[7] ||= $data[2]
$data[7]
$data[2]
Truth table33%1/3
A ||= B
A= $data[7]B= $data[2]
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 70 | ▶ | $data[8] ||= 0; # rgb values | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$data[8] ||= 0
MC/DC0%0/1
$data[8] ||= 0
$data[8]
Truth table50%1/2
A
A= $data[8]
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 70 | ▶ | $data[9] ||= 1; # exonCount | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$data[9] ||= 1
MC/DC0%0/1
$data[9] ||= 1
$data[9]
Truth table50%1/2
A
A= $data[9]
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 70 | ▶ | $data[10] ||= $data[7] - $data[6]; # block size | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$data[10] ||= $data[7] - $data[6]
MC/DC0%0/2
$data[10] ||= $data[7] - $data[6]
$data[10]
$data[7] - $data[6]
Truth table33%1/3
A ||= B
A= $data[10]B= $data[7] - $data[6]
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 70 | ▶ | $data[11] ||= 0; # block starts | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$data[11] ||= 0
MC/DC100%1/1
$data[11] ||= 0
$data[11]
Truth table100%2/2
A
A= $data[11]
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | # calculate exons | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 70 | my @exonSizes = split /,/, $data[10]; | |||||||||||||||||||||||||||||||||||||||||
| 323 | 70 | my @exonStarts = map { $data[1] + $_ } split /,/, $data[11]; | |||||||||||||||||||||||||||||||||||||||||
| 324 | 70 | my @exonEnds; | |||||||||||||||||||||||||||||||||||||||||
| 325 | 70 | ▶ | for ( my $i = 0; $i < $data[9]; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 366 | push @exonEnds, $exonStarts[$i] + $exonSizes[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | # calculate new genePred elements | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 70 | my @new = ( | |||||||||||||||||||||||||||||||||||||||||
| 331 | $data[3], # name | ||||||||||||||||||||||||||||||||||||||||||
| 332 | $data[0], # chrom | ||||||||||||||||||||||||||||||||||||||||||
| 333 | $data[5], # strand | ||||||||||||||||||||||||||||||||||||||||||
| 334 | $data[1], # txStart | ||||||||||||||||||||||||||||||||||||||||||
| 335 | $data[2], # txStop | ||||||||||||||||||||||||||||||||||||||||||
| 336 | $data[6], # cdsStart | ||||||||||||||||||||||||||||||||||||||||||
| 337 | $data[7], # cdsEnd | ||||||||||||||||||||||||||||||||||||||||||
| 338 | $data[9], # exonCount | ||||||||||||||||||||||||||||||||||||||||||
| 339 | join( ',', @exonStarts ), # exonStarts | ||||||||||||||||||||||||||||||||||||||||||
| 340 | join( ',', @exonEnds ), # exonEnds | ||||||||||||||||||||||||||||||||||||||||||
| 341 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | # create builder | ||||||||||||||||||||||||||||||||||||||||||
| 344 | 70 | my $builder = Bio::ToolBox::Parser::ucsc::builder->new( \@new, $self ); | |||||||||||||||||||||||||||||||||||||||||
| 345 | 70 | my $feature = $builder->build_transcript; | |||||||||||||||||||||||||||||||||||||||||
| 346 | 70 | $feature->add_tag_value( 'itemRGB', $data[8] ); | |||||||||||||||||||||||||||||||||||||||||
| 347 | 70 | $feature->score( $data[4] ); | |||||||||||||||||||||||||||||||||||||||||
| 348 | 70 | $feature->primary_id( sprintf( "%s:%d-%d", $data[0], $data[1], $data[2] ) ); | |||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | # change the primary ID to match other bed file behavior, not UCSC files' | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 70 | return $feature; | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 16 | ▶ | sub _parse_gappedPeak { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_gappedPeak: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 16 | my ( $self, $line ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 356 | 16 | my @data = split /\t/, $line; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 16 | ▶ | unless ( scalar(@data) == 15 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 358 | croak sprintf( "FATAL: GappedPeak line %d '%s' doesn't have 15 elements!", | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $self->{line_count}, $line ); | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | # we will take advantage of pre-existing code in the UCSC parser to convert | ||||||||||||||||||||||||||||||||||||||||||
| 363 | # a gappedPeak line into main peak with subpeaks. | ||||||||||||||||||||||||||||||||||||||||||
| 364 | # we just have to go through a genePred format first | ||||||||||||||||||||||||||||||||||||||||||
| 365 | # fortunately, the two are pretty similar in structure | ||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | # calculate exons, er, sub peaks | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 16 | my @exonSizes = split /,/, $data[10]; | |||||||||||||||||||||||||||||||||||||||||
| 369 | 16 | my @exonStarts = map { $data[1] + $_ } split /,/, $data[11]; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 16 | my @exonEnds; | |||||||||||||||||||||||||||||||||||||||||
| 371 | 16 | ▶ | for ( my $i = 0; $i < $data[9]; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 41 | push @exonEnds, $exonStarts[$i] + $exonSizes[$i]; | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | # calculate new genePred elements | ||||||||||||||||||||||||||||||||||||||||||
| 376 | 16 | my @new = ( | |||||||||||||||||||||||||||||||||||||||||
| 377 | $data[3], # name | ||||||||||||||||||||||||||||||||||||||||||
| 378 | $data[0], # chrom | ||||||||||||||||||||||||||||||||||||||||||
| 379 | $data[5], # strand | ||||||||||||||||||||||||||||||||||||||||||
| 380 | $data[1], # txStart | ||||||||||||||||||||||||||||||||||||||||||
| 381 | $data[2], # txStop | ||||||||||||||||||||||||||||||||||||||||||
| 382 | $data[6], # cdsStart | ||||||||||||||||||||||||||||||||||||||||||
| 383 | $data[7], # cdsEnd | ||||||||||||||||||||||||||||||||||||||||||
| 384 | $data[9], # exonCount | ||||||||||||||||||||||||||||||||||||||||||
| 385 | join( ',', @exonStarts ), # exonStarts | ||||||||||||||||||||||||||||||||||||||||||
| 386 | join( ',', @exonEnds ), # exonEnds | ||||||||||||||||||||||||||||||||||||||||||
| 387 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | # create builder and process | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 16 | my $builder = Bio::ToolBox::Parser::ucsc::builder->new( \@new, $self ); | |||||||||||||||||||||||||||||||||||||||||
| 391 | 16 | my $feature = $builder->build_transcript; | |||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | # clean up feature and add extra values | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 16 | $feature->add_tag_value( 'itemRGB', $data[8] ); | |||||||||||||||||||||||||||||||||||||||||
| 395 | 16 | $feature->score( $data[4] ); | |||||||||||||||||||||||||||||||||||||||||
| 396 | 16 | $feature->primary_tag('gappedPeak'); # it is not a RNA | |||||||||||||||||||||||||||||||||||||||||
| 397 | 16 | $feature->primary_id( sprintf( "%s:%d-%d", $data[0], $data[1], $data[2] ) ); | |||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | # change the primary ID to match other bed file behavior, not UCSC files' | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 16 | $feature->add_tag_value( 'signalValue', $data[12] ); | |||||||||||||||||||||||||||||||||||||||||
| 401 | 16 | $feature->add_tag_value( 'pValue', $data[13] ); | |||||||||||||||||||||||||||||||||||||||||
| 402 | 16 | $feature->add_tag_value( 'qValue', $data[14] ); | |||||||||||||||||||||||||||||||||||||||||
| 403 | 16 | foreach my $f ( $feature->get_SeqFeatures ) { | |||||||||||||||||||||||||||||||||||||||||
| 404 | 41 | $f->primary_tag('peak'); | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | 16 | return $feature; | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | __END__ | ||||||||||||||||||||||||||||||||||||||||||