]> git.donarmstrong.com Git - biopieces.git/commitdiff
added bed2tag_contigs as backend to assemble_tag_contigs
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 5 Dec 2008 05:16:39 +0000 (05:16 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 5 Dec 2008 05:16:39 +0000 (05:16 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@333 74ccb610-7750-0410-82ae-013aeee3265d

code_c/Maasha/src/bed2tag_contigs.c
code_perl/Maasha/Biopieces.pm
code_perl/Maasha/UCSC/BED.pm
code_python/Cjung/lowercase_seq

index ae61b359ddcfbea6f391d35f2c835eced72f2e7a..265eb11bc4dcfc25ab12d1b114934a997143a373 100644 (file)
@@ -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++;
             }
index 59b7df7015af6eba949292b748edb5dd3506a1ff..013b0319a5a2636a70220503d30448cd7c7521fd 100644 (file)
@@ -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;
     }
 }
 
index 3dcf45f8217c45d6911733889bb201ed3345db83..c95c930f1516537d75ce11c3f033cb6d436f2981 100644 (file)
@@ -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;
 
index 02d35148e9c375f82124e3c1d40d2d718bfd4523..c608e80d051a31d6971b8133139acd94f426cd88 100755 (executable)
@@ -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