<commit_before>## Bioperl Test Harness Script for Modules
##
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'

#-----------------------------------------------------------------------
## perl test harness expects the following output syntax only!
## 1..3
## ok 1  [not ok 1 (if test fails)]
## 2..3
## ok 2  [not ok 2 (if test fails)]
## 3..3
## ok 3  [not ok 3 (if test fails)]
##
## etc. etc. etc. (continue on for each tested function in the .t file)
#-----------------------------------------------------------------------



## We start with some black magic to print on failure.
BEGIN { 
        $| = 1; print "1..6\n"; 
	    require "Bio/EnsEMBL/Pipeline/pipeConf.pl";
	    use vars qw($loaded); 
      }

END {   print "not ok 1\n" unless $loaded;  }

use lib 't';
use EnsTestDB;
use Bio::EnsEMBL::Pipeline::RunnableDB::Genscan;
use Bio::EnsEMBL::Analysis;

$loaded = 1;
print "ok 1\n";    # 1st test passes.
    
my $ens_test = EnsTestDB->new();
# Load some data into the db
$ens_test->do_sql_file("t/runnabledb.dump");
    
# Get an EnsEMBL db object for the test db
my $db = $ens_test->get_DBSQL_Obj;
print "ok 2\n";    

my $runnable = 'Bio::EnsEMBL::Pipeline::RunnableDB::Genscan';
my $ana_adaptor = $db->get_AnalysisAdaptor;


my $ana = Bio::EnsEMBL::Analysis->new (   -db             => 'HumanIso',
					  -db_version     => '__NONE__',
					  -db_file        => '/usr/local/ensembl/data/HumanIso.smat',
					  -program        => 'Genscan',
					  -program_file   => '/usr/local/ensembl/bin/genscan',
					  -module         => $runnable,
					  -module_version => 1,
					  -gff_source     => 'genscan',
					  -gff_feature    => 'exon', 
					  -logic_name     => 'genscan',
				      );

unless ($ana)
{ print "not ok 3\n"; }
else
{ print "ok 3\n"; }
my $id ='AB015752.00001';
$ana_adaptor->exists( $ana );
my $runobj = "$runnable"->new(-dbobj      => $db,
			      -input_id   => $id,
			      -analysis   => $ana );
unless ($runobj)
{ print "not ok 4\n"; }
else
{ print "ok 4\n"; }

$runobj->fetch_input;;
$runobj->run;

my @out = $runobj->output;
unless (@out)
{ print "not ok 5\n"; }
else
{ print "ok 5\n"; }
display(@out);

$runobj->write_output();

print STDERR "Written output\n";
my $contig = $db->get_Contig($id);
my @features = $contig->get_all_PredictionFeatures();

print STDERR "Got features\n";
display(@features);

foreach my $f (@features) {
  my $transcript = Bio::EnsEMBL::TranscriptFactory::fset2transcript($f,$contig);
  print "Transcrip " . $transcript->translate->seq . "\n";
}    




unless (@features)
{ print "not ok 6\n"; }
else
{ print "ok 6\n"; }

sub display {
  my @results = @_;

  foreach my $obj (@results) {

    print STDERR ($obj->gffstring."\n");

    if ($obj->sub_SeqFeature) {
      foreach my $exon ($obj->sub_SeqFeature) {
	print STDERR "Sub: ".$exon->gffstring."\n";
      }
    }
  }
}<commit_msg>works with changes to trunk code<commit_after>## Bioperl Test Harness Script for Modules
##
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.t'

#-----------------------------------------------------------------------
## perl test harness expects the following output syntax only!
## 1..3
## ok 1  [not ok 1 (if test fails)]
## 2..3
## ok 2  [not ok 2 (if test fails)]
## 3..3
## ok 3  [not ok 3 (if test fails)]
##
## etc. etc. etc. (continue on for each tested function in the .t file)
#-----------------------------------------------------------------------



## We start with some black magic to print on failure.
BEGIN { 
        $| = 1; print "1..6\n"; 
	    require "Bio/EnsEMBL/Pipeline/pipeConf.pl";
	    use vars qw($loaded); 
      }

END {   print "not ok 1\n" unless $loaded;  }

use lib 't';
use EnsTestDB;
use Bio::EnsEMBL::Pipeline::RunnableDB::Genscan;
use Bio::EnsEMBL::Analysis;

$loaded = 1;
print "ok 1\n";    # 1st test passes.
    
my $ens_test = EnsTestDB->new();
# Load some data into the db
$ens_test->do_sql_file("t/runnabledb.dump");
    
# Get an EnsEMBL db object for the test db
my $db = $ens_test->get_DBSQL_Obj;
print "ok 2\n";    

my $runnable = 'Bio::EnsEMBL::Pipeline::RunnableDB::Genscan';
my $ana_adaptor = $db->get_AnalysisAdaptor;
my $ana = $ana_adaptor->fetch_by_logic_name('genscan');

#my $ana = Bio::EnsEMBL::Analysis->new (   -db             => 'HumanIso',
#					  -db_version     => '__NONE__',
#					  -db_file        => '/usr/local/ensembl/data/HumanIso.smat',
#					  -program        => 'Genscan',
#					  -program_file   => '/usr/local/ensembl/bin/genscan',
#					  -module         => $runnable,
#					  -module_version => 1,
#					  -gff_source     => 'genscan',
#					  -gff_feature    => 'exon', 
#					  -logic_name     => 'genscan',
#				      );

unless ($ana)
{ print "not ok 3\n"; }
else
{ print "ok 3\n"; }
my $id ='AB015752.00001';
$ana_adaptor->exists( $ana );
my $runobj = "$runnable"->new(-db      => $db,
			      -input_id   => $id,
			      -analysis   => $ana );
unless ($runobj)
{ print "not ok 4\n"; }
else
{ print "ok 4\n"; }

$runobj->fetch_input;
$runobj->run;

my @out = $runobj->output;
unless (@out)
{ print "not ok 5\n"; }
else
{ print "ok 5\n"; }
display(@out);

$runobj->write_output();

#print STDERR "Written output\n";
my $contig = $db->get_RawContigAdaptor()->fetch_by_name($id);
my @prediction_transcripts = $contig->get_all_PredictionFeatures();

#print STDERR "Have features\n";
foreach my $pred_trans (@prediction_transcripts) {
  print "Transcript  " . $pred_trans->translate . "\n";
}    

unless (@prediction_transcripts)
{ print "not ok 6\n"; }
else
{ print "ok 6\n"; }



sub display {
  my @results = @_;

  foreach my $obj (@results) {
    print STDERR ($obj->gffstring."\n");
    if ($obj->sub_SeqFeature) {
      foreach my $exon ($obj->sub_SeqFeature) {
	print STDERR "Sub: ".$exon->gffstring."\n";
      }
    }
  }
}


{'fraction_non_alphanumeric': 0.21114467942262505, 'fraction_numerical': 0.013595166163141994, 'mean_word_length': 2.4524913093858633, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2447033', 'n_tokens_mistral': 2369, 'n_tokens_neox': 2114, 'n_words': 568}