while ( $record = Maasha::Biopieces::get_record( $in ) )
{
- $record->{ 'SEQ' } =~ tr/-~.//d if $record->{ "SEQ" };
+ $record->{ 'SEQ' } =~ tr/-~.//d if $record->{ "SEQ" };
+ $record->{ 'SEQ_LEN' } = length $record->{ "SEQ" };
Maasha::Biopieces::put_record( $record, $out );
}
# Martin Asser Hansen (mail@maasha.dk) Copyright (C) 2008 - All right reserved
CC = gcc
-# Cflags = -Wall -Werror
-Cflags = -Wall -Werror -g -pg # for gprof
+# CFLAGS = -Wall -Werror
+CFLAGS = -Wall -Werror -g -pg # for gprof
INC_DIR = inc/
LIB_DIR = lib/
cd $(TEST_DIR) && ${MAKE} all
bed2fixedstep: bed2fixedstep.c
- $(CC) $(Cflags) $(INC) $(LIB) bed2fixedstep.c -o bed2fixedstep
+ $(CC) $(CFLAGS) $(INC) $(LIB) bed2fixedstep.c -o bed2fixedstep
bed2tag_contigs: bed2tag_contigs.c
- $(CC) $(Cflags) $(INC) $(LIB) bed2tag_contigs.c -o bed2tag_contigs
+ $(CC) $(CFLAGS) $(INC) $(LIB) bed2tag_contigs.c -o bed2tag_contigs
bed_sort: bed_sort.c
- $(CC) $(Cflags) $(INC) $(LIB) bed_sort.c -o bed_sort
+ $(CC) $(CFLAGS) $(INC) $(LIB) bed_sort.c -o bed_sort
bipartite_scan: bipartite_scan.c
- $(CC) $(Cflags) $(INC) $(LIB) bipartite_scan.c -o bipartite_scan
+ $(CC) $(CFLAGS) $(INC) $(LIB) bipartite_scan.c -o bipartite_scan
bipartite_decode: bipartite_decode.c
- $(CC) $(Cflags) $(INC) $(LIB) bipartite_decode.c -o bipartite_decode
+ $(CC) $(CFLAGS) $(INC) $(LIB) bipartite_decode.c -o bipartite_decode
fasta_count: fasta_count.c
- $(CC) $(Cflags) $(INC) $(LIB) fasta_count.c -o fasta_count
+ $(CC) $(CFLAGS) $(INC) $(LIB) fasta_count.c -o fasta_count
repeat-O-matic: repeat-O-matic.c
- $(CC) $(Cflags) $(INC) $(LIB) repeat-O-matic.c -o repeat-O-matic
+ $(CC) $(CFLAGS) $(INC) $(LIB) repeat-O-matic.c -o repeat-O-matic
clean:
cd $(LIB_DIR) && ${MAKE} clean
/* Bitarray structure */
struct _bitarray
{
- size_t size; /* number of bits in bitarray. */
- size_t bits_on; /* number of bits set to 'on'. */
- char *str; /* bit string. */
- size_t str_len; /* length of bit string. */
- size_t modulus; /* number of bits used in last element of str. */
- char mask; /* bit mask to trim length of str. */
+ size_t size; /* size of bitarray in bits. */
+ size_t bits_on; /* number of bits set to 'on'. */
+ char *str; /* bit string. */
+ size_t str_size; /* size of bit string in bytes. */
+ size_t modulus; /* number of bits used in last element of str. */
+ char mask; /* bit mask to trim length of str. */
};
typedef struct _bitarray bitarray;
/* Initialize a new bitarray of a given size in bits. */
bitarray *ba_pt = *ba_ppt;
- size_t str_len = 0;
+ size_t str_size = 0;
size_t modulus = 0;
assert( size > 0 );
ba_pt = mem_get( sizeof( bitarray ) );
- str_len = size / BITS_IN_BYTE;
+ str_size = size / BITS_IN_BYTE;
modulus = size % BITS_IN_BYTE;
if ( modulus != 0 ) {
- str_len++;
+ str_size++;
}
ba_pt->size = size;
- ba_pt->str_len = str_len;
- ba_pt->str = mem_get_zero( str_len + 1 );
+ ba_pt->str_size = str_size;
+ ba_pt->str = mem_get_zero( str_size + 1 );
ba_pt->bits_on = 0;
*ba_ppt = ba_pt;
/* Set all bits in bitarray to 'on'. */
- memset( ba_pt->str, BYTE_ON, ba_pt->str_len );
+ memset( ba_pt->str, BYTE_ON, ba_pt->str_size );
ba_pt->bits_on = ba_pt->size;
}
/* Set all bits in bitarray to 'off'. */
- bzero( ba_pt->str, ba_pt->str_len );
+ bzero( ba_pt->str, ba_pt->str_size );
ba_pt->bits_on = 0;
}
printf( "ba_pt->str: %s\n", str );
printf( "ba_pt->str (raw): %s\n", ba_pt->str );
printf( "ba_pt->size: %zu\n", ba_pt->size );
- printf( "ba_pt->str_len: %zu\n", ba_pt->str_len );
+ printf( "ba_pt->str_size: %zu\n", ba_pt->str_size );
printf( "ba_pt->bits_on: %zu\n", ba_pt->bits_on );
+ printf( "ba_pt->modulus: %zu\n", ba_pt->modulus );
mem_free( &str );
}
CC = gcc
CFLAGS = -Wall -Werror
-INC = -I ../inc/
+INC = -I ../inc/ -I $(HOME)/maasha_install/include/
LIB = -lm ../lib/*.o
all: test
test: test_common
-test_common: test_common2.c $(LIB_DIR)common.c
- $(CC) $(CFLAGS) $(INC) $(LIB) test_common2.c -o test_common2
+test_common: test_common.c
+ $(CC) $(CFLAGS) $(INC) $(LIB) test_common.c -o test_common
clean:
- rm test_common2
+ rm test_common