]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bug in remove_indels
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 10 Jul 2009 14:36:04 +0000 (14:36 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Fri, 10 Jul 2009 14:36:04 +0000 (14:36 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@561 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/remove_indels
code_c/Maasha/src/Makefile
code_c/Maasha/src/inc/bits.h
code_c/Maasha/src/lib/bits.c
code_c/Maasha/src/test/Makefile

index 3156b44d60c29fa7418033c31868c1aec0546282..9a1ad033a0fbe508f4f12891ba06885179040814 100755 (executable)
@@ -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 );
 }
index d1e8d844e0f60e26564966e73afc51e83e7ad3b2..5ac2879621170d6029d876c5c0aa3011598b0e81 100644 (file)
@@ -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
index 440a548dff4d2b5a65309a386b4f2bb8a354fdf9..f0ff0f455e5260ef96da9591f08dc4b026b0a01e 100644 (file)
 /* 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;
index fcceafe5ab152131f1d6d0bab4fe674567ff4613..b7ca158e51b5380503c33d2566e016cf1516adbc 100644 (file)
@@ -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 );
 }
index 35fd0527bf6c2a557065278997c3741b1d5e58d6..a70e2fa40ba0eb36c87eeba0af5e1fcbf647ae6e 100644 (file)
@@ -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