Bio::Tools::Run::Alignment Blat
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvs
Summary
Bio::Tools::Run::Alignment::Blat
Package variables
No package variables defined.
Included modules
Bio::Factory::ApplicationFactoryI
Bio::Root::Root
Bio::SearchIO
Bio::SeqIO
Bio::Tools::Run::WrapperBase
Inherit
Bio::Root::Root Bio::Tools::Run::WrapperBase
Synopsis
Build a Blat factory.
  use Bio::Tools::Run::Alignment::Blat;
my $factory = Bio::Tools::Run::Alignment::Blat->new(); # Pass the factory a Bio::Seq object # @feats is an array of Bio::SeqFeature::Generic objects my @feats = $factory->run($seq,$DB);
Description
Wrapper module for Blat program
Methods
BEGIN Code
program_nameDescriptionCode
program_dirDescriptionCode
AUTOLOAD
No description
Code
newDescriptionCode
runDescriptionCode
alignDescriptionCode
_input()
No description
Code
_database()
No description
Code
_runDescriptionCode
_writeSeqFileDescriptionCode
Methods description
program_namecode    nextTop
 Title   : program_name
Usage : $factory->program_name()
Function: holds the program name
Returns : string
Args : None
program_dircodeprevnextTop
 Title   : program_dir
Usage : $factory->program_dir(@params)
Function: returns the program directory, obtained from ENV variable.
Returns : string
Args :
newcodeprevnextTop
 Title   : new
Usage : $blat->new(@params)
Function: creates a new Blat factory
Returns : Bio::Tools::Run::Alignment::Blat
Args :
runcodeprevnextTop
 Title   :   run()
Usage : $obj->run($query)
Function: Runs Blat and creates an array of featrues
Returns : An array of Bio::SeqFeature::Generic objects
Args : A Bio::PrimarySeqI
aligncodeprevnextTop
 Title   :   align
Usage : $obj->align($query)
Function: Alias to run()
_runcodeprevnextTop
 Title   :   _run
Usage : $obj->_run()
Function: Internal (not to be used directly)
Returns : An array of Bio::SeqFeature::Generic objects
Args :
_writeSeqFilecodeprevnextTop
 Title   :   _writeSeqFile
Usage : obj->_writeSeqFile($seq)
Function: Internal (not to be used directly)
Returns :
Args :
Methods code
BEGINTop
BEGIN {
       @BLAT_PARAMS=qw(DB PROGRAM OOC DB_TYPE QUERY_TYPE TILESIZE 
							  ONEOFF MINMATCH MINSCORE MINIDENTITY MAXGAP 
							  MAKEOOC REPMATCH MASK QMASK 
                       MINREPDIV TRIMT NOTRIMA VERBOSE);
       @OTHER_SWITCHES = qw(QUIET);
       foreach my $attr ( @BLAT_PARAMS, @OTHER_SWITCHES)
			{ $OK_FIELD{$attr}++;
}
program_namedescriptionprevnextTop
sub program_name {
  return 'blat';
}
program_dirdescriptionprevnextTop
sub program_dir {
  return Bio::Root::IO->catfile($ENV{BLATDIR}) if $ENV{BLATDIR};
}
AUTOLOADdescriptionprevnextTop
sub AUTOLOAD {
	my $self = shift;
	my $attr = $AUTOLOAD;
	$attr =~ s/.*:://;
	$attr = uc $attr;
	$self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
	$self->{$attr} = shift if @_;
	return $self->{$attr};
}
newdescriptionprevnextTop
sub new {
	my ($class,@args) = @_;
	my $self = $class->SUPER::new(@args);
	my ($attr, $value);
	while (@args)  {
		$attr =   shift @args;
		$value =  shift @args;
		next if ( $attr =~ /^-/ ); # don't want named parameters
if ($attr =~/PROGRAM/i) { $self->executable(Bio::Root::IO->catfile($value,$self->program_name)); next; } $self->$attr($value); } return $self;
}
rundescriptionprevnextTop
sub run {
	my ($self,$query) = @_;
	my @feats;

	if  (ref($query) ) {	# it is an object
if (ref($query) =~ /GLOB/) { $self->throw("Cannot use filehandle as argument to run()"); } my $infile1 = $self->_writeSeqFile($query); $self->_input($infile1); return $self->_run(); } else { $self->_input($query); return $self->_run(); }
}
aligndescriptionprevnextTop
sub align {
  return shift->run(@_);
}
_input()descriptionprevnextTop
sub _input() {
    my ($self,$infile1) = @_;
    if(defined $infile1){
        $self->{'input'}=$infile1;
     }   
     return $self->{'input'};
}
_database()descriptionprevnextTop
sub _database() {
    my ($self,$infile1) = @_;
    $self->{'db'} = $infile1 if(defined $infile1);
    return $self->{'db'};
}
_rundescriptionprevnextTop
sub _run {
	my ($self)= @_;
	my ($tfh,$outfile) = $self->io->tempfile(-dir=>$Bio::Root::IO::TEMPDIR);
	# this is because we only want a unique filename
close($tfh); undef $tfh; my $str= $self->executable; $str .= ' -out=psl '.$self->DB .' '.$self->_input.' '.$outfile; #this is shell specific, please fix
# if ($self->quiet() || $self->verbose() < 0) {
# $str .= ' >/dev/null 2>/dev/null';
# }
$self->debug($str ."\n") if( $self->verbose > 0 ); my $status = system($str); $self->throw( "Blat call ($str) crashed: $?\n ") unless $status==0; my $blat_obj; if (ref ($outfile) !~ /GLOB/) { $blat_obj = Bio::SearchIO->new(-format => 'psl', -file => $outfile); } else { $blat_obj = Bio::SearchIO->new(-format => 'psl', -fh => $outfile); } system('cp',$outfile,'/tmp/blat.out'); $self->cleanup(); return $blat_obj;
}
_writeSeqFiledescriptionprevnextTop
sub _writeSeqFile {
    my ($self,$seq) = @_;
    #my ($tfh,$inputfile) = $self->io->tempfile(-dir=>$self->tempdir());
my ($tfh,$inputfile) = $self->io->tempfile(-dir=>$Bio::Root::IO::TEMPDIR); my $in = Bio::SeqIO->new(-fh => $tfh , '-format' => 'fasta'); $in->write_seq($seq); $in->close(); undef $in; close($tfh); undef $tfh; return $inputfile; } 1;
}
General documentation
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
  bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support Top
 
Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
  http://bugzilla.open-bio.org/
AUTHOR - BalaTop
 Email bala@tll.org.sg
APPENDIXTop
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
_inputTop
 Title   :   _input
Usage : obj->_input($seqFile)
Function: Internal (not to be used directly)
Returns :
Args :
_databaseTop
 Title   :   _database
Usage : obj->_database($seqFile)
Function: Internal (not to be used directly)
Returns :
Args :