BioPerl-Run

 view release on metacpan or  search on metacpan

lib/Bio/Tools/Run/MCS.pm  view on Meta::CPAN

You can get details here: http://zoo.nhgri.nih.gov/elliott/mcs_doc/. MCS is used
for the prediciton of transcription factor binding sites and other regions of
the genome conserved amongst different species.

Note that this wrapper assumes you already have alignments, so only uses MCS
for the latter stages (the stages involving align2binomial.pl,
generate_phyloMAX_score.pl and generate_mcs_beta.pl).

You can try supplying normal MCS command-line arguments to new(), eg.

  $factory->new(-percentile => 95)

or calling arg-named methods (excluding the initial
hyphens, eg. 

  $factory->percentile(95)

 to set the --percentile arg).


You will need to enable this MCS wrapper to find the MCS scripts.
This can be done in (at least) three ways:

 1. Make sure the MCS scripts are in your path.
 2. Define an environmental variable MCSDIR which is a 
    directory which contains the MCS scripts:
    In bash:

lib/Bio/Tools/Run/MCS.pm  view on Meta::CPAN

use Bio::AlignIO;
use Bio::FeatureIO;
use Bio::Annotation::SimpleValue;

use base qw(Bio::Tools::Run::Phylo::PhyloBase);

our $PROGRAM_NAME = 'align2binomial.pl';
our $PROGRAM_DIR;

# methods for the mcs args we support
our @PARAMS   = qw(neutral percentile mcs specificity sensitivity name);
our @SWITCHES = qw(neg-score);

# just to be explicit, args we don't support (yet) or we handle ourselves
our @UNSUPPORTED = qw(ucsc gtf neutral-only fourd-align align-only ar);

BEGIN {
    # lets add all the mcs scripts to the path so that when we call
    # align2binomial.pl it can find its siblings
    $PROGRAM_DIR = $ENV{'MCSDIR'};
    $ENV{PATH} = "$PROGRAM_DIR:$ENV{PATH}" if $PROGRAM_DIR;

lib/Bio/Tools/Run/Phylo/Molphy/ProtML.pm  view on Meta::CPAN

	my @keys = keys %{ $VALIDFLAGS{$type} };
	for my $k ( @keys ) {
	    my $v = $VALIDFLAGS{$type}->{$k};
	    $VALIDFLAGS{$type}->{$v} = $v;
	}
    }
    %VALIDVALUES = (num_retained     => sub { my $a = shift;
					      if( $a =~ /^\d+$/) {
						  return 'n';
						  }}, # should be a number
		    percent_retained => sub { my $a = shift;
					      if( $a =~ /^\d+$/ &&
						  $a >= 0 && $a <= 100) {
						  return 'P';
					      }}
		    );


}

=head2 program_name

lib/Bio/Tools/Run/Primer3.pm  view on Meta::CPAN

  'PRIMER_QUALITY_RANGE_MIN'=>'(int, default 0) Minimum sequence quality calculated from PRIMER_SEQUENCE_QUALITY',
  'PRIMER_QUALITY_RANGE_MAX'=>'(int, default 100) Maximum sequence quality calculated from PRIMER_SEQUENCE_QUALITY',
  'PRIMER_MAX_END_STABILITY'=>'(float 999.9999, default 100.0) Maximum stability for the five 3 prime bases of a primer. Bigger numbers mean more stable 3 prime ends.',
  'PRIMER_PRODUCT_OPT_TM'=>'(float, default 0.0) Optimum melting temperature for the PCR product. 0 means no optimum.',
  'PRIMER_PRODUCT_OPT_SIZE'=>'(int, default 0) Optimum size for the PCR product. 0 means no optimum.',
  'PRIMER_TASK'=>'(string, default pick_pcr_primers) Choose from pick_pcr_primers, pick_pcr_primers_and_hyb_probe, pick_left_only, pick_right_only, pick_hyb_probe_only',
  'PRIMER_WT_TM_GT'=>'(float, default 1.0) Penalty weight for primers with Tm over PRIMER_OPT_TM.',
  'PRIMER_WT_TM_LT'=>'(float, default 1.0) Penalty weight for primers with Tm under PRIMER_OPT_TM.',
  'PRIMER_WT_SIZE_LT'=>'(float, default 1.0) Penalty weight for primers shorter than PRIMER_OPT_SIZE.',
  'PRIMER_WT_SIZE_GT'=>'(float, default 1.0) Penalty weight for primers longer than PRIMER_OPT_SIZE.',
  'PRIMER_WT_GC_PERCENT_LT'=>'(float, default 1.0) Penalty weight for primers with GC percent greater than PRIMER_OPT_GC_PERCENT.',
  'PRIMER_WT_GC_PERCENT_GT'=>'(float, default 1.0) Penalty weight for primers with GC percent greater than PRIMER_OPT_GC_PERCENT.',
  'PRIMER_WT_COMPL_ANY'=>'(float, default 0.0)',
  'PRIMER_WT_COMPL_END'=>'(float, default 0.0)',
  'PRIMER_WT_NUM_NS'=>'(float, default 0.0)',
  'PRIMER_WT_REP_SIM'=>'(float, default 0.0)',
  'PRIMER_WT_SEQ_QUAL'=>'(float, default 0.0)',
  'PRIMER_WT_END_QUAL'=>'(float, default 0.0)',
  'PRIMER_WT_POS_PENALTY'=>'(float, default 0.0)',
  'PRIMER_WT_END_STABILITY'=>'(float, default 0.0)',
  'PRIMER_PAIR_WT_PR_PENALTY'=>'(float, default 1.0)',
  'PRIMER_PAIR_WT_IO_PENALTY'=>'(float, default 0.0)',

