]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bugs in assemble_tag_contigs
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 24 Nov 2008 00:33:54 +0000 (00:33 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Mon, 24 Nov 2008 00:33:54 +0000 (00:33 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@320 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/Biopieces.pm
code_perl/Maasha/UCSC/BED.pm

index ef96559a0ffc15e9bf202ad09dc12b5050c88dba..3f46538bda5151417734dd6874ec52b15d79d9a7 100644 (file)
@@ -2183,29 +2183,31 @@ sub script_assemble_tag_contigs
 
     # Returns nothing.
 
-    my ( $bed_file, $fh_in, $fh_out, $cols, $record, $bed_entry, $file_hash, $chr,
-         $array, $pos, $id, $beg, $end, $score, $new_record );
+    my ( $bed_file, $fh_in, $fh_out, $cols, $record, $bed_entry, $file_hash, $chr, $strand );
     
     $bed_file = "$BP_TMP/assemble_tag_contigs.bed";
     $fh_out   = Maasha::Filesys::file_write_open( $bed_file );
-    $cols     = 5; # we only need the first 5 BED columns
+    $cols     = 6; # we only need the first 5 BED columns
 
     while ( $record = get_record( $in ) ) 
     {
-        if ( $bed_entry = Maasha::UCSC::BED::biopiece2bed( $record, $cols ) ) {
+        if ( $bed_entry = Maasha::UCSC::BED::biopiece2bed( $record, $cols ) )
+        {
+            $strand = $record->{ 'STRAND' } || '+';
+
             Maasha::UCSC::BED::bed_entry_put( $bed_entry, $fh_out, $cols );
         }
     }
 
     close $fh_out;
 
-    $file_hash = Maasha::UCSC::BED::bed_file_split_on_chr( $bed_file );
+    $file_hash = Maasha::UCSC::BED::bed_file_split_on_chr( $bed_file, $BP_TMP, $cols );
 
     unlink $bed_file;
 
     foreach $chr ( sort keys %{ $file_hash } )
     {
-        $bed_file = Maasha::UCSC::BED::tag_contigs_assemble( $file_hash->{ $chr }, $chr, $BP_TMP );
+        $bed_file = Maasha::UCSC::BED::tag_contigs_assemble( $file_hash->{ $chr }, $chr, $strand, $BP_TMP );
 
         $fh_in = Maasha::Filesys::file_read_open( $bed_file );
 
index f2a11e8c8ba95ce85745f6dc2a98b21f004dffa8..6a80b13ec4cee623bd12b6cd6e22e28bb19e6cfc 100644 (file)
@@ -553,6 +553,7 @@ sub tag_contigs_assemble
 
     my ( $bed_file,   # path to BED file
          $chr,        # chromosome
+         $strand,     # strand
          $dir,        # working directory
        ) = @_;
          
@@ -580,6 +581,7 @@ sub tag_contigs_assemble
         $entry->[ chromEnd ]   = $end;
         $entry->[ name ]       = sprintf( "TC%06d", $id );
         $entry->[ score ]      = $score;
+        $entry->[ strand ]     = $strand;
 
         bed_entry_put( $entry, $fh_out );