]> git.donarmstrong.com Git - biopieces.git/commitdiff
fixed bug in vmatch_index
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 21 Aug 2008 03:55:34 +0000 (03:55 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Thu, 21 Aug 2008 03:55:34 +0000 (03:55 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@214 74ccb610-7750-0410-82ae-013aeee3265d

code_c/Maasha/src/gmon.out
code_c/Maasha/src/inc/fasta.h
code_c/Maasha/src/lib/fasta.c
code_c/Maasha/src/test/test_fasta.c
code_perl/Maasha/Match.pm

index 4c6cbd904a128d373eb5d6be0553ab95b4623bdf..330a6bccc856ca1d05e582236919b7d9644035e2 100644 (file)
Binary files a/code_c/Maasha/src/gmon.out and b/code_c/Maasha/src/gmon.out differ
index a0f56199404b6d8c5820111aee36f8315eb8b753..6d7c5c46a30db5ebccaf95dcd54c6ccaa4d9fd11 100644 (file)
@@ -1,3 +1,4 @@
+#define MAX_SEQ_NAME 1024
 #define FASTA_BUFFER 256 * 1024
 
 #define isseq( x ) ( x > 32 && x < 127 ) ? TRUE : FALSE
@@ -15,6 +16,9 @@ typedef struct _seq_entry seq_entry;
 /* Count all entries in a FASTA file given a file pointer. */
 size_t fasta_count( FILE *fp );
 
+/* Get the next FASTA sequence name from a stream. */
+bool fasta_get_seq_name( FILE *fp, char **seq_name_ppt );
+
 /* Get next sequence entry from a FASTA file given a file pointer. */
 bool fasta_get_entry( file_buffer **buffer_ppt, seq_entry **entry );
 
index 3e5880c60b36d48e9cfaa35415450aa0d3a3b968..493cbe79586bce01d00c145177a4aa19a460c4ab 100644 (file)
@@ -118,6 +118,34 @@ bool fasta_get_entry( file_buffer **buffer_ppt, seq_entry **entry_ppt )
 }
 
 
+bool fasta_get_seq_name( FILE *fp, char **seq_name_ppt )
+{
+    /* Martin A. Hansen, August 2008 */
+
+    /* Get the next FASTA sequence name from a stream. */
+
+    char *pt;
+    char  buffer[ MAX_SEQ_NAME ];
+
+    while ( 1 )
+    {
+        if ( ( pt = fgets( buffer, MAX_SEQ_NAME, fp ) ) )
+        {
+            printf( "buffer: %s\n", buffer ); 
+
+            if ( buffer[ 0 ] == '>' )
+            {
+                *seq_name_ppt = &buffer[ 1 ];
+
+                return TRUE;
+            }
+        }
+    }
+
+    return FALSE;
+}
+
+
 //bool fasta_get_entry( FILE *fp, seq_entry **entry )
 //{
 //    /* Martin A. Hansen, May 2008 */
index cebb6d70202fa0f48c7c9411f0462ed8b8c51930..b9641a02313d5ee7acec03f12a3ae5f8c0f7936a 100644 (file)
@@ -61,6 +61,15 @@ void test_fasta_get_seq_name()
 {
     fprintf( stderr, "   Testing fasta_get_seq_name ... " );
 
+    FILE *fp       = NULL;
+    char *seq_name = NULL;
+
+    fp = read_open( TEST_FILE1 );
+
+    fasta_get_seq_name( fp, &seq_name );
+
+    printf( "SEQ_NAME: ->%s<-\n", seq_name );
+
     assert( strcmp( seq_name, "test0" ) == 0 );
 
     fprintf( stderr, "OK\n" );
index c74d7195b8446c015749432f4ac03d92a4d12167..930c34a6c91c6516525f4cc130986170cbfefb70 100644 (file)
@@ -345,7 +345,7 @@ sub vmatch_index
             &Maasha::Common::run( "mkvtree", "-db $tmp_dir/$tmp_file -dna -pl -allout -indexname $dst_dir/$tmp_file > /dev/null 3>&1" );
 
             unlink "$tmp_dir/$tmp_file";
-#        }
+        }
 
         close $fh;
     }