]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/create_bwa_index
refactoring of assemble_pairs
[biopieces.git] / bp_bin / create_bwa_index
index 9ccb0e427568b65d20b0f5e11337a2ec75455e78..a80ae5971aaf4ce19f435fbcc98ea3116ca815eb 100755 (executable)
@@ -32,6 +32,7 @@ use Maasha::Common;
 use Maasha::Biopieces;
 use Maasha::Filesys;
 use Maasha::Fasta;
+use Maasha::BWA;
 
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
@@ -47,8 +48,6 @@ $options = Maasha::Biopieces::parse_options(
     ]   
 );
 
-Maasha::Common::error( qq(Directory already exists: "$options->{ 'directory' }") ) if -d $options->{ 'directory' };
-
 Maasha::Filesys::dir_create_if_not_exists( $options->{ 'directory' } );
 
 $in  = Maasha::Biopieces::read_stream( $options->{ "stream_in" } );
@@ -69,13 +68,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( "bwa", "index -p $options->{ 'directory' }/$options->{ 'index_name' } $file_tmp" );
-} else {
-    Maasha::Common::run( "bwa", "index -p $options->{ 'directory' }/$options->{ 'index_name' } $file_tmp > /dev/null 2>&1" );
-}
+Maasha::BWA::bwa_index( $file_tmp, $options->{ 'directory' }, $options->{ 'index_name' }, $options->{ 'verbose' } );
 
 unlink $file_tmp;