NAME
Bio::Grep::Cookbook - Bio::Grep Cookbook
DESCRIPTION
This collection of recipes intends to provide you solutions for the most common problems and to make the development process easier.
RECIPES
All recipes assume that the database is generated in the directory data. The analyses of the search results are omitted, meaning you have to append somthing like
while ( my $res = $sbe->next_res ) {
...
}
to the recipes.
Search for DNA motifs
You want to search for DNA motifs.
Solution A: (Assumes that the number of possible motifs is rather small and the database is large)
use Bio::Grep;
use Bio::SeqIO;
my $sbe = Bio::Grep->new('Vmatch');
my $out = Bio::SeqIO->new( -format => 'Fasta',
-file => '>motifs.fasta',
);
# you have an array with DNA sequences
my @motifs = ( 'aaaaaa', 'gggggg' );
for my $i (0 .. $#motifs ) {
my $seq = Bio::Seq->new(
-id => $i,
-seq => $motifs[$i],
);
$out->write_seq($seq);
}
$sbe->search({
datapath => 'data',
database => 'Test.fasta',
query_file => 'motifs.fasta',
complete => 1,
});
Solution B: (Assumes that the number of possible motifs is large and the database is small)
use Bio::Grep;
my $sbe = Bio::Grep->new('RE');
my $motif = '[AC]{4}TAAAA[AGCT]GG';
$sbe->search({
datapath => 'data',
database => 'Test.fasta',
query => $motif,
});
Note that the search for exact matches is fast with Vmatch, so the enumeration of all possible motifs (Solution A) can often be the best method.
FEEDBACK
Have you solved your (not too exotic ;)) problem with Bio::Grep and a solution is not yet listed here? Contribute it to this Cookbook!
Please report any bugs, feature requests and recipes to bug-bio-grep@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
AUTHOR
Markus Riester, <mriester@gmx.de>
LICENCE AND COPYRIGHT
Copyright (C) 2007 by M. Riester. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.