From: martinahansen Date: Fri, 10 Jul 2009 14:36:04 +0000 (+0000) Subject: fixed bug in remove_indels X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=19c136fa10cc51942a639342c07dd9ba26717e28;p=biopieces.git fixed bug in remove_indels git-svn-id: http://biopieces.googlecode.com/svn/trunk@561 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/remove_indels b/bp_bin/remove_indels index 3156b44..9a1ad03 100755 --- a/bp_bin/remove_indels +++ b/bp_bin/remove_indels @@ -43,7 +43,8 @@ $out = Maasha::Biopieces::write_stream( $options->{ "stream_out" } ); 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 ); } diff --git a/code_c/Maasha/src/Makefile b/code_c/Maasha/src/Makefile index d1e8d84..5ac2879 100644 --- a/code_c/Maasha/src/Makefile +++ b/code_c/Maasha/src/Makefile @@ -1,8 +1,8 @@ # 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/ @@ -20,25 +20,25 @@ utest: 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 diff --git a/code_c/Maasha/src/inc/bits.h b/code_c/Maasha/src/inc/bits.h index 440a548..f0ff0f4 100644 --- a/code_c/Maasha/src/inc/bits.h +++ b/code_c/Maasha/src/inc/bits.h @@ -16,12 +16,12 @@ /* 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; diff --git a/code_c/Maasha/src/lib/bits.c b/code_c/Maasha/src/lib/bits.c index fcceafe..b7ca158 100644 --- a/code_c/Maasha/src/lib/bits.c +++ b/code_c/Maasha/src/lib/bits.c @@ -24,23 +24,23 @@ void bitarray_new( bitarray **ba_ppt, size_t size ) /* 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; @@ -53,7 +53,7 @@ void bitarray_fill( bitarray *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; } @@ -65,7 +65,7 @@ void bitarray_zero( bitarray *ba_pt ) /* 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; } @@ -171,8 +171,9 @@ void bitarray_print( bitarray *ba_pt ) 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 ); } diff --git a/code_c/Maasha/src/test/Makefile b/code_c/Maasha/src/test/Makefile index 35fd052..a70e2fa 100644 --- a/code_c/Maasha/src/test/Makefile +++ b/code_c/Maasha/src/test/Makefile @@ -3,15 +3,15 @@ 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