]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/format_genome
refactoring of assemble_pairs
[biopieces.git] / bp_bin / format_genome
index 35aa8b3af7354de14d65ef00aa444ebed767e149..9b3e4fe81790b7ea159efaad477bb5d87922dbad 100755 (executable)
@@ -95,7 +95,7 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
     {
         Maasha::Fasta::put_entry( $entry, $fh_out );
     }
-    elsif ( $fh_out and $record->{ "CHR" } and $record->{ "CHR_BEG" } and $record->{ "STEP" } and $record->{ "VALS" } )
+    elsif ( $fh_out and $record->{ "CHR" } and $record->{ "CHR_BEG" } and $record->{ "STEP" } and $record->{ "VALS" } )  # TODO: clean this!
     {
         print $fh_out "fixedStep chrom=$record->{ 'CHR' } start=$record->{ 'CHR_BEG' } step=$record->{ 'STEP' }\n";
 
@@ -109,13 +109,15 @@ while ( $record = Maasha::Biopieces::get_record( $in ) )
     Maasha::Biopieces::put_record( $record, $out ) if not $options->{ "no_stream" };
 }
 
+close $fh_out if $fh_out;
+
 foreach $format ( @{ $options->{ 'formats' } } )
 {
     print STDERR qq(Creating format: $format for $genome ... ) if $options->{ 'verbose' };
 
-    if    ( $format =~ /^fasta$/i )     { Maasha::Fasta::fasta_index( "$fasta_dir/$genome.fna", "$dir/genomes/$genome/fasta/$genome.index" ) }
+    if    ( $format =~ /^fasta$/i )     { Maasha::Fasta::fasta_index( "$fasta_dir/$genome.fna", $fasta_dir, "$genome.index" ) }
     elsif ( $format =~ /^blast$/i )     { Maasha::NCBI::blast_index( "$genome.fna", $fasta_dir, "$dir/genomes/$genome/blast", "dna", $genome ) }
-    elsif ( $format =~ /^blat$/i )      { warn "BLAT FORMAT NOT IMPLEMENTED" }
+    elsif ( $format =~ /^blat$/i )      { warn "BLAT FORMAT NOT IMPLEMENTED\n" }
     elsif ( $format =~ /^vmatch$/i )    { Maasha::Match::vmatch_index( "$genome.fna", $fasta_dir, "$dir/genomes/$genome/vmatch", $tmp_dir ) }
     elsif ( $format =~ /^bowtie$/i )    { Maasha::Bowtie::bowtie_index( "$fasta_dir/$genome.fna", "$dir/genomes/$genome/bowtie", $genome, $options->{ 'verbose' } ) }
     elsif ( $format =~ /^bwa$/i )       { Maasha::BWA::bwa_index( "$fasta_dir/$genome.fna", "$dir/genomes/$genome/bwa", $genome, $options->{ 'verbose' } ) }
@@ -124,8 +126,6 @@ foreach $format ( @{ $options->{ 'formats' } } )
     print STDERR qq(done.\n) if $options->{ 'verbose' };
 }
 
-close $fh_out if $fh_out;
-
 Maasha::Biopieces::close_stream( $in );
 Maasha::Biopieces::close_stream( $out );