| 1 | # BioPerl module for RepeatMasker | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||
| 5 | # Cared for by Shawn Hoon <shawnh@fugu-sg.org> | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # Copyright Shawn Hoon | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | Bio::Tools::Run::RepeatMasker - Wrapper for RepeatMasker Program | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | use Bio::Tools::Run::RepeatMasker; | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | my @params=("mam" => 1,"noint"=>1); | ||||||||||||||||||||||||||||
| 22 | my $factory = Bio::Tools::Run::RepeatMasker->new(@params); | ||||||||||||||||||||||||||||
| 23 | $in = Bio::SeqIO->new(-file => "contig1.fa", | ||||||||||||||||||||||||||||
| 24 | -format => 'fasta'); | ||||||||||||||||||||||||||||
| 25 | my $seq = $in->next_seq(); | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | #return an array of Bio::SeqFeature::FeaturePair objects | ||||||||||||||||||||||||||||
| 28 | my @feats = $factory->run($seq); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | # or | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | $factory->run($seq); | ||||||||||||||||||||||||||||
| 33 | my @feats = $factory->repeat_features; | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | #return the masked sequence, a Bio::SeqI object | ||||||||||||||||||||||||||||
| 36 | my $masked_seq = $factory->run; | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | To use this module, the RepeatMasker program (and probably database) must be | ||||||||||||||||||||||||||||
| 41 | installed. RepeatMasker is a program that screens DNA sequences for interspersed | ||||||||||||||||||||||||||||
| 42 | repeats known to exist in mammalian genomes as well as for low | ||||||||||||||||||||||||||||
| 43 | complexity DNA sequences. For more information, on the program and its | ||||||||||||||||||||||||||||
| 44 | usage, please refer to http://www.repeatmasker.org/. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | Having installed RepeatMasker, you must let Bioperl know where it is. | ||||||||||||||||||||||||||||
| 47 | This can be done in (at least) three ways: | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 1. Make sure the RepeatMasker executable is in your path. | ||||||||||||||||||||||||||||
| 50 | 2. Define an environmental variable REPEATMASKERDIR which is a | ||||||||||||||||||||||||||||
| 51 | directory which contains the RepeatMasker executable: | ||||||||||||||||||||||||||||
| 52 | In bash: | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | export REPEATMASKERDIR=/home/username/RepeatMasker/ | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | In csh/tcsh: | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | setenv REPEATMASKERDIR /home/username/RepeatMasker/ | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 3. Include a definition of an environmental variable REPEATMASKERDIR in | ||||||||||||||||||||||||||||
| 61 | every script that will use this RepeatMasker wrapper module, e.g.: | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | BEGIN { $ENV{REPEATMASKERDIR} = '/home/username/RepeatMasker/' } | ||||||||||||||||||||||||||||
| 64 | use Bio::Tools::Run::RepeatMasker; | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | =head2 Mailing Lists | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||
| 71 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||
| 72 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 75 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | =head2 Support | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||
| 84 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||
| 85 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||
| 86 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||
| 91 | the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||
| 92 | web: | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | http://redmine.open-bio.org/projects/bioperl/ | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | =head1 AUTHOR - Shawn Hoon | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | Email shawnh@fugu-sg.org | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||
| 106 | methods. Internal methods are usually preceded with a "_". | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | package Bio::Tools::Run::RepeatMasker; | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 1 | ▶ | use vars qw($AUTOLOAD @ISA $PROGRAM $PROGRAMDIR $PROGRAMNAME | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 114 | 1 | @RM_SWITCHES @RM_PARAMS @OTHER_SWITCHES %OK_FIELD); | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 117 | 1 | ▶ | use Bio::SeqFeature::Generic; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 118 | 1 | ▶ | use Bio::SeqFeature::FeaturePair; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 119 | 1 | ▶ | use Bio::Root::Root; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 120 | 1 | ▶ | use Bio::Tools::Run::WrapperBase; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 121 | 1 | ▶ | use Bio::Tools::RepeatMasker; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | # Let the code begin... | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 1 | @ISA = qw(Bio::Root::Root Bio::Tools::Run::WrapperBase ); | |||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 129 | 1 | @RM_PARAMS = qw(DIR DIV LIB CUTOFF PARALLEL GC FRAG SPECIES MAXSIZE ); | |||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 1 | @RM_SWITCHES = qw(NOLOW LOW L NOINT INT NORNA ALU M MUS ROD | |||||||||||||||||||||||||||
| 132 | RODENT MAM MAMMAL COW AR | ||||||||||||||||||||||||||||
| 133 | ARABIDOPSIS DR DROSOPHILA EL ELEGANS | ||||||||||||||||||||||||||||
| 134 | IS_ONLY IS_CLIP NO_IS RODSPEC E EXCLN | ||||||||||||||||||||||||||||
| 135 | NO_ID FIXED XM U GFF ACE POLY X XSMALL SMALL | ||||||||||||||||||||||||||||
| 136 | INV A ALIGNMENTS | ||||||||||||||||||||||||||||
| 137 | PRIMSPEC W WUBLAST S Q QQ GCCALC NOCUT); | ||||||||||||||||||||||||||||
| 138 | 1 | @OTHER_SWITCHES = qw(NOISY QUIET SILENT); | |||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | # Authorize attribute fields | ||||||||||||||||||||||||||||
| 141 | 1 | foreach my $attr ( @RM_PARAMS, @RM_SWITCHES, | |||||||||||||||||||||||||||
| 142 | 59 | @OTHER_SWITCHES) { $OK_FIELD{$attr}++; } | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | =head2 program_name | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | Title : program_name | ||||||||||||||||||||||||||||
| 148 | Usage : $factory>program_name() | ||||||||||||||||||||||||||||
| 149 | Function: holds the program name | ||||||||||||||||||||||||||||
| 150 | Returns: string | ||||||||||||||||||||||||||||
| 151 | Args : None | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | =cut | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 6 | ▶ | sub program_name { | ||||||||||||||||||||||||||
|
Subroutine
program_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 156 | 6 | return 'RepeatMasker'; | |||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | =head2 program_dir | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | Title : program_dir | ||||||||||||||||||||||||||||
| 162 | Usage : $factory->program_dir(@params) | ||||||||||||||||||||||||||||
| 163 | Function: returns the program directory, obtained from ENV variable. | ||||||||||||||||||||||||||||
| 164 | Returns: string | ||||||||||||||||||||||||||||
| 165 | Args : | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =cut | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | 3 | ▶ | sub program_dir { | ||||||||||||||||||||||||||
|
Subroutine
program_dir: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||
| 170 | 3 | ▶ | return Bio::Root::IO->catfile($ENV{REPEATMASKERDIR}) if $ENV{REPEATMASKERDIR}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 3 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||
| 175 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 176 | 3 | my $attr = $AUTOLOAD; | |||||||||||||||||||||||||||
| 177 | 3 | $attr =~ s/.*:://; | |||||||||||||||||||||||||||
| 178 | 3 | $attr = uc $attr; | |||||||||||||||||||||||||||
| 179 | 3 | ▶ | $self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 3 | ▶ | $self->{$attr} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | 3 | return $self->{$attr}; | |||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | =head2 new | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | Title : new | ||||||||||||||||||||||||||||
| 187 | Usage : $rm->new($seq) | ||||||||||||||||||||||||||||
| 188 | Function: creates a new wrapper | ||||||||||||||||||||||||||||
| 189 | Returns: Bio::Tools::Run::RepeatMasker | ||||||||||||||||||||||||||||
| 190 | Args : self | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | =cut | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 195 | 1 | my ($class, @args) = @_; | |||||||||||||||||||||||||||
| 196 | 1 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | 1 | my ($attr, $value); | |||||||||||||||||||||||||||
| 199 | # Need to check that filehandle is not left open here... | ||||||||||||||||||||||||||||
| 200 | 1 | ▶ | while (@args) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | 4 | $attr = shift @args; | |||||||||||||||||||||||||||
| 202 | 4 | $value = shift @args; | |||||||||||||||||||||||||||
| 203 | 4 | ▶ | next if( $attr =~ /^-/ ); # don't want named parameters | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | 3 | $self->$attr($value); | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | # unless ($self->executable()) { | ||||||||||||||||||||||||||||
| 207 | # if( $self->verbose >= 0 ) { | ||||||||||||||||||||||||||||
| 208 | # warn "RepeatMasker program not found as ".($self->executable||''). | ||||||||||||||||||||||||||||
| 209 | # " or not executable. \n"; | ||||||||||||||||||||||||||||
| 210 | # } | ||||||||||||||||||||||||||||
| 211 | # } | ||||||||||||||||||||||||||||
| 212 | 1 | return $self; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | =head2 version | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | Title : version | ||||||||||||||||||||||||||||
| 218 | Usage : | ||||||||||||||||||||||||||||
| 219 | Function: Determine the version number of the program | ||||||||||||||||||||||||||||
| 220 | Example : | ||||||||||||||||||||||||||||
| 221 | Returns : float or undef | ||||||||||||||||||||||||||||
| 222 | Args : none | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | =cut | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub version { | ||||||||||||||||||||||||||
|
Subroutine
version: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 227 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 228 | 0 | ▶ | return $self->{'_version'} if( defined $self->{'_version'} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | 0 | my $exe = $self->executable; | |||||||||||||||||||||||||||
| 230 | 0 | ▶ | return undef unless $exe; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | 0 | my $string = `$exe -- ` ; | |||||||||||||||||||||||||||
| 232 | 0 | ▶ | if( $string =~ /\(([\d.]+)\)/ || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$string =~ /\(([\d.]+)\)/ or $string =~ /RepeatMasker\s+version\s+(\S+)/
MC/DC0%0/2
$string =~ /\(([\d.]+)\)/ or $string =~ /RepeatMasker\s+version\s+(\S+)/
$string =~ /\(([\d.]+)\)/
$string =~ /RepeatMasker\s+version\s+(\S+)/
Truth table0%0/3
A or B
A= $string =~ /\(([\d.]+)\)/B= $string =~ /RepeatMasker\s+version\s+(\S+)/
| |||||||||||||||||||||||||||||
| 233 | $string =~ /RepeatMasker\s+version\s+(\S+)/ ) { | ||||||||||||||||||||||||||||
| 234 | 0 | return $self->{'_version'} = $1; | |||||||||||||||||||||||||||
| 235 | } else { | ||||||||||||||||||||||||||||
| 236 | 0 | return $self->{'_version'} = undef; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =head2 run | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | Title : run | ||||||||||||||||||||||||||||
| 244 | Usage : $rm->run($seq); | ||||||||||||||||||||||||||||
| 245 | Function: Run Repeatmasker on the sequence set as | ||||||||||||||||||||||||||||
| 246 | the argument | ||||||||||||||||||||||||||||
| 247 | Returns : an array of repeat features that are | ||||||||||||||||||||||||||||
| 248 | Bio::SeqFeature::FeaturePairs | ||||||||||||||||||||||||||||
| 249 | Args : Bio::PrimarySeqI compliant object | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | =cut | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 254 | 0 | my ($self,$seq) = @_; | |||||||||||||||||||||||||||
| 255 | 0 | my ($infile); | |||||||||||||||||||||||||||
| 256 | 0 | $infile = $self->_setinput($seq); | |||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 0 | my $param_string = $self->_setparams(); | |||||||||||||||||||||||||||
| 259 | 0 | my @repeat_feats = $self->_run($infile,$param_string); | |||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 0 | return @repeat_feats; | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | =head2 mask | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | Title : mask | ||||||||||||||||||||||||||||
| 268 | Usage : $rm->mask($seq) | ||||||||||||||||||||||||||||
| 269 | Function: This method is deprecated. Call run() instead | ||||||||||||||||||||||||||||
| 270 | Example : | ||||||||||||||||||||||||||||
| 271 | Returns : an array of repeat features that are | ||||||||||||||||||||||||||||
| 272 | Bio::SeqFeature::FeaturePairs | ||||||||||||||||||||||||||||
| 273 | Args : Bio::PrimarySeqI compliant object | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | =cut | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | 0 | ▶ | sub mask{ | ||||||||||||||||||||||||||
|
Subroutine
mask: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 278 | 0 | return shift->run(@_); | |||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | =head2 _run | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | Title : _run | ||||||||||||||||||||||||||||
| 285 | Usage : $rm->_run ($filename,$param_string) | ||||||||||||||||||||||||||||
| 286 | Function: internal function that runs the repeat masker | ||||||||||||||||||||||||||||
| 287 | Example : | ||||||||||||||||||||||||||||
| 288 | Returns : an array of repeat features | ||||||||||||||||||||||||||||
| 289 | Args : the filename to the input sequence and the parameter string | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | =cut | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | ▶ | sub _run { | ||||||||||||||||||||||||||
|
Subroutine
_run: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 294 | 0 | my ($self,$infile,$param_string) = @_; | |||||||||||||||||||||||||||
| 295 | 0 | my $instring; | |||||||||||||||||||||||||||
| 296 | 0 | $self->debug( "Program ".$self->executable."\n"); | |||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | my $outfile = $infile.".out"; | |||||||||||||||||||||||||||
| 299 | 0 | my $cmd_str = $self->executable." $param_string ". $infile; | |||||||||||||||||||||||||||
| 300 | 0 | $self->debug("repeat masker command = $cmd_str"); | |||||||||||||||||||||||||||
| 301 | 0 | ▶ | if ($self->quiet || $self->verbose <=0){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->quiet or $self->verbose <= 0
MC/DC0%0/2
$self->quiet or $self->verbose <= 0
$self->quiet
$self->verbose <= 0
Truth table0%0/3
A or B
A= $self->quietB= $self->verbose <= 0
| |||||||||||||||||||||||||||||
| 302 | 0 | ▶ | my $null = ($^O =~ m/mswin/i) ? 'NUL' : '/dev/null'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | 0 | $cmd_str.=" 2> $null 1>$null"; | |||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | 0 | my $status = system($cmd_str); | |||||||||||||||||||||||||||
| 306 | 0 | ▶ | $self->throw("Repeat Masker Call($cmd_str) crashed: $?\n") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 307 | unless $status == 0; | ||||||||||||||||||||||||||||
| 308 | 0 | ▶ | unless (open (RM, $outfile)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 309 | 0 | $self->throw("Cannot open RepeatMasker outfile for parsing"); | |||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||
| 311 | 0 | my $rpt_parser = Bio::Tools::RepeatMasker->new(-fh=>\*RM); | |||||||||||||||||||||||||||
| 312 | 0 | my @rpt_feat; | |||||||||||||||||||||||||||
| 313 | 0 | ▶ | while(my $rpt_feat = $rpt_parser->next_result){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 314 | 0 | push @rpt_feat, $rpt_feat; | |||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | 0 | $self->repeat_features(\@rpt_feat); | |||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | #get masked sequence | ||||||||||||||||||||||||||||
| 319 | 0 | my $masked = $infile.".masked"; | |||||||||||||||||||||||||||
| 320 | 0 | my $seqio = Bio::SeqIO->new(-file=>$masked,-format=>'FASTA'); | |||||||||||||||||||||||||||
| 321 | 0 | $self->masked_seq($seqio->next_seq); | |||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | 0 | return @rpt_feat; | |||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =head2 masked_seq | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | Title : masked_seq | ||||||||||||||||||||||||||||
| 329 | Usage : $rm->masked_seq($seq) | ||||||||||||||||||||||||||||
| 330 | Function: get/set for masked sequence | ||||||||||||||||||||||||||||
| 331 | Example : | ||||||||||||||||||||||||||||
| 332 | Returns : the masked sequence | ||||||||||||||||||||||||||||
| 333 | Args : Bio::Seq object | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | =cut | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | 0 | ▶ | sub masked_seq { | ||||||||||||||||||||||||||
|
Subroutine
masked_seq: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 338 | 0 | my ($self,$seq) = @_; | |||||||||||||||||||||||||||
| 339 | 0 | ▶ | if($seq){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 340 | 0 | $self->{'_masked_seq'} = $seq; | |||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||
| 342 | 0 | return $self->{'_masked_seq'}; | |||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | =head2 repeat_features | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | Title : repeat_features | ||||||||||||||||||||||||||||
| 348 | Usage : $rm->repeat_features(\@rf) | ||||||||||||||||||||||||||||
| 349 | Function: get/set for repeat features array | ||||||||||||||||||||||||||||
| 350 | Example : | ||||||||||||||||||||||||||||
| 351 | Returns : the array of repeat features | ||||||||||||||||||||||||||||
| 352 | Args : | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =cut | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | 0 | ▶ | sub repeat_features { | ||||||||||||||||||||||||||
|
Subroutine
repeat_features: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 357 | 0 | my ($self,$rf) = @_; | |||||||||||||||||||||||||||
| 358 | 0 | ▶ | if($rf) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 359 | 0 | $self->{'_rf'} = $rf; | |||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||
| 361 | 0 | return @{$self->{'_rf'}}; | |||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | =head2 _setparams() | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | Title : _setparams | ||||||||||||||||||||||||||||
| 367 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 368 | Function: Create parameter inputs for repeatmasker program | ||||||||||||||||||||||||||||
| 369 | Example : | ||||||||||||||||||||||||||||
| 370 | Returns : parameter string to be passed to repeatmasker | ||||||||||||||||||||||||||||
| 371 | Args : name of calling object | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | =cut | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | 0 | ▶ | sub _setparams { | ||||||||||||||||||||||||||
|
Subroutine
_setparams: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 376 | 0 | my ($attr, $value, $self); | |||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | 0 | $self = shift; | |||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | 0 | my $param_string = ""; | |||||||||||||||||||||||||||
| 381 | 0 | for $attr ( @RM_PARAMS ) { | |||||||||||||||||||||||||||
| 382 | 0 | $value = $self->$attr(); | |||||||||||||||||||||||||||
| 383 | 0 | ▶ | next unless (defined $value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | 0 | my $attr_key = lc $attr; #put params in format expected by dba | |||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 0 | $attr_key = ' -'.$attr_key; | |||||||||||||||||||||||||||
| 388 | 0 | $param_string .= $attr_key.' '.$value; | |||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | 0 | for $attr ( @RM_SWITCHES) { | |||||||||||||||||||||||||||
| 392 | 0 | $value = $self->$attr(); | |||||||||||||||||||||||||||
| 393 | 0 | ▶ | next unless ($value); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 394 | 0 | my $attr_key = lc $attr; #put switches in format expected by dba | |||||||||||||||||||||||||||
| 395 | 0 | $attr_key = ' -'.$attr_key; | |||||||||||||||||||||||||||
| 396 | 0 | $param_string .= $attr_key ; | |||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||
| 400 | 0 | return $param_string; | |||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||
| 404 | =head2 _setinput() | ||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||
| 406 | Title : _setinput | ||||||||||||||||||||||||||||
| 407 | Usage : Internal function, not to be called directly | ||||||||||||||||||||||||||||
| 408 | Function: writes input sequence to file and return the file name | ||||||||||||||||||||||||||||
| 409 | Example : | ||||||||||||||||||||||||||||
| 410 | Returns : string | ||||||||||||||||||||||||||||
| 411 | Args : a Bio::PrimarySeqI compliant object | ||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | =cut | ||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | 0 | ▶ | sub _setinput { | ||||||||||||||||||||||||||
|
Subroutine
_setinput: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 416 | 0 | my ($self,$seq) = @_; | |||||||||||||||||||||||||||
| 417 | 0 | ▶ | $seq->isa("Bio::PrimarySeqI") || | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | $self->throw("Need a Bio::PrimarySeq compliant object for RepeatMasker"); | ||||||||||||||||||||||||||||
| 419 | # my $in = Bio::SeqIO->new(-file => $infilename , '-format' => 'Fasta'); | ||||||||||||||||||||||||||||
| 420 | 0 | my ($tfh1,$outfile1) = $self->io->tempfile(-dir=>$self->tempdir); | |||||||||||||||||||||||||||
| 421 | 0 | my $out1 = Bio::SeqIO->new(-fh=> $tfh1 , '-format' => 'fasta'); | |||||||||||||||||||||||||||
| 422 | 0 | $out1->write_seq($seq); | |||||||||||||||||||||||||||
| 423 | 0 | close($tfh1); | |||||||||||||||||||||||||||
| 424 | 0 | undef $tfh1; | |||||||||||||||||||||||||||
| 425 | 0 | return ($outfile1); | |||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | =head1 Bio::Tools::Run::Wrapper methods | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | =cut | ||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||
| 434 | =head2 no_param_checks | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | Title : no_param_checks | ||||||||||||||||||||||||||||
| 437 | Usage : $obj->no_param_checks($newval) | ||||||||||||||||||||||||||||
| 438 | Function: Boolean flag as to whether or not we should | ||||||||||||||||||||||||||||
| 439 | trust the sanity checks for parameter values | ||||||||||||||||||||||||||||
| 440 | Returns : value of no_param_checks | ||||||||||||||||||||||||||||
| 441 | Args : newvalue (optional) | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | =cut | ||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||
| 446 | =head2 save_tempfiles | ||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | Title : save_tempfiles | ||||||||||||||||||||||||||||
| 449 | Usage : $obj->save_tempfiles($newval) | ||||||||||||||||||||||||||||
| 450 | Function: | ||||||||||||||||||||||||||||
| 451 | Returns : value of save_tempfiles | ||||||||||||||||||||||||||||
| 452 | Args : newvalue (optional) | ||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||
| 455 | =cut | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | =head2 outfile_name | ||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||
| 459 | Title : outfile_name | ||||||||||||||||||||||||||||
| 460 | Usage : my $outfile = $codeml->outfile_name(); | ||||||||||||||||||||||||||||
| 461 | Function: Get/Set the name of the output file for this run | ||||||||||||||||||||||||||||
| 462 | (if you wanted to do something special) | ||||||||||||||||||||||||||||
| 463 | Returns : string | ||||||||||||||||||||||||||||
| 464 | Args : [optional] string to set value to | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||
| 467 | =cut | ||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | =head2 tempdir | ||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||
| 472 | Title : tempdir | ||||||||||||||||||||||||||||
| 473 | Usage : my $tmpdir = $self->tempdir(); | ||||||||||||||||||||||||||||
| 474 | Function: Retrieve a temporary directory name (which is created) | ||||||||||||||||||||||||||||
| 475 | Returns : string which is the name of the temporary directory | ||||||||||||||||||||||||||||
| 476 | Args : none | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||
| 479 | =cut | ||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||
| 481 | =head2 cleanup | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | Title : cleanup | ||||||||||||||||||||||||||||
| 484 | Usage : $codeml->cleanup(); | ||||||||||||||||||||||||||||
| 485 | Function: Will cleanup the tempdir directory | ||||||||||||||||||||||||||||
| 486 | Returns : none | ||||||||||||||||||||||||||||
| 487 | Args : none | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||
| 490 | =cut | ||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||
| 492 | =head2 io | ||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||
| 494 | Title : io | ||||||||||||||||||||||||||||
| 495 | Usage : $obj->io($newval) | ||||||||||||||||||||||||||||
| 496 | Function: Gets a L<Bio::Root::IO> object | ||||||||||||||||||||||||||||
| 497 | Returns : L<Bio::Root::IO> | ||||||||||||||||||||||||||||
| 498 | Args : none | ||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | =cut | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | 1 | 1; | |||||||||||||||||||||||||||