]> git.donarmstrong.com Git - biopieces.git/commitdiff
unfucked bowtie_index
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 8 Sep 2009 07:12:59 +0000 (07:12 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 8 Sep 2009 07:12:59 +0000 (07:12 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@661 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/create_bowtie_index
code_perl/Maasha/Bowtie.pm [new file with mode: 0644]

index 95354f61a3f6364ee7cb47c919d0dd1f4bdd7a52..47a46c65f4c183c30a60daaf7f1f4b2aa1bd1ced 100755 (executable)
@@ -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 (file)
index 0000000..fce2fbf
--- /dev/null
@@ -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;