view release on metacpan or search on metacpan
lib/Bio/Tools/Run/Alignment/Amap.pm view on Meta::CPAN
=cut
sub _setinput {
my ($self,$input) = @_;
my ($infilename, $seq, $temp, $tfh);
if (! ref $input) {
# check that file exists or throw
$infilename = $input;
unless (-e $input) {return 0;}
# let's peek and guess
open(IN,$infilename) || $self->throw("Cannot open $infilename");
my $header;
while( defined ($header = <IN>) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ){
$self->throw("Need to provide a FASTA format file to amap!");
}
return ($infilename);
lib/Bio/Tools/Run/Alignment/Kalign.pm view on Meta::CPAN
=cut
sub _setinput {
my ($self,$input) = @_;
my ($infilename, $seq, $temp, $tfh);
if (! ref $input) {
# check that file exists or throw
$infilename = $input;
unless (-e $input) {return 0;}
# let's peek and guess
open(IN,$infilename) || $self->throw("Cannot open $infilename");
my $header;
while( defined ($header = <IN>) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ){
$self->throw("Need to provide a FASTA format file to kalign!");
}
return ($infilename);
lib/Bio/Tools/Run/Alignment/MSAProbs.pm view on Meta::CPAN
=cut
sub _setinput {
my( $self,$input ) = @_;
my( $infilename,$outtemp,$tfh,@sequences );
if (! ref $input) {
# check that file exists or throw
return unless (-s $input && -r $input);
# let's peek and guess
$infilename = $input;
open(IN,$input) || $self->throw("Cannot open $input");
my $header;
while( defined ($header = <IN>) ) {
last if $header !~ /^\s+$/; }
close(IN);
$header =~ /^>\s*\S+/ ||
$self->throw("Need to provide a FASTA-formatted file to msaprobs!");
my $inseqio = Bio::SeqIO->new(
-file => $input,
lib/Bio/Tools/Run/Alignment/Muscle.pm view on Meta::CPAN
$self->throw("profile does not work for this version of muscle\n");
}
my $infilename;
if ( defined $alnfilename ) {
if ( !ref $alnfilename ) {
# check that file exists or throw
$infilename = $alnfilename;
unless ( -e $infilename ) { return 0; }
# let's peek and guess
open( IN, $infilename ) || $self->throw("Cannot open $infilename");
my $header;
while ( defined( $header = <IN> ) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ) {
$self->throw(
"Need to provide a FASTA format file to muscle profile!");
}
lib/Bio/Tools/Run/Alignment/Muscle.pm view on Meta::CPAN
$self->throw(
"Bad input data or less than 2 sequences in $infilename !");
}
if ( defined $seqsfilename ) {
if ( !ref $seqsfilename ) {
# check that file exists or throw
$infilename = $seqsfilename;
unless ( -e $infilename ) { return 0; }
# let's peek and guess
open( IN, $infilename ) || $self->throw("Cannot open $infilename");
my $header;
while ( defined( $header = <IN> ) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ) {
$self->throw(
"Need to provide a FASTA format file to muscle profile!");
}
lib/Bio/Tools/Run/Alignment/Muscle.pm view on Meta::CPAN
sub _setinput {
my ( $self, $input ) = @_;
my ( $infilename, $seq, $temp, $tfh );
if ( !ref $input ) {
# check that file exists or throw
$infilename = $input;
unless ( -e $input ) { return 0; }
# let's peek and guess
open( IN, $infilename ) || $self->throw("Cannot open $infilename");
my $header;
while ( defined( $header = <IN> ) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ) {
$self->throw("Need to provide a FASTA format file to muscle!");
}
return ($infilename);
lib/Bio/Tools/Run/Alignment/Probalign.pm view on Meta::CPAN
=cut
sub _setinput {
my ($self,$input) = @_;
my ($infilename, $seq, $temp, $tfh);
if (! ref $input) {
# check that file exists or throw
$infilename = $input;
unless (-e $input) {return 0;}
# let's peek and guess
open(IN,$infilename) || $self->throw("Cannot open $infilename");
my $header;
while( defined ($header = <IN>) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ){
$self->throw("Need to provide a FASTA format file to probalign!");
}
return ($infilename);
lib/Bio/Tools/Run/Alignment/Probcons.pm view on Meta::CPAN
=cut
sub _setinput {
my ($self,$input) = @_;
my ($infilename, $seq, $temp, $tfh);
if (! ref $input) {
# check that file exists or throw
$infilename = $input;
unless (-e $input) {return 0;}
# let's peek and guess
open(IN,$infilename) || $self->throw("Cannot open $infilename");
my $header;
while( defined ($header = <IN>) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ){
$self->throw("Need to provide a FASTA format file to probcons!");
}
return ($infilename);
lib/Bio/Tools/Run/Alignment/Proda.pm view on Meta::CPAN
=cut
sub _setinput {
my ($self,$input) = @_;
my ($infilename, $seq, $temp, $tfh);
if (! ref $input) {
# check that file exists or throw
$infilename = $input;
unless (-e $input) {return 0;}
# let's peek and guess
open(IN,$infilename) || $self->throw("Cannot open $infilename");
my $header;
while( defined ($header = <IN>) ) {
last if $header !~ /^\s+$/;
}
close(IN);
if ( $header !~ /^>\s*\S+/ ){
$self->throw("Need to provide a FASTA format file to proda!");
}
return ($infilename);
lib/Bio/Tools/Run/BEDTools.pm view on Meta::CPAN
} else {
$self->throw("Must provide named filespec");
}
for (keys %args) {
m/bam/ && do {
return 'bam';
};
do {
return unless ( -e $args{$_} && -r _ );
my $guesser = Bio::Tools::GuessSeqFormat->new(-file=>$args{$_});
return $guesser->guess if grep {$guesser->guess =~ m/$_/} @{$accepted_types{$_}};
}
}
return;
}
=head2 version()
Title : version
Usage : $version = $bedtools_fac->version()
Function: Returns the program version (if available)
lib/Bio/Tools/Run/Primer3.pm view on Meta::CPAN
#
# Copyright (c) 1997-2001 bioperl, Chad Matsalla. All Rights Reserved.
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# Copyright Chad Matsalla
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
#
# But I have modified lots of it, so I guess I should add:
#
# Copyright (c) 2003 bioperl, Rob Edwards. All Rights Reserved.
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# Copyright Rob Edwards
#
# You may distribute this module under the same terms as perl itself
# POD documentation - main docs before the code
lib/Bio/Tools/Run/StandAloneBlastPlus.pm view on Meta::CPAN
=cut
sub _fastize {
my $self = shift;
my $data = shift;
for ($data) {
!ref && do {
# suppose a fasta file name
$self->throw('Sequence file not found') unless -e $data;
my $guesser = Bio::Tools::GuessSeqFormat->new(-file => $data);
$self->throw('Sequence file not in FASTA format') unless
$guesser->guess eq 'fasta';
last;
};
(ref eq 'ARRAY') && (ref $$data[0]) &&
($$data[0]->isa('Bio::Seq') || $$data[0]->isa('Bio::PrimarySeq'))
&& do {
my $fh = File::Temp->new(TEMPLATE => 'DBDXXXXX',
UNLINK => 0,
DIR => $self->db_dir,
SUFFIX => '.fas');
my $fname = $fh->filename;
t/BEDTools.t view on Meta::CPAN
is( $lines, $result_lookup{$command}, " - number of lines");
} elsif ($command eq 'genome_coverage') {
$v && diag(" check result file is correct size");
ok eval { (-e $file)&&(-r _) }, "make readable output";
open (FILE, $file);
my $lines =()= <FILE>;
close FILE;
is( $lines, $result_lookup{$command}, " - number of lines");
} else {
$v && diag(" check can get internal result format matches result file");
my $guesser = Bio::Tools::GuessSeqFormat->new( -file => $file );
for ($format_lookup{$command}) {
m/^(?:bed|bedpe|tab)$/ && do {
is( $guesser->guess, 'tab', "file format of '$file' consistent with claim for '$command'" );
last;
};
m/^fasta$/ && do {
is( $guesser->guess, 'fasta', "file format consistent with claim for '$command'" );
}
}
}
$v && diag(" check can get and set wanted result type");
is( $bedtoolsfac->want('Bio::Root::IO'), 'Bio::Root::IO',
"can set want to IO object for command '$command'" );
$v && diag(" check can get a Bio::Root::IO object");
ok( my $objres = $bedtoolsfac->result, "can get the basic object result for command '$command'" );
$v && diag(" - check can it is actually a Bio::Root::IO object");
isa_ok( $objres, 'Bio::Root::IO', "returned object is correct for command '$command'" );
t/MSAProbs.t view on Meta::CPAN
$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 );
}