From: martinahansen Date: Tue, 8 Sep 2009 07:12:59 +0000 (+0000) Subject: unfucked bowtie_index X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b2008721fa901786cffa408fa518dbe443634f7a;p=biopieces.git unfucked bowtie_index git-svn-id: http://biopieces.googlecode.com/svn/trunk@661 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/create_bowtie_index b/bp_bin/create_bowtie_index index 95354f6..47a46c6 100755 --- a/bp_bin/create_bowtie_index +++ b/bp_bin/create_bowtie_index @@ -32,6 +32,7 @@ use Maasha::Common; use Maasha::Biopieces; use Maasha::Filesys; use Maasha::Fasta; +use Maasha::Bowtie; # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @@ -69,13 +70,7 @@ while ( $record = Maasha::Biopieces::get_record( $in ) ) close $fh_tmp; -Maasha::Filesys::dir_create_if_not_exists( $options->{ 'directory' } ); - -if ( $options->{ 'verbose' } ) { - Maasha::Common::run( "bowtie-build", "$file_tmp $options->{ 'directory' }/$options->{ 'index_name' }" ); -} else { - Maasha::Common::run( "bowtie-build", "$file_tmp $options->{ 'directory' }/$options->{ 'index_name' } > /dev/null 2>&1" ); -} +Maasha::Bowtie::bowtie_index( $file_tmp, $options->{ 'directory' }, $options->{ 'index_name' }, $options->{ 'verbose' } ); unlink $file_tmp; diff --git a/code_perl/Maasha/Bowtie.pm b/code_perl/Maasha/Bowtie.pm new file mode 100644 index 0000000..fce2fbf --- /dev/null +++ b/code_perl/Maasha/Bowtie.pm @@ -0,0 +1,69 @@ +package Maasha::Bowtie; + +# Copyright (C) 2006-2009 Martin A. Hansen. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# http://www.gnu.org/copyleft/gpl.html + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +# Routines for manipulation of bowtie indexes and results. + +# http://bowtie-bio.sourceforge.net/index.shtml + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +use warnings; +use strict; +use Data::Dumper; +use vars qw( @ISA @EXPORT ); + +@ISA = qw( Exporter ); + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +sub bowtie_index +{ + # Martin A. Hansen, July 2009. + + # Create a bowtie index for fast sequence mapping. + + my ( $src_file, # filename of source file + $dst_dir, # destination dir to store index + $base_name, # base name of index + $verbose, # verbose flag + ) = @_; + + Maasha::Filesys::dir_create_if_not_exists( $dst_dir ); + + if ( $verbose ) { + Maasha::Common::run( "bowtie-build", "$src_file $dst_dir/$base_name" ); + } else { + Maasha::Common::run( "bowtie-build", "$src_file $dst_dir/$base_name > /dev/null 2>&1" ); + } +} + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +1;