]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed CHR_BEG=0 bug
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 5 Dec 2008 06:02:53 +0000 (06:02 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 5 Dec 2008 06:02:53 +0000 (06:02 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@335 74ccb610-7750-0410-82ae-013aeee3265d

code_perl/Maasha/UCSC/BED.pm

index c95c930f1516537d75ce11c3f033cb6d436f2981..9d48daaf2caca40448cbd173a7bff654105d0475 100644 (file)
@@ -480,13 +480,21 @@ sub biopiece2bed
                                $bp_record->{ "S_ID" }    ||
                                return undef;
 
-    $bed_entry[ chromStart ] = $bp_record->{ "CHR_BEG" } || 
-                               $bp_record->{ "S_BEG" }   ||
-                               return undef;
+    if ( defined $bp_record->{ "CHR_BEG" } ) {
+        $bed_entry[ chromStart ] = $bp_record->{ "CHR_BEG" };
+    } elsif ( defined $bp_record->{ "S_BEG" } ) {
+        $bed_entry[ chromStart ] = $bp_record->{ "S_BEG" };
+    } else {
+        return undef;
+    }
 
-    $bed_entry[ chromEnd ]   = $bp_record->{ "CHR_END" } || 
-                               $bp_record->{ "S_END" }   ||
-                               return undef;
+    if ( defined $bp_record->{ "CHR_END" } ) {
+        $bed_entry[ chromEnd ] = $bp_record->{ "CHR_END" };
+    } elsif ( defined $bp_record->{ "S_END" }) {
+        $bed_entry[ chromEnd ] = $bp_record->{ "S_END" };
+    } else {
+        return undef;
+    }
 
     $bed_entry[ chromEnd ]++;