Bio::EnsEMBL::Analysis::Runnable::Funcgen MAT
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::Analysis::Runnable::Funcgen::MAT
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Analysis::Runnable
Bio::EnsEMBL::Analysis::Runnable::Funcgen
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( throw warning )
Data::Dumper
Inherit
Bio::EnsEMBL::Analysis::Runnable::Funcgen
Synopsis
  my $runnable = Bio::EnsEMBL::Analysis::Runnable::Funcgen::MAT->new
(
-analysis => $analysis,
-query => 'slice',
-program => 'program.pl',
);
$runnable->run;
my @features = @{$runnable->output};
Description
MAT expects to run the program MAT (Model-based Analysis of Tiling-array, Johnson
et al., PMID: 16895995) and predicts features which can be stored in the
annotated_feature table in the eFG database
Methods
config_file
No description
Code
infileDescriptionCode
queryDescriptionCode
run_analysisDescriptionCode
write_infileDescriptionCode
Methods description
infilecode    nextTop
  Arg [1]     : Bio::EnsEMBL::Analysis::Runnable::MAT
Arg [2] : filename (string)
Description : will hold a given filename or if one is requested but none
defined it will use the create_filename method to create a filename
Returntype : string, filename
Exceptions : none
Example :
querycodeprevnextTop
  Arg [1]   : Bio::EnsEMBL::Analysis::Runnable
Arg [2] : integer
Function : container for the chip number
Returntype: interger
Exceptions: throws if passed an object which isnt a slice
Example :
run_analysiscodeprevnextTop
  Arg [1]     : Bio::EnsEMBL::Analysis::Runnable::MAT
Arg [2] : string, program name
Usage :
Description :
Returns :
Exceptions :
write_infilecodeprevnextTop
    Arg [1]     : Bio::EnsEMBL::Analysis::Runnable::MAT
Arg [2] : filename
Description :
Returntype :
Exceptions :
Example :
Methods code
config_filedescriptionprevnextTop
sub config_file {
    my $self = shift;
    $self->{'config_file'} = shift if(@_);
    return $self->{'config_file'};
}

1;
}
infiledescriptionprevnextTop
sub infile {
    my ($self, $filename) = @_;
    
    if($filename){
        $self->{'infile'} = $filename;
    }
    if(!$self->{'infile'}){
        $self->{'infile'} = $self->create_filename($self->analysis->logic_name, 'dat');
    }
    
    return $self->{'infile'};
}
querydescriptionprevnextTop
sub query {
    my ($self, $chip) = @_;
    if ($chip){
        throw("Must pass RunnableDB::Funcgen::MAT::query an integer ".
              "specifying the chip to br processed not ".$chip) 
            unless($chip =~ m/^\d+$/);
$self->{'chip'} = $chip; } return $self->{'chip'};
}
run_analysisdescriptionprevnextTop
sub run_analysis {
    my ($self, $program) = @_;
    
    if(!$program){
        $program = $self->program;
    }
    throw($program." is not executable") 
        unless($program && -x $program);

    if (! $ENV{INFILE_EXISTS}) {
        
        my $command = $self->program . ' ' . $self->infile;
        
        warn("Running analysis " . $command . "\n");
        
        #eval { system($command) };
throw("FAILED to run $command: ", $@) if ($@); }
}
write_infiledescriptionprevnextTop
sub write_infile {
	
	my ($self, $filename) = @_;

    my $chipno = sprintf("%02d", $self->query);

    if (exists $ENV{INFILE_EXISTS} && $ENV{INFILE_EXISTS}) {

        opendir(DIR, $self->workdir())
            or throw("Can't open dir ".$self->workdir());
        my @files = grep { /.$chipno.tag$/ } readdir DIR;

        throw("More than one tag file fir chip $chipno in ".$self->workdir)
            if (! @files);
        $filename = $self->workdir.'/'.$files[0];

        closedir DIR;

    }

	if (! $filename) {
		($filename = $self->infile()) =~ s/\.dat$/.$chipno.tag/;
	}

    (my $logfile = $filename) =~ s/\.tag$/.log/;
    
    $ENV{BPMAPFILE} =~ s/<CHIPNO>/$chipno/;
    $ENV{CELFILES} =~ s/<CHIPNO>/$chipno/g;

    open(TAG, ">$filename")
        or throw("Can't open .tag-file $filename.");
    print TAG <<EOT;

[data]
BpmapFolder = $ENV{BPMAPFOLDER}
CelFolder = $ENV{CELFOLDER}
GenomeGrp = $ENV{GENOMEGRP}
RepLib = $ENV{REPLIB}
Group = $ENV{GROUP}
Pair = $ENV{PAIR}

[bpmap]
1 = $ENV{BPMAPFILE}

[cel]
1 = $ENV{CELFILES}

[intensity analysis]
BandWidth = $ENV{BANDWIDTH}
MaxGap = $ENV{MAXGAP}
MinProbe = $ENV{MINPROBE}

[interval analysis]
Matscore =
Pvalue = 1e-5
FDR =
Extend =

[output]
Log = $logfile

EOT
close TAG; $self->infile($filename); (my $bedfile = $filename) =~ s/\.tag$/.bed/; $self->resultsfile($bedfile); # set columns (fields) for output
my @fields = (0..2,4); # bed
$self->output_fields(\@fields); return $filename;
}
General documentation
LICENCETop
This code is distributed under an Apache style licence. Please see
/info/about/code_licence.html for details.
AUTHORTop
Stefan Graf, Ensembl Functional Genomics -
CONTACTTop
Post questions to the Ensembl development list: ensembl-dev@ebi.ac.uk