t/Amap.t  view on Meta::CPAN

  my @seq_array =();
  while ( my $seq = $str->next_seq() ) {
    push (@seq_array, $seq) ;
  }
  $aln = $factory->align(\@seq_array);
  # now test its output
  isa_ok( $aln, 'Bio::SimpleAlign');
  is( $aln->num_sequences, 7,                            'Correct number of seqs returned' );

  # Use this alignment to fully test the methods
  is( int($aln->average_percentage_identity), 45,       'Got the correct ave % identity' );
  
}

# TODO: test factory methods that change parameters
#TODO: {
#  local $TODO = 'program_name setting is unfinished';
#  $factory->program_name('something_silly');
#  is( $factory->program_name, 'something_silly',        'Set and got program_name correctly') ;
#}

t/EMBOSS.t  view on Meta::CPAN


    my $alnin = Bio::AlignIO->new(
        -format => 'emboss',
        -file   => $wateroutfile
    );

    ok($alnin);
    my $aln = $alnin->next_aln;
    ok($aln);
    is( $aln->length,                      43 );
    is( $aln->overall_percentage_identity, 100 );
    is( $aln->average_percentage_identity, 100 );

    my ($first) = $aln->each_seq();
    ok( $first->seq(), 'SCWSFSTTGNVEGQHFISQNKLVSLSEQNLVDCDHECMEYEGE' );
    $aln = $alnin->next_aln;
    ok($aln);

    is( $aln->length, $expected{'alnlen'} );
    is( sprintf( "%.2f", $aln->overall_percentage_identity ),
        $expected{'opid'} );
    is( sprintf( "%.2f", $aln->average_percentage_identity ),
        $expected{'apid'} );

    my $cons = $factory->program('cons');
    $cons->verbose(0);
    $in = Bio::AlignIO->new(
        -format => 'msf',
        -file   => test_input_file('cysprot.msf')
    );
    my $aln2 = $in->next_aln;
    if ( $version ge '2.8.0' ) {

t/Kalign.t  view on Meta::CPAN

	my @seq_array =();
	
	while ( my $seq = $str->next_seq() ) {
		push (@seq_array, $seq) ;
	}
	
	my $seq_array_ref = \@seq_array;
	
	$aln = $factory->align($seq_array_ref);
	is $aln->num_sequences, 7;
	my $s1_perid = $aln->average_percentage_identity;
	is(int($s1_perid), 42);
}

t/Lagan.t  view on Meta::CPAN

   $factory->quiet(1);
   isa_ok $factory,'Bio::Tools::Run::Alignment::Lagan';   
   test_skip(-requires_executable => $factory,
             -tests => 5,
             -requires_env => 'LAGAN_DIR');
   
   my $simple_align= $factory->lagan($seq,$seq2);
   
   isa_ok $simple_align, 'Bio::SimpleAlign';
   
   is $simple_align->percentage_identity, 100;
   
   my $multi = $factory->mlagan([$seq,$seq2,$seq3]);
   is $multi->percentage_identity, 100;
   
   my $matrix = Bio::Matrix::Mlagan->new(-values => [[qw(115 -161 -81 -161 0 -72)],
                                                     [qw(-161 115 -161 -81 0 -72)],
                                                     [qw(-81 -161 115 -161 0 -72)],
                                                     [qw(-161 -81 -161 115 0 -72)],
                                                     [qw(0 0 0 0 0 0)],
                                                     [qw(-72 -72 -72 -72 0 -72)]],
                                         -gap_open => -470,
                                         -gap_continue => -25);
   
   is $factory->nuc_matrix($matrix), $matrix;
   #*** weak test; doesn't show the supplied matrix had any effect on results...
   $multi = $factory->mlagan([$seq,$seq2,$seq3]);
   is $multi->percentage_identity, 100;
}

t/MAFFT.t  view on Meta::CPAN

    my @seq_array =();

    while ( my $seq = $str->next_seq() ) {
        push (@seq_array, $seq) ;
    }

    my $seq_array_ref = \@seq_array;

    $aln = $factory->align($seq_array_ref);
    is $aln->num_sequences, 7;
    my $s1_perid = $aln->average_percentage_identity;
    cmp_ok(int($s1_perid), '>=', 42, '42 or 43 expected');

    for my $method ( grep { !/rough/ } $factory->methods ) {
        $factory->method($method);
        $aln = $factory->align($inputfilename);
        is $aln->num_sequences, 7;
        my $s1_perid = $aln->average_percentage_identity;
        ok($s1_perid);
    }

    SKIP: {
        skip("Tests require version 6 of MAFFT", 6) unless $factory->_version6;
        $factory->localpair(1);
        $aln = $factory->align( $inputfilename );
        is $aln->num_sequences, 7;
        $s1_perid = $aln->average_percentage_identity;
        ok($s1_perid);

        $factory->globalpair(1);
        throws_ok { $aln = $factory->align( $inputfilename ) }
                  qr/You can't specify more than one of/,
                  'More than one alignment method throws';

        my @extra_params = qw/ localpair 1 maxiterate 10000 /;
        $factory = Bio::Tools::Run::Alignment::MAFFT->new(@params, @extra_params);
        isa_ok $factory,'Bio::Tools::Run::Alignment::MAFFT';
        $aln = $factory->align( $inputfilename );
        is $aln->num_sequences, 7;
        $s1_perid = $aln->average_percentage_identity;
        ok($s1_perid);
    }
}

t/MSAProbs.t  view on Meta::CPAN

	my @seq_array =();
	
	while ( my $seq = $str->next_seq() ) {
		push (@seq_array, $seq) ;
	}
	
	my $seq_array_ref = \@seq_array;
	
	$aln = $factory->align($seq_array_ref);
	is $aln->num_sequences, 7;
	my $s1_perid = POSIX::ceil($aln->average_percentage_identity);
	is($s1_perid == 43, 1);
	
	my $annotfile = test_output_file();
	my $outfile = test_output_file();
	# add some more params
	@params = ('-quiet'           => 1,
		       '-verbose'         => 0,
	           '-outfile'         => $outfile,
		       '-iterations'      => 5,
		       '-clustalw'        => 1,

t/MSAProbs.t  view on Meta::CPAN

		       '-annot_file'      => $annotfile,
	
		   );
	$factory = Bio::Tools::Run::Alignment::MSAProbs->new(@params);
	my @methods = qw(quiet verbose outfile iterations clustalw consistency
	                 alignment_order annot_file version num_threads);
	can_ok($factory, @methods);
	is($factory->annot_file, $annotfile,'annotation file');
	$aln = $factory->align($seq_array_ref);
	is $aln->num_sequences, 7;
	$s1_perid = POSIX::ceil($aln->average_percentage_identity);
	is($s1_perid == 43, 1 );
	
	my $guesser = Bio::Tools::GuessSeqFormat->new(-file => $outfile);
	my $type = $guesser->guess;
	is($type, 'clustalw', "Expected output is clustalw formatted");
	$inputfilename = test_input_file("cysprot1a.fa");
	$aln = $factory->align($inputfilename);
	is $aln->num_sequences, 3;
	$s1_perid = POSIX::ceil($aln->average_percentage_identity);
	
	is($s1_perid == 42, 1 );
}

t/Muscle.t  view on Meta::CPAN

        -format => 'Fasta'
    );
    my @seq_array = ();
    while ( my $seq = $str->next_seq() ) {
        push( @seq_array, $seq );
    }
    my $seq_array_ref = \@seq_array;

    $aln = $factory->align($seq_array_ref);
    is $aln->num_sequences, 7;
    my $s1_perid = POSIX::ceil( $aln->average_percentage_identity );
    is( $s1_perid == 43 || $s1_perid == 44,
        1, 'diff versions of MUSCLE have different vals' );

    my $logfile = test_output_file();
    my $outfile = test_output_file();

    # add some more params
    my @params = (
        'quiet'         => 1,
        '-outfile_name' => $outfile,

t/Muscle.t  view on Meta::CPAN

        'maxmb'         => 50,
        'maxhours'      => 1,
        'maxiters'      => 20,
        'log'           => $logfile,
        -seqtype        => 'protein',
    );
    $factory = Bio::Tools::Run::Alignment::Muscle->new(@params);
    is( $factory->log, $logfile, 'log file' );
    $aln = $factory->align($seq_array_ref);
    is $aln->num_sequences, 7;
    $s1_perid = POSIX::ceil( $aln->average_percentage_identity );
    is( $s1_perid == 43 || $s1_perid == 44,
        1, 'diff versions of MUSCLE have different vals' );

    $inputfilename = test_input_file("cysprot1a.fa");
    $aln           = $factory->align($inputfilename);
    is $aln->num_sequences, 3;
    $s1_perid = POSIX::ceil( $aln->average_percentage_identity );

    is( $s1_perid == 41 || $s1_perid == 42,
        1, 'diff versions of MUSCLE have different vals' );
}

t/Probalign.t  view on Meta::CPAN

	my @seq_array =();
	
	while ( my $seq = $str->next_seq() ) {
		push (@seq_array, $seq) ;
	}
	
	my $seq_array_ref = \@seq_array;
	
	$aln = $factory->align($seq_array_ref);
	is $aln->num_sequences, 7;
	my $s1_perid = POSIX::ceil($aln->average_percentage_identity);
	is($s1_perid == 43 || $s1_perid == 44, 1,
	   'diff versions of PROBALIGN have different vals');
	
	my $outfile = test_output_file();
	# add some more params
	@params = ('-outfile_name'      => $outfile);
	$factory = Bio::Tools::Run::Alignment::Probalign->new(@params);
	$aln = $factory->align($seq_array_ref);
	is $aln->num_sequences, 7;
	$s1_perid = POSIX::ceil($aln->average_percentage_identity);
	is($s1_perid == 43 || $s1_perid == 44, 1,
	   'diff versions of PROBALIGN have different vals');
	
	
	$inputfilename = test_input_file("cysprot1a.fa");
	$aln = $factory->align($inputfilename);
	is $aln->num_sequences, 3;
	$s1_perid = POSIX::ceil($aln->average_percentage_identity);
	
	is($s1_perid == 41 || $s1_perid == 42, 1,
	   'diff versions of PROBALIGN have different vals');
}

t/Probcons.t  view on Meta::CPAN

	my @seq_array =();
	
	while ( my $seq = $str->next_seq() ) {
		push (@seq_array, $seq) ;
	}
	
	my $seq_array_ref = \@seq_array;
	
	$aln = $factory->align($seq_array_ref);
	is $aln->num_sequences, 7;
	my $s1_avg_perid = $aln->average_percentage_identity;
	is(int($s1_avg_perid), 43);
	my $s1_ovl_perid = $aln->overall_percentage_identity;
	is(int($s1_ovl_perid), 15);
	
	my ($paramsfilename) = test_output_file();
	my ($annotfilename) = test_output_file();
	my ($dummyfilename) = test_output_file();
	my $factory2 = Bio::Tools::Run::Alignment::Probcons->new
		(
		 'iterative-refinement'  => '1000',
		 'consistency'   => '5',
		 'emissions' => '',

t/Probcons.t  view on Meta::CPAN

	
	$factory2 = Bio::Tools::Run::Alignment::Probcons->new
		(
		 'iterative-refinement'  => '1000',
		 'consistency'   => '5',
		 'annot'   => $annotfilename,
		 'paramfile'   => $paramsfilename,
		);
	$factory->outfile_name($dummyfilename);
	$aln2 = $factory2->align($seq_array_ref);
	my $s2_avg_perid = $aln2->average_percentage_identity;
	my $s2_ovl_perid = $aln2->overall_percentage_identity;
	cmp_ok(int($s2_avg_perid), '>=', 42);
	cmp_ok(int($s2_ovl_perid), '>=', 15);
}

END {
	if (-e 'iterative-refinement') {
		unlink('iterative-refinement');
	}
}



( run in 0.570 second using v1.01-cache-2.11-cpan-709fd43a63f )