git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/seqbias@52365 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -119,6 +119,7 @@ configure:2948: checking for pow |
119 | 119 |
configure:2948: gcc -o conftest -g -O2 conftest.c -lz >&5 |
120 | 120 |
conftest.c:35: warning: conflicting types for built-in function 'pow' |
121 | 121 |
/tmp/cc2oJinr.o: In function `main': |
122 |
+/tmp/ccFHWg6Y.o: In function `main': |
|
122 | 123 |
/home/dcjones/bio/seqbias/conftest.c:46: undefined reference to `pow' |
123 | 124 |
collect2: ld returned 1 exit status |
124 | 125 |
configure:2948: $? = 1 |
... | ... |
@@ -176,7 +177,11 @@ configure:2948: result: no |
176 | 177 |
configure:2948: checking for sqrt |
177 | 178 |
configure:2948: gcc -o conftest -g -O2 conftest.c -lz >&5 |
178 | 179 |
conftest.c:35: warning: conflicting types for built-in function 'sqrt' |
180 |
+<<<<<<< HEAD |
|
179 | 181 |
/tmp/ccFdFAsw.o: In function `main': |
182 |
+======= |
|
183 |
+/tmp/ccgUY6M3.o: In function `main': |
|
184 |
+>>>>>>> working |
|
180 | 185 |
/home/dcjones/bio/seqbias/conftest.c:46: undefined reference to `sqrt' |
181 | 186 |
collect2: ld returned 1 exit status |
182 | 187 |
configure:2948: $? = 1 |
... | ... |
@@ -1,22 +1,8 @@ |
1 | 1 |
|
2 |
-SAMTOOLS_OBJ = bam_aux.o bam.o bam_import.o bam_index.o bam_pileup.o \ |
|
3 |
- bgzf.o faidx.o knetfile.o kstring.o razf.o sam.o sam_header.o |
|
4 |
- |
|
5 |
-YAML_CPP_OBJ = aliascontent.o conversion.o emitter.o emitterstate.o \ |
|
6 |
- emitterutils.o exp.o iterator.o map.o node.o null.o \ |
|
7 |
- ostream.o parser.o parserstate.o regex.o scalar.o scanner.o \ |
|
8 |
- scanscalar.o scantag.o scantoken.o sequence.o simplekey.o \ |
|
9 |
- stream.o tag.o |
|
10 |
- |
|
11 |
-SEQBIAS_OBJ = sequencing_bias.o kmers.o miscmath.o common.o \ |
|
12 |
- table.o superfasthash.o logger.o seqbias.o \ |
|
13 |
- snprintf.o |
|
2 |
+PKG_LIBS+=-lz |
|
14 | 3 |
|
15 |
-DFLAGS = -D_USE_KNETFILE -D_FILE_OFFSET_BITS=64 |
|
16 |
-PKG_CFLAGS += $(DFLAGS) |
|
17 |
-PKG_CPPFLAGS = $(PKG_CFLAGS) |
|
4 |
+include Makevars.common |
|
18 | 5 |
|
19 |
-PKG_LIBS+=-lz |
|
20 | 6 |
|
21 | 7 |
OBJECTS = $(SEQBIAS_OBJ) $(SAMTOOLS_OBJ:%=samtools/%) $(YAML_CPP_OBJ:%=yaml-cpp/%) |
22 | 8 |
|
23 | 9 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,18 @@ |
1 |
+ |
|
2 |
+SAMTOOLS_OBJ = bam_aux.o bam.o bam_import.o bam_index.o bam_pileup.o \ |
|
3 |
+ bgzf.o faidx.o knetfile.o kstring.o razf.o sam.o sam_header.o |
|
4 |
+ |
|
5 |
+YAML_CPP_OBJ = aliascontent.o conversion.o emitter.o emitterstate.o \ |
|
6 |
+ emitterutils.o exp.o iterator.o map.o node.o null.o \ |
|
7 |
+ ostream.o parser.o parserstate.o regex.o scalar.o scanner.o \ |
|
8 |
+ scanscalar.o scantag.o scantoken.o sequence.o simplekey.o \ |
|
9 |
+ stream.o tag.o |
|
10 |
+ |
|
11 |
+SEQBIAS_OBJ = sequencing_bias.o kmers.o miscmath.o common.o \ |
|
12 |
+ table.o superfasthash.o logger.o seqbias.o \ |
|
13 |
+ snprintf.o |
|
14 |
+ |
|
15 |
+DFLAGS = -D_USE_KNETFILE -D_FILE_OFFSET_BITS=64 |
|
16 |
+PKG_CFLAGS += $(DFLAGS) -Wall |
|
17 |
+PKG_CPPFLAGS = $(PKG_CFLAGS) |
|
18 |
+ |
... | ... |
@@ -1,22 +1,8 @@ |
1 | 1 |
|
2 |
-SAMTOOLS_OBJ = bam_aux.o bam.o bam_import.o bam_index.o bam_pileup.o \ |
|
3 |
- bgzf.o faidx.o knetfile.o kstring.o razf.o sam.o sam_header.o |
|
4 |
- |
|
5 |
-YAML_CPP_OBJ = aliascontent.o conversion.o emitter.o emitterstate.o \ |
|
6 |
- emitterutils.o exp.o iterator.o map.o node.o null.o \ |
|
7 |
- ostream.o parser.o parserstate.o regex.o scalar.o scanner.o \ |
|
8 |
- scanscalar.o scantag.o scantoken.o sequence.o simplekey.o \ |
|
9 |
- stream.o tag.o |
|
10 |
- |
|
11 |
-SEQBIAS_OBJ = sequencing_bias.o kmers.o miscmath.o common.o \ |
|
12 |
- table.o superfasthash.o logger.o seqbias.o \ |
|
13 |
- snprintf.o |
|
2 |
+PKG_LIBS+=@LIBS@ |
|
14 | 3 |
|
15 |
-DFLAGS = -D_USE_KNETFILE -D_FILE_OFFSET_BITS=64 |
|
16 |
-PKG_CFLAGS += $(DFLAGS) |
|
17 |
-PKG_CPPFLAGS = $(PKG_CFLAGS) |
|
4 |
+include Makevars.common |
|
18 | 5 |
|
19 |
-PKG_LIBS+=@LIBS@ |
|
20 | 6 |
|
21 | 7 |
OBJECTS = $(SEQBIAS_OBJ) $(SAMTOOLS_OBJ:%=samtools/%) $(YAML_CPP_OBJ:%=yaml-cpp/%) |
22 | 8 |
|
23 | 9 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,13 @@ |
1 |
+ |
|
2 |
+PKG_LIBS+=-$(ZLIB_LIBS) -lws2_32 |
|
3 |
+PKG_CFLAGS+=-D_LARGEFILE64_SOURCE |
|
4 |
+ |
|
5 |
+include Makevars.common |
|
6 |
+ |
|
7 |
+OBJECTS = $(SEQBIAS_OBJ) $(SAMTOOLS_OBJ:%=samtools/%) $(YAML_CPP_OBJ:%=yaml-cpp/%) |
|
8 |
+ |
|
9 |
+all : $(SHLIB) |
|
10 |
+ |
|
11 |
+clean: |
|
12 |
+ rm -f $(OBJECTS) |
|
13 |
+ |
... | ... |
@@ -81,11 +81,11 @@ void kmer_matrix::to_yaml( YAML::Emitter& out ) const |
81 | 81 |
out << YAML::BeginMap; |
82 | 82 |
|
83 | 83 |
out << YAML::Key << "k"; |
84 |
- out << YAML::Value << k; |
|
84 |
+ out << YAML::Value << (unsigned int)k; |
|
85 | 85 |
out << YAML::Key << "n"; |
86 |
- out << YAML::Value << n; |
|
86 |
+ out << YAML::Value << (unsigned int)n; |
|
87 | 87 |
out << YAML::Key << "m"; |
88 |
- out << YAML::Value << m; |
|
88 |
+ out << YAML::Value << (unsigned int)m; |
|
89 | 89 |
out << YAML::Key << "A"; |
90 | 90 |
out << YAML::Flow; |
91 | 91 |
out << YAML::Value; |
... | ... |
@@ -329,10 +329,10 @@ void motif::to_yaml( YAML::Emitter& out ) const |
329 | 329 |
out << YAML::BeginMap; |
330 | 330 |
|
331 | 331 |
out << YAML::Key << "n"; |
332 |
- out << YAML::Value << n; |
|
332 |
+ out << YAML::Value << (unsigned int)n; |
|
333 | 333 |
|
334 | 334 |
out << YAML::Key << "k"; |
335 |
- out << YAML::Value << k; |
|
335 |
+ out << YAML::Value << (unsigned int)k; |
|
336 | 336 |
|
337 | 337 |
out << YAML::Key << "c"; |
338 | 338 |
out << YAML::Value << c; |
... | ... |
@@ -270,7 +270,7 @@ void dealloc_kmer_matrix( SEXP M ) |
270 | 270 |
|
271 | 271 |
SEXP seqbias_alloc_kmer_matrix( SEXP n, SEXP k ) |
272 | 272 |
{ |
273 |
- int c_n, c_k; |
|
273 |
+ int c_n = 0, c_k = 0; |
|
274 | 274 |
|
275 | 275 |
if( !IS_INTEGER(n) || (c_n = asInteger(n)) <= 0) { |
276 | 276 |
error( "'n' must be a positive integer" ); |
... | ... |
@@ -306,7 +306,7 @@ SEXP seqbias_tally_kmers( SEXP M, SEXP seq, SEXP count, SEXP offset ) |
306 | 306 |
pos c_offset = asInteger(offset); |
307 | 307 |
|
308 | 308 |
size_t n = strlen(c_seq); |
309 |
- if( LENGTH(count) != n ) error( "sequence length mismatches count length" ); |
|
309 |
+ if( (size_t)LENGTH(count) != n ) error( "sequence length mismatches count length" ); |
|
310 | 310 |
|
311 | 311 |
size_t k = c_M->getk(); |
312 | 312 |
|
... | ... |
@@ -314,13 +314,13 @@ SEXP seqbias_tally_kmers( SEXP M, SEXP seq, SEXP count, SEXP offset ) |
314 | 314 |
* Convert the sequence to an array of kmers. |
315 | 315 |
*/ |
316 | 316 |
|
317 |
- int i; |
|
317 |
+ size_t i; |
|
318 | 318 |
kmer kmer_mask = 0; |
319 | 319 |
for( i = 0; i < k; i++ ) kmer_mask = (kmer_mask<<2) | 0x3; |
320 | 320 |
|
321 | 321 |
kmer* ks = new kmer[n - (k - 1)]; |
322 | 322 |
memset( ks, 0, (n - (k - 1)) * sizeof(kmer) ); |
323 |
- kmer K; |
|
323 |
+ kmer K = 0; |
|
324 | 324 |
for( i = 0; i < n; i++ ) { |
325 | 325 |
K = ((K << 2) | nt2num(c_seq[i])) & kmer_mask; |
326 | 326 |
if( i >= k-1 ) ks[i-(k-1)] = K; |
... | ... |
@@ -332,9 +332,12 @@ SEXP seqbias_tally_kmers( SEXP M, SEXP seq, SEXP count, SEXP offset ) |
332 | 332 |
*/ |
333 | 333 |
pos j; |
334 | 334 |
for( i = 0; i < n; i++ ) { |
335 |
- if( i >= c_offset && i - c_offset + c_M->getn() <= n && REAL(count)[i] > 0.0 ) { |
|
336 |
- for( j = 0; j < c_M->getn(); j++ ) { |
|
337 |
- (*c_M)( j, ks[i - c_offset + j] ) += REAL(count)[i]; |
|
335 |
+ if( (pos)i >= c_offset && |
|
336 |
+ (pos)i - c_offset + c_M->getn() <= n && |
|
337 |
+ REAL(count)[i] > 0.0 ) |
|
338 |
+ { |
|
339 |
+ for( j = 0; (size_t)j < c_M->getn(); j++ ) { |
|
340 |
+ (*c_M)( j, ks[(pos)i - c_offset + j] ) += REAL(count)[i]; |
|
338 | 341 |
//(*c_M)( j, ks[i - c_offset + j] ) += 1; |
339 | 342 |
} |
340 | 343 |
} |
... | ... |
@@ -371,7 +374,7 @@ SEXP seqbias_dataframe_from_kmer_matrix( SEXP M, SEXP offset ) |
371 | 374 |
|
372 | 375 |
char* Kstr = new char[k+1]; |
373 | 376 |
|
374 |
- for( i = 0; i < n; i++ ) { |
|
377 |
+ for( i = 0; (size_t)i < n; i++ ) { |
|
375 | 378 |
for( K = 0; K < m; K++ ) { |
376 | 379 |
|
377 | 380 |
/* set pos */ |
... | ... |
@@ -219,10 +219,9 @@ void sequencing_bias::build( const char* ref_fn, |
219 | 219 |
|
220 | 220 |
/* background sampling */ |
221 | 221 |
const size_t bg_samples = 1; // make this many samples for each read |
222 |
- int bg_sample_num; // keep track of the number of samples made |
|
222 |
+ size_t bg_sample_num; // keep track of the number of samples made |
|
223 | 223 |
struct read_pos bg; // background position being considered |
224 | 224 |
|
225 |
- int b; |
|
226 | 225 |
char* seqname = NULL; |
227 | 226 |
int seqlen = 0; |
228 | 227 |
int curr_tid = -1; |
... | ... |
@@ -240,10 +240,6 @@ |
240 | 240 |
* with "ap2 = ap", in this case you must not call va_end(ap2) ! |
241 | 241 |
* #define va_copy(ap2,ap) ap2 = ap |
242 | 242 |
*/ |
243 |
-/* #define NEED_ASPRINTF */ |
|
244 |
-/* #define NEED_ASNPRINTF */ |
|
245 |
-/* #define NEED_VASPRINTF */ |
|
246 |
-/* #define NEED_VASNPRINTF */ |
|
247 | 243 |
|
248 | 244 |
|
249 | 245 |
/* Define the following macros if desired: |
... | ... |
@@ -284,6 +280,15 @@ |
284 | 280 |
/* NO USER SERVICABLE PARTS FOLLOWING THIS POINT */ |
285 | 281 |
/* ============================================= */ |
286 | 282 |
|
283 |
+#ifdef _GNU_SOURCE |
|
284 |
+#define HAVE_SNPRINTF |
|
285 |
+#else |
|
286 |
+#define NEED_ASPRINTF |
|
287 |
+#define NEED_ASNPRINTF |
|
288 |
+#define NEED_VASPRINTF |
|
289 |
+#define NEED_VASNPRINTF |
|
290 |
+#endif |
|
291 |
+ |
|
287 | 292 |
#define PORTABLE_SNPRINTF_VERSION_MAJOR 2 |
288 | 293 |
#define PORTABLE_SNPRINTF_VERSION_MINOR 2 |
289 | 294 |
|
... | ... |
@@ -157,7 +157,7 @@ int compare_seq_hash( const void* x, const void* y ) |
157 | 157 |
if( c == 0 ) { |
158 | 158 |
uint32_t ha = hash( (void*)&(*a)->pos, sizeof(struct read_pos) ); |
159 | 159 |
uint32_t hb = hash( (void*)&(*b)->pos, sizeof(struct read_pos) ); |
160 |
- return (int32_t)a - (int32_t)b; |
|
160 |
+ return (int32_t)ha - (int32_t)hb; |
|
161 | 161 |
} |
162 | 162 |
else return c; |
163 | 163 |
|