From: martinahansen Date: Wed, 9 Sep 2009 09:00:38 +0000 (+0000) Subject: fixed bug in psl2bed conversion X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=07ec40b1c22f9a39184725d1ee7fefd2a20e115c;p=biopieces.git fixed bug in psl2bed conversion git-svn-id: http://biopieces.googlecode.com/svn/trunk@666 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_perl/Maasha/UCSC/BED.pm b/code_perl/Maasha/UCSC/BED.pm index 3d873e6..77988f7 100644 --- a/code_perl/Maasha/UCSC/BED.pm +++ b/code_perl/Maasha/UCSC/BED.pm @@ -463,9 +463,9 @@ sub biopiece2bed # record is converted and undef is returned if # convertion failed. - # IMPORTANT! The BED_END and THICK_END positions + # IMPORTANT! The chromEnd and thickEnd positions # will be the inexact position used in the - # UCSC scheme. + # UCSC scheme (+1 to all ends). my ( $bp_record, # hashref $cols, # number of columns in BED entry - OPTIONAL (but faster) @@ -477,9 +477,9 @@ sub biopiece2bed $cols ||= 12; # max number of columns possible - $bed_entry[ chrom ] = $bp_record->{ "CHR" } || - $bp_record->{ "S_ID" } || - return undef; + $bed_entry[ chrom ] = $bp_record->{ "CHR" } || + $bp_record->{ "S_ID" } || + return undef; if ( defined $bp_record->{ "CHR_BEG" } ) { $bed_entry[ chromStart ] = $bp_record->{ "CHR_BEG" }; @@ -490,15 +490,13 @@ sub biopiece2bed } if ( defined $bp_record->{ "CHR_END" } ) { - $bed_entry[ chromEnd ] = $bp_record->{ "CHR_END" }; + $bed_entry[ chromEnd ] = $bp_record->{ "CHR_END" } + 1; } elsif ( defined $bp_record->{ "S_END" }) { - $bed_entry[ chromEnd ] = $bp_record->{ "S_END" }; + $bed_entry[ chromEnd ] = $bp_record->{ "S_END" } + 1; } else { return undef; } - $bed_entry[ chromEnd ]++; - return wantarray ? @bed_entry : \@bed_entry if $cols == 3; $bed_entry[ name ] = $bp_record->{ "Q_ID" } || return wantarray ? @bed_entry : \@bed_entry; @@ -556,16 +554,16 @@ sub biopiece2bed $bed_entry[ blockCount ] = $bp_record->{ "BLOCK_COUNT" }; $bed_entry[ blockSizes ] = $bp_record->{ "BLOCK_LENS" }; $bed_entry[ blockStarts ] = join ",", @begs; - $bed_entry[ thickEnd ] = $bp_record->{ "THICK_END" } + 1; + # $bed_entry[ thickEnd ] = $bp_record->{ "THICK_END" } + 1; } elsif ( defined $bp_record->{ "BLOCK_COUNT" } and - defined $bp_record->{ "BLOCK_LENS" } and - defined $bp_record->{ "Q_BEGS" } ) + defined $bp_record->{ "BLOCK_LENS" } and + defined $bp_record->{ "Q_BEGS" } ) { $bed_entry[ blockCount ] = $bp_record->{ "BLOCK_COUNT" }; $bed_entry[ blockSizes ] = $bp_record->{ "BLOCK_LENS" }; $bed_entry[ blockStarts ] = $bp_record->{ "Q_BEGS" }; - $bed_entry[ thickEnd ] = $bp_record->{ "THICK_END" } + 1; + # $bed_entry[ thickEnd ] = $bp_record->{ "THICK_END" } + 1; } return wantarray ? @bed_entry : \@bed_entry; diff --git a/code_perl/Maasha/UCSC/PSL.pm b/code_perl/Maasha/UCSC/PSL.pm index 19f6e71..d803a96 100644 --- a/code_perl/Maasha/UCSC/PSL.pm +++ b/code_perl/Maasha/UCSC/PSL.pm @@ -140,9 +140,9 @@ sub psl2biopiece REC_TYPE => "PSL", BLOCK_LENS => $psl->[ blockSizes ], SNUMINSERT => $psl->[ tNumInsert ], - Q_END => $psl->[ qEnd ], + Q_END => $psl->[ qEnd ] - 1, SBASEINSERT => $psl->[ tBaseInsert ], - S_END => $psl->[ tEnd ], + S_END => $psl->[ tEnd ] - 1, QBASEINSERT => $psl->[ qBaseInsert ], REPMATCHES => $psl->[ repMatches ], QNUMINSERT => $psl->[ qNumInsert ],