From f3f97271064af19c392850698b136fcd210c79bc Mon Sep 17 00:00:00 2001 From: martinahansen Date: Fri, 5 Dec 2008 05:16:39 +0000 Subject: [PATCH] added bed2tag_contigs as backend to assemble_tag_contigs git-svn-id: http://biopieces.googlecode.com/svn/trunk@333 74ccb610-7750-0410-82ae-013aeee3265d --- code_c/Maasha/src/bed2tag_contigs.c | 6 +++--- code_perl/Maasha/Biopieces.pm | 13 ++++++++----- code_perl/Maasha/UCSC/BED.pm | 2 +- code_python/Cjung/lowercase_seq | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/code_c/Maasha/src/bed2tag_contigs.c b/code_c/Maasha/src/bed2tag_contigs.c index ae61b35..265eb11 100644 --- a/code_c/Maasha/src/bed2tag_contigs.c +++ b/code_c/Maasha/src/bed2tag_contigs.c @@ -101,8 +101,8 @@ int main( int argc, char *argv[] ) score = ( ushort ) get_score( entry->q_id ); - if ( score > entry->score ) { - barray_interval_inc( ba, entry->chr_beg, entry->chr_end - 1, ( short ) score / entry->score ); + if ( score > entry->score && entry->score > 0 ) { + barray_interval_inc( ba, entry->chr_beg, entry->chr_end - 1, ( ushort ) ( score / entry->score ) ); } } @@ -123,7 +123,7 @@ int main( int argc, char *argv[] ) // printf( "chr: %s pos: %zu beg: %zu end: %zu max: %hd\n", chr, pos, beg, end, max ); - printf( "%s\t%zu\t%zu\tID_%08zu\t%hd\n", chr, beg, end + 1, id, max ); + printf( "%s\t%zu\t%zu\t%s_%08zu\t%u\n", chr, beg, end + 1, chr, id, ( uint ) max ); id++; } diff --git a/code_perl/Maasha/Biopieces.pm b/code_perl/Maasha/Biopieces.pm index 59b7df7..013b031 100644 --- a/code_perl/Maasha/Biopieces.pm +++ b/code_perl/Maasha/Biopieces.pm @@ -2176,11 +2176,11 @@ sub script_assemble_tag_contigs # Returns nothing. - my ( $bed_file, $fh_in, $fh_out, $cols, $record, $bed_entry, $file_hash, $chr, $strand ); + my ( $bed_file, $tag_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 = 6; # we only need the first 5 BED columns + $cols = 6; # we only need the first 6 BED columns while ( $record = get_record( $in ) ) { @@ -2200,9 +2200,12 @@ sub script_assemble_tag_contigs foreach $chr ( sort keys %{ $file_hash } ) { - $bed_file = Maasha::UCSC::BED::tag_contigs_assemble( $file_hash->{ $chr }, $chr, $strand, $BP_TMP ); + $bed_file = $file_hash->{ $chr }; + $tag_file = "$bed_file.tc"; - $fh_in = Maasha::Filesys::file_read_open( $bed_file ); + Maasha::Common::run( "bed2tag_contigs", "< $bed_file > $tag_file" ); + + $fh_in = Maasha::Filesys::file_read_open( $tag_file ); while ( $bed_entry = Maasha::UCSC::BED::bed_entry_get( $fh_in ) ) { @@ -2213,8 +2216,8 @@ sub script_assemble_tag_contigs close $fh_in; - unlink $file_hash->{ $chr }; unlink $bed_file; + unlink $tag_file; } } diff --git a/code_perl/Maasha/UCSC/BED.pm b/code_perl/Maasha/UCSC/BED.pm index 3dcf45f..c95c930 100644 --- a/code_perl/Maasha/UCSC/BED.pm +++ b/code_perl/Maasha/UCSC/BED.pm @@ -419,7 +419,7 @@ sub bed2biopiece $bp_record{ "CHR" } = $bed_entry->[ chrom ]; $bp_record{ "CHR_BEG" } = $bed_entry->[ chromStart ]; $bp_record{ "CHR_END" } = $bed_entry->[ chromEnd ] - 1; - $bp_record{ "BED_LEN" } = $bed_entry->[ chromEnd ] - $bed_entry->[ chromEnd ]; + $bp_record{ "BED_LEN" } = $bed_entry->[ chromEnd ] - $bed_entry->[ chromStart ]; return wantarray ? %bp_record : \%bp_record if $cols == 3; diff --git a/code_python/Cjung/lowercase_seq b/code_python/Cjung/lowercase_seq index 02d3514..c608e80 100755 --- a/code_python/Cjung/lowercase_seq +++ b/code_python/Cjung/lowercase_seq @@ -127,7 +127,7 @@ a.opt['-I'] = '' # input file a.opt['-O'] = '' # output file a.getopt('I:O:?:v') # get user supplied option values -print >> sys.stderr, a.opt +#print >> sys.stderr, a.opt word = a.shift() # get the first of the remaining arguments # use a.pop() to get the last instead -- 2.39.5