Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bioperl/bioperl-live
Browse files Browse the repository at this point in the history
  • Loading branch information
bosborne committed Jun 7, 2017
2 parents 2e9e6ea + eef145d commit 75200b0
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 45 deletions.
73 changes: 44 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,27 @@ perl:
- "5.16"
- "5.14"

matrix:
include:
- perl: 5.18
env: COVERAGE=1 TEST_PARTITION=1
- perl: 5.18
env: COVERAGE=1 TEST_PARTITION=2
- perl: 5.18
env: COVERAGE=1 TEST_PARTITION=3
- perl: 5.18
env: COVERAGE=1 TEST_PARTITION=4
- perl: 5.18
env: COVERAGE=1 TEST_PARTITION=5
- perl: 5.18
env: COVERAGE=1 TEST_PARTITION=6

sudo: false
env: PERL_CPANM_OPT="--notest --force --skip-satisfied"
env:
global:
- PERL_CPANM_OPT="--notest --force --skip-satisfied"
- BIOPERL_NETWORK_TESTING=0 # disables the network tests
- TEST_PARTITIONS=6

addons:
apt:
Expand All @@ -17,37 +36,33 @@ addons:
- libgd2-xpm-dev
- libxml2-dev

before_install:
- git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers
- source ~/travis-perl-helpers/init
- build-perl
- perl -V
- cpanm DBD::mysql DBD::Pg DBD::SQLite 2>&1 | tail -n 1
- cpanm Test::Pod 2>&1 | tail -n 1
- cpanm Bio::ASN1::EntrezGene 2>&1 | tail -n 1
- if [ "$BIOPERL_NETWORK_TESTING" = "1" ]; then
export TRAVIS_AUTHOR_TESTING=1;
export TRAVIS_RELEASE_TESTING=1;
cpanm LWP::UserAgent LWP::Protocol::https 2>&1 | tail -n 1;
fi
- build-dist
- cd $BUILD_DIR
install:
#These are recommended or required Perl libraries:
- "cpanm GD 2>&1 CGI | tail -n 1"
- "cpanm HTML::TableExtract DBI Data::Stag DB_File 2>&1 | tail -n 1"
- "cpanm DBD::mysql DBD::Pg DBD::SQLite 2>&1 | tail -n 1"
- "cpanm Algorithm::Munkres Array::Compare Convert::Binary::C Error 2>&1 | tail -n 1"
- "cpanm Graph SVG SVG::Graph GraphViz 2>&1 | tail -n 1"
- "cpanm XML::DOM::XPath XML::Parser XML::Parser::PerlSAX 2>&1 | tail -n 1"
- "cpanm XML::SAX XML::SAX::Writer XML::Simple XML::LibXML XML::Twig XML::Writer 2>&1 | tail -n 1"
- "cpanm PostScript::TextBlock Set::Scalar Sort::Naturally YAML | tail -n 1"
- "cpanm Math::Random Spreadsheet::ParseExcel | tail -n 1"
- "cpanm Bio::Phylo | tail -n 1"
- "cpanm Test::Weaken | tail -n 1"
- "cpanm Test::Memory::Cycle | tail -n 1"
#Test coverage from Coveralls
#- cpanm --quiet --notest Devel::Cover::Report::Coveralls
#for some reason tests and deps aren't skipped here. Will have to look into it more...
#git repos, seems to only work for simple checkouts, so pure perl only (TODO: look into before_script for more detail)
#- "git clone https://github.com/bioperl/Bio-Root.git; export PERL5LIB=$( pwd )/Bio-Root/lib:$PERL5LIB"
#This installs BioPerl itself:
- "perl ./Build.PL --accept"

- cpan-install --deps
- cpan-install --coverage
before_script:
- coverage-setup
script:
- "./Build test"
#Devel::Cover coverage options are: statement, branch, condition, path, subroutine, pod, time, all and none
#- "./Build build && cover -test -report coveralls" #complete version coverage test
#- PERL5OPT=-MDevel::Cover=+ignore,prove,-coverage,statement,subroutine prove -lr t #limited version coverage test
#- cover -report coveralls

- export AUTHOR_TESTING=${TRAVIS_AUTHOR_TESTING:=0}
- export RELEASE_TESTING=${TRAVIS_RELEASE_TESTING:=0}
- prove -l -j$(test-jobs) $(test-files)
after_success:
- ./travis_scripts/trigger-dockerhub.sh
- coverage-report
- ./travis_scripts/trigger-dockerhub.sh

#TODO - send emails to bioperl-guts-l
notifications:
Expand Down
49 changes: 40 additions & 9 deletions Bio/Tools/PrositeScan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,47 @@ Bio::Tools::PrositeScan - Parser for ps_scan result
use Bio::Tools::PrositeScan;
my $factory = Bio::Tools::PrositeScan->new(
-file => 'out.PrositeScan'
-file => 'out.PrositeScan',
-format => 'fasta'
);
while(my $match = $factory->next_prediction){
# $match is of Bio::SeqFeature::FeaturePair
my $q_id = $fatch->feature1->seq_id;
my $h_id = $fatch->feature2->seq_id;
# $match is a Bio::SeqFeature::FeaturePair
# Sequence ID
my $seq_id = $match->seq_id;
# PROSITE accession number
my $psac = $match->hseq_id;
# Coordinates
my @coords = ( $match->start, $match->end );
# Subsequence
my $seq = $match->feature1->seq;
}
=head1 DESCRIPTION
This is the parser of the output of ps_scan program. It takes either a file
handler or a file name, and returns a Bio::SeqFeature::FeaturePair object.
This is a parser of the output of the ps_scan program. It takes either a file
handle or a file name, and returns a L<Bio::SeqFeature::FeaturePair> object.
Note that the current implementation parses the entire file at once.
=head1 AUTHOR
Juguang Xiao, juguang@tll.org.sg
=head1 SEE ALSO
=over
=item * L<ps_scan software|ftp://ftp.expasy.org/databases/prosite/ps_scan>
=item * L<PROSITE User Manual|http://prosite.expasy.org/prosuser.html>
=back
=cut

# Let the code begin...
Expand All @@ -46,6 +69,12 @@ use base qw(Bio::Root::Root Bio::Root::IO);
Usage : Bio::Tools::PrositeScan->new(-file => 'out.PrositeScan');
Bio::Tools::PrositeScan->new(-fh => \*FH);
Returns : L<Bio::Tools::PrositeScan>
Args : -format => string representing the format type for the
ps_scan output, REQUIRED
The C<-format> argument must currently be set to C<fasta> since this is the
only parser implemented. This corresponds with using the ps_scan arguments
C<-o fasta>.
=cut

Expand All @@ -72,12 +101,15 @@ sub format {
=head2 next_prediction
Title : new
Usage :
Usage :
while($result = $factory->next_prediction){
;
}
Returns : a Bio::SeqFeature::FeaturePair object
Returns : a Bio::SeqFeature::FeaturePair object where
feature1 is the matched subsequence and
feature2 is the PROSITE accession number.
See <http://prosite.expasy.org/prosuser.html#conv_ac>.
=cut

Expand Down Expand Up @@ -153,7 +185,6 @@ sub _parse_fasta {
push @matches, $fp;
}
push @{$self->{_matches}}, @matches;

}

sub _attach_seq {
Expand Down
15 changes: 8 additions & 7 deletions t/RemoteDB/Taxonomy.t
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ SKIP: {

# tests for #212
SKIP: {
test_skip( -tests => 12, -requires_networking => 0 );
test_skip( -tests => 6, -requires_networking => 1 );

my $db = Bio::DB::Taxonomy->new( -source => "entrez" );

Expand All @@ -487,16 +487,17 @@ SKIP: {
# 'Phygadeuon ovatus' | "No hit" | 666060
# 'Trimorus ovatus' | "No hit" | 666060

my @ids = $db_entrez->get_taxonids('Lissotriton vulgaris');
my @ids;
@ids = $db->get_taxonids('Lissotriton vulgaris');
is $ids[0], 8324, 'Correct: Lissotriton vulgaris';
my @ids = $db_entrez->get_taxonids('Chlorella vulgaris');
@ids = $db->get_taxonids('Chlorella vulgaris');
is $ids[0], 3077, 'Correct: Chlorella vulgaris';
my @ids = $db_entrez->get_taxonids('Phygadeuon solidus');
@ids = $db->get_taxonids('Phygadeuon solidus');
is $ids[0], 1763951, 'Correct: Phygadeuon solidus';
my @ids = $db_entrez->get_taxonids('Ovatus');
@ids = $db->get_taxonids('Ovatus');
is $ids[0], 666060, 'Correct: Ovatus';
my @ids = $db_entrez->get_taxonids('Phygadeuon ovatus');
@ids = $db->get_taxonids('Phygadeuon ovatus');
is $ids[0], 'No hit', 'Correct: No hit';
my @ids = $db_entrez->get_taxonids('Trimorus ovatus');
@ids = $db->get_taxonids('Trimorus ovatus');
is $ids[0], 'No hit', 'Correct: No hit';
}
44 changes: 44 additions & 0 deletions t/Tools/PrositeScan.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
use strict;

BEGIN {
use lib '.';
use Bio::Root::Test;

test_begin(-tests => 3);

use_ok('Bio::Tools::PrositeScan');
use_ok('Bio::SeqFeature::FeaturePair');
}

# Note: data generated by running
#
# ./ps_scan.pl --pfscan ./pfscan -d prosite.dat -o fasta \
# t/data/test.fasta > t/data/ps_scan/out.PrositeScan
#
# followed by a manual removal of some of the output to simplify the test.

subtest "Predictions" => sub {
my $factory = Bio::Tools::PrositeScan->new(
'-file' => test_input_file('ps_scan/out.PrositeScan'),
'-format' => 'fasta'
);

my $expected_matches = [
{ seq_id => 'roa1_drome', coords => [253, 256], psac => 'PS00001', subseq => 'NNSF' },
{ seq_id => 'roa1_drome', coords => [270, 273], psac => 'PS00001', subseq => 'NNSW' },
{ seq_id => 'roa2_drome', coords => [344, 349], psac => 'PS00008', subseq => 'GNNQGF' },
{ seq_id => 'roa2_drome', coords => [217, 355], psac => 'PS50321', subseq => re(qr/NR.{135}NN/) },
];

my $actual_matches = [];
while( my $match = $factory->next_prediction ) {
push @$actual_matches, {
seq_id => $match->seq_id,
coords => [ $match->start, $match->end ],
psac => $match->hseq_id,
subseq => $match->feature1->seq->seq,
};
}

cmp_deeply( $actual_matches, $expected_matches, 'Comparing parsed prediction input' );
};
10 changes: 10 additions & 0 deletions t/data/ps_scan/out.PrositeScan
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
>roa1_drome/253-256 : PS00001 ASN_GLYCOSYLATION
NNSF
>roa1_drome/270-273 : PS00001 ASN_GLYCOSYLATION
NNSW
>roa2_drome/344-349 : PS00008 MYRISTYL
GNNQGF
>roa2_drome/217-355 : PS50321 ASN_RICH L=0
NRGNMGGGNYGNQNGGGNWNNGGNNWGNNRGNDNWGNNSFGGGGGGGGGYGGGNNSWGNN
NPWDNGNGGGNFGGGGNNWNGGNDFGGYQQNYGGGPQRGGGNFNNNRMQPYQGGGGFKAG
GGNQGNYGNNQGFNNGGNN

0 comments on commit 75200b0

Please sign in to comment.