Browse code

fix a random crash, a 64bit compile error, objects not getting properly cleaned, etc

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/seqbias@54558 bc3139a8-67e5-0310-9ffc-ced21a209358

Daniel Jones authored on 06/04/2011 20:08:03
Showing 6 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: seqbias
2
-Version: 0.99.10
2
+Version: 0.99.11
3 3
 Date: 25-12-2010
4 4
 Title: Estimation of per-position bias in high-throughput sequencing data
5 5
 Description: This package implements a model of per-position sequencing bias in
... ...
@@ -1,5 +1,13 @@
1 1
 include Makevars.common
2 2
 
3
+PKG_CFLAGS   += -D_GNU_SOURCE
4
+PKG_CXXFLAGS += -D_GNU_SOURCE
5
+
3 6
 OBJECTS = $(SEQBIAS_OBJ) \
4 7
 		  $(YAML_CPP_OBJ:%=yaml-cpp/%)
5 8
 
9
+all : $(SHLIB)
10
+
11
+clean :
12
+	rm -rf $(OBJECTS)
13
+
... ...
@@ -16,5 +16,6 @@ SEQBIAS_OBJ = sequencing_bias.o kmers.o miscmath.o common.o \
16 16
 
17 17
 GNULIB_OBJ = asprintf.o printf-args.o printf-parse.o vasnprintf.o vasprintf.o
18 18
 
19
-PKG_CFLAGS  += -Wall -D_GNU_SOURCE
19
+PKG_CFLAGS   += -Wall
20
+PKG_CXXFLAGS += -Wall
20 21
 
... ...
@@ -1,5 +1,13 @@
1 1
 include Makevars.common
2
+
2 3
 PKG_CPPFLAGS+=-DNEED_ASPRINTF
4
+
3 5
 OBJECTS = $(SEQBIAS_OBJ) \
4 6
 		  $(YAML_CPP_OBJ:%=yaml-cpp/%) \
5 7
 		  $(GNULIB_OBJ:%=gnulib/%)
8
+
9
+all : $(SHLIB)
10
+
11
+clean :
12
+	rm -rf $(OBJECTS)
13
+
... ...
@@ -70,11 +70,11 @@ void kmer_matrix::to_yaml( YAML::Emitter& out ) const
70 70
     out << YAML::BeginMap;
71 71
 
72 72
     out << YAML::Key   << "k";
73
-    out << YAML::Value << k;
73
+    out << YAML::Value << (unsigned int)k;
74 74
     out << YAML::Key   << "n";
75
-    out << YAML::Value << n;
75
+    out << YAML::Value << (unsigned int)n;
76 76
     out << YAML::Key   << "m";
77
-    out << YAML::Value << m;
77
+    out << YAML::Value << (unsigned int)m;
78 78
     out << YAML::Key   << "A";
79 79
     out << YAML::Flow;
80 80
     out << YAML::Value;
... ...
@@ -335,13 +335,13 @@ void motif::to_yaml( YAML::Emitter& out ) const
335 335
     out << YAML::BeginMap;
336 336
 
337 337
     out << YAML::Key   << "n";
338
-    out << YAML::Value << n;
338
+    out << YAML::Value << (unsigned int)n;
339 339
 
340 340
     out << YAML::Key   << "k";
341
-    out << YAML::Value << k;
341
+    out << YAML::Value << (unsigned int)k;
342 342
 
343 343
     out << YAML::Key   << "c";
344
-    out << YAML::Value << c;
344
+    out << YAML::Value << (unsigned int)c;
345 345
 
346 346
     out << YAML::Key << "parents";
347 347
     out << YAML::Value;
... ...
@@ -722,7 +722,7 @@ void train_motifs( motif& M0, motif& M1,
722 722
     while( true ) {
723 723
         round_num++;
724 724
 
725
-        log_printf( LOG_MSG, "round %4d (ic = %0.4e) ", round_num, ic_curr );
725
+        log_printf( LOG_MSG, "round %4zu (ic = %0.4e) ", round_num, ic_curr );
726 726
         col = 0;
727 727
 
728 728
         ic_forw_best = ic_back_best = ic_rev_best = -HUGE_VAL;
... ...
@@ -383,21 +383,22 @@ void sequencing_bias::build( const char* ref_fn,
383 383
 
384 384
         /* add a background sequence */
385 385
         /* adjust the current read position randomly, and sample */
386
-        for( bg_sample_num = 0; bg_sample_num < bg_samples; bg_sample_num++ ) {
386
+        for( bg_sample_num = 0; bg_sample_num < bg_samples; ) {
387 387
 
388 388
             bg_pos = S[i].pos + (pos)ceil( rand_trunc_gauss( offset_std, -100, 100 ) );
389 389
 
390 390
             if( S[i].strand ) {
391
-                if( bg_pos < R || S[i].pos >= seqlen - L ) continue;
391
+                if( bg_pos < R || bg_pos >= seqlen - L ) continue;
392 392
                 memcpy( local_seq, seq + bg_pos - R, (L+1+R)*sizeof(char) );
393 393
                 seqrc( local_seq, L+1+R );
394 394
             }
395 395
             else {
396
-                if( bg_pos < L || S[i].pos >= seqlen - R ) continue;
396
+                if( bg_pos < L || bg_pos >= seqlen - R ) continue;
397 397
                 memcpy( local_seq, seq + (bg_pos-L), (L+1+R)*sizeof(char) );
398 398
             }
399 399
 
400 400
             training_seqs.push_back( new sequence( local_seq, 0 ) );
401
+            bg_sample_num++;
401 402
         }
402 403
     }
403 404