Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix *t, multiple failures due to wrong args, fix docs. All test pass.
  • Loading branch information
bosborne committed Oct 7, 2011
1 parent 9c34265 commit 2f5f305
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 37 deletions.
14 changes: 5 additions & 9 deletions lib/Bio/Tools/Run/Alignment/Blat.pm
@@ -1,4 +1,3 @@
# $Id$
#
# Copyright Balamurugan Kumarasamy
#
Expand All @@ -11,15 +10,11 @@ Bio::Tools::Run::Alignment::Blat
=head1 SYNOPSIS
Build a Blat factory.
use Bio::Tools::Run::Alignment::Blat;
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);
my $factory = Bio::Tools::Run::Alignment::Blat->new(-db => $database);
# $report is a SearchIO-compliant object
my $report = $factory->align($seqobj);
=head1 DESCRIPTION
Expand Down Expand Up @@ -107,6 +102,7 @@ our ($PROGRAM, $PROGRAMDIR, $PROGRAMNAME);
our %BLAT_PARAMS = map {$_ => 1} qw(ooc t q tileSize stepSize oneOff
minMatch minScore minIdentity maxGap makeOoc repmatch mask qMask repeats
minRepeatsDivergence dots out maxIntron);

our %BLAT_SWITCHES = map {$_ => 1} qw(prot noHead trimT noTrimA trimHardA
fastMap fine extendThroughN);

Expand Down
56 changes: 28 additions & 28 deletions t/Blat.t
@@ -1,23 +1,21 @@
#!/usr/local/bin/perl
# $Id$
#-*-Perl-*-
# ## Bioperl Test Harness Script for Modules

use strict;

BEGIN {
use Bio::Root::Test;
test_begin(-tests => 33);
test_begin(-tests => 38);

use_ok('Bio::Tools::Run::Alignment::Blat');
use_ok('Bio::SeqIO');
use_ok('Bio::Seq');
}

my $db = test_input_file("blat_dna.fa");

my $query = test_input_file("blat_dna.fa");

my $factory = Bio::Tools::Run::Alignment::Blat->new('quiet' => 1,
"DB" => $db);
my $factory = Bio::Tools::Run::Alignment::Blat->new(-db => $db);
ok $factory->isa('Bio::Tools::Run::Alignment::Blat');

my $blat_present = $factory->executable();
Expand Down Expand Up @@ -51,9 +49,9 @@ SKIP: {
is($hsp->hit->end,1775);

# test alternate formats (not all of these work!)
$factory->reset_parameters('quiet' => 1,
"DB" => $db,
out => 'blast');
$factory->reset_parameters(# -quiet => 1,
-db => $db,
-out => 'blast');
$searchio = $factory->align($query);

like($searchio, qr/blast/, 'BLAST parser');
Expand All @@ -67,12 +65,12 @@ SKIP: {
is($hsp->hit->start,1);
is($hsp->hit->end,1775);

$factory->reset_parameters('quiet' => 1,
"DB" => $db,
out => 'blast9');
$factory->reset_parameters(# -quiet => 1,
-db => $db,
-out => 'blast9');
$searchio = $factory->align($query);

like($searchio, qr/blasttable/, 'Tabuar BLAST parser');
like($searchio, qr/blasttable/, 'Tabular BLAST parser');

$result = $searchio->next_result;
$hit = $result->next_hit;
Expand All @@ -90,16 +88,19 @@ $db = test_input_file("blat_dna.2bit");

$factory = Bio::Tools::Run::Alignment::Blat->new(
-db => $db,
-quiet => 1,

# -quiet => 1,
# note coordinates here are Blat-compatible, 0-based (start, end]
-qsegment => 'sequence_10:0-100',
-tsegment => 'sequence_10:0-100'
);
ok $factory->isa('Bio::Tools::Run::Alignment::Blat');

SKIP: {
skip("Tests require database named blat_dna.2bit", 5) if ! -e $db;
skip("tests that require file named blat_dna.2bit and executable", 10) if ! -e $db;

test_skip(-requires_executable => $factory,
-tests => 10);

my $searchio = $factory->align($db);
my $result = $searchio->next_result;
my $hit = $result->next_hit;
Expand All @@ -111,19 +112,18 @@ SKIP: {
is($hsp->hit->end,100);

# No on-the-fly conversion of Bio::Seq yet
my $sio = Bio::SeqIO->new(-file=>$query,-format=>'fasta');
my $seq = $sio->next_seq ;

#my $sio = Bio::SeqIO->new(-file=>$query,-format=>'fasta');
#my $seq = $sio->next_seq ;

#$searchio = $factory->align($seq);
#$result = $searchio->next_result;
#$hit = $result->next_hit;
#$hsp = $hit->next_hsp;
#isa_ok($hsp, "Bio::Search::HSP::HSPI");
#is($hsp->query->start,1);
#is($hsp->query->end,1775);
#is($hsp->hit->start,1);
#is($hsp->hit->end,1775);
$searchio = $factory->align($seq);
$result = $searchio->next_result;
$hit = $result->next_hit;
$hsp = $hit->next_hsp;
isa_ok($hsp, "Bio::Search::HSP::HSPI");
is($hsp->query->start,1);
is($hsp->query->end,1775);
is($hsp->hit->start,1);
is($hsp->hit->end,1775);
}

1;
Expand Down

0 comments on commit 2f5f305

Please sign in to comment.