Bio-MUST-Drivers

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

      - binaries: fixed a bug in annotate-ali.pl where --hit-list captured tags from later hits
      - Blast: updated tests to BLAST 2.17.0

0.251060  2025-04-16 22:44:33+02:00 Europe/Brussels
    - Fixes
      - Blast: fixed a seq id bug in temporary databases with >10000 seqs

0.242720  2024-09-28 15:28:56+02:00 Europe/Brussels
    - Additions
      - Blast: expanded list of supported remote databases (e.g., core_nt)
      - Mafft: added support for options --addlong and --addfragments
      - binaries: new script annotate-ali.pl
    - Changes
      - Blast: upgraded driver to better handle version 5 of BLAST databases
    - Fixes
      - Blast: updated tests to BLAST 2.16.0
      - Mafft: fixed command-line bug with align_all method

0.210160  2021-01-16 22:27:34+01:00 Europe/Brussels
    - Fixes
      - Blast: made Blastable role taint-safe

MANIFEST  view on Meta::CPAN

test/dnaS.fasta
test/dnaT.fasta
test/dnaU.fasta
test/dnaW.fasta
test/dnaX.fasta
test/dnaY.fasta
test/dnaZ.fasta
test/empty.ali
test/exo_aligned.ali
test/exo_aligned.fasta
test/fragmentsseq_profile_out.fasta
test/generic_domains.hmm.h3f
test/generic_domains.hmm.h3i
test/generic_domains.hmm.h3m
test/generic_domains.hmm.h3p
test/hmmpress.log
test/longseq_profile_out.fasta
test/nuclquery.fasta
test/old-blast/prebuiltdb.phr
test/old-blast/prebuiltdb.pin
test/old-blast/prebuiltdb.pog

bin/annotate-ali.pl  view on Meta::CPAN

    repeatable

=item --ref-file [=] <file> | --database [=] <file>

Path to the FASTA file containing the sequence database.

=for Euclid: file.type: readable

=item --[ref-]regex [=] <regex>

Regular expression for capturing the reference seq id fragment that has to be
used for annotating infile seq ids.

=for Euclid: regex.type: string

=back

=head1 OPTIONS

=over

lib/Bio/MUST/Drivers/Cap3.pm  view on Meta::CPAN

        chomp $line;

        next LINE if $line =~ $EMPTY_LINE;
        last LINE if $line =~ m{\A DETAILED \s+ DISPLAY \s+ OF \s+ CONTIGS}xms;

        # capture next contig id
        if ($line =~ m{\A \*+ \s+ (Contig\s+\d+) \s+ \*+}xms) {
            ($contig_id = $1) =~ tr/ //d;
        }

        # capture fragment ids for current contig...
        elsif ($line =~ m{\A ([^\'\+\-\ ]+)[+-]}xms
            || $line =~ m{\A \s+ (\S+?)[+-]}xms) {
            my $fragment_id = $1;
            push @{ $ids_for{$contig_id} },
                SeqId->new( full_id => $self->long_id_for($fragment_id) );
        }   # ... and restore original id on the fly from IdMapper
    }

    # store contig and fragment ids
    $self->_set_contig_seq_ids(\%ids_for);

    # read and store contig seqs
    my $contigs = Ali->load($outfile_contigs);
    $contigs->dont_guess;
    $self->_set_contigs($contigs);

    # read and store singlet seqs...
    my $singlets = Ali->load($outfile_singlets);
    $singlets->dont_guess;

lib/Bio/MUST/Drivers/Mafft.pm  view on Meta::CPAN

    return;
}

sub seqs2profile {
    my $self    = shift;
    my $profile = shift;
    my $args    = shift // {};

    # setup specialized options
    my $mode = 'seqs2profile';
    for my $suffix ( qw(long fragments) ) {
        my $opt = '--' . $suffix;
        if (exists $args->{$opt}) {
            $mode =~ s/seqs/$suffix/xms;
            delete $args->{$opt};
        }
    }
    #### $mode

    return $self->_mafft($mode, $profile, $args);
}

lib/Bio/MUST/Drivers/Mafft.pm  view on Meta::CPAN


    $args->{$profile} = undef if $profile;      # should come last (no --)
    my $args_str  = stringify_args($args);

    # see https://mafft.cbrc.jp/alignment/server/add.html
    my %opt_for = (
        align_all         => q{},
        profile2profile   => '--addprofile',
        seqs2profile      => '--add',
        long2profile      => '--addlong',
        fragments2profile => '--addfragments',
    );

    # create mafft command
    my $pgm = 'mafft';      # linsi, ginsi,... do not work
    my $final_args = $mode eq 'align_all' ? "$args_str $infile" : "$infile $args_str";
    my $cmd = "$pgm $opt_for{$mode} $final_args > $outfile 2> /dev/null";
    ### $cmd

    # try to robustly execute mafft
    my $ret_code = system( [ 0, 1, 127 ], $cmd);

t/cap3.t  view on Meta::CPAN

is_deeply [ map { $_->seq } $cap->all_contigs ],
          [ map { $_->seq } @exp_contig_seqs ],
            'got expected Seqs for all contigs';
is_deeply [ map { $_->seq } $cap->all_singlets ],
          [ map { $_->seq } @exp_singlet_seqs ],
            'got expected Seqs for all singlets';

for my $i (1..5) {
    is_deeply [ map { $_->full_id } @{ $cap->seq_ids_for('Contig' . $i) } ],
            $exp_contig_seq_ids[$i-1],
            "got expected SeqIds for fragments of Contig $i";
}

is_deeply [ map { [ map { $_->full_id } @{$_} ] } $cap->all_contig_seq_ids ],
            \@exp_contig_seq_ids,
            'got expected SeqIds for all contig fragments';

done_testing;

t/mafft.t  view on Meta::CPAN


    is_deeply \@got_p2p_seq_ids, \@exp_p2p_seq_ids,
        'ids correctly written for profile2profile';
}

{
    # seqs2profile
    my $file2align = file('test', 'seq_in2.fasta');
    my $profile = file('test', 'seq_out1_mafft.fasta');

    # Note: long and fragments alignments are less good here but not important
    for my $opt ( q{}, 'long', 'fragments' ) {
        my $maf = $class->new( file => $file2align );
        my $seqs2profile
            = $maf->seqs2profile($profile, $opt ? { "--$opt" => undef } : () );
        my $exp_file = file('test', "${opt}seq_profile_out.fasta");
        my $exp_new_profile = Bio::MUST::Core::Ali->load($exp_file);

        my @got_seqs2p_seqs    = $seqs2profile->all_seqs;
        my @exp_seqs2p_seqs    = $exp_new_profile->all_seqs;
        my @got_seqs2p_seq_ids = $seqs2profile->all_seq_ids;
        my @exp_seqs2p_seq_ids = $exp_new_profile->all_seq_ids;



( run in 0.887 second using v1.01-cache-2.11-cpan-364913b4093 )