From: martinahansen Date: Mon, 24 Nov 2008 00:33:54 +0000 (+0000) Subject: fixed bugs in assemble_tag_contigs X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a1e750ed3b84ed35f883ad4a6c5349e50ebde042;p=biopieces.git fixed bugs in assemble_tag_contigs git-svn-id: http://biopieces.googlecode.com/svn/trunk@320 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_perl/Maasha/Biopieces.pm b/code_perl/Maasha/Biopieces.pm index ef96559..3f46538 100644 --- a/code_perl/Maasha/Biopieces.pm +++ b/code_perl/Maasha/Biopieces.pm @@ -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 ); diff --git a/code_perl/Maasha/UCSC/BED.pm b/code_perl/Maasha/UCSC/BED.pm index f2a11e8..6a80b13 100644 --- a/code_perl/Maasha/UCSC/BED.pm +++ b/code_perl/Maasha/UCSC/BED.pm @@ -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 );