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 ) );
}
}
// 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++;
}
# 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 ) )
{
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 ) )
{
close $fh_in;
- unlink $file_hash->{ $chr };
unlink $bed_file;
+ unlink $tag_file;
}
}
$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;
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