complete the human genome in roughly 30 minutes.
*/
-
-
-
-#include <stdio.h>
-#include <string.h>
#include "common.h"
#include "filesys.h"
#include "fasta.h"
-#define OLIGO_SIZE 15
+// #define OLIGO_SIZE 15
+#define OLIGO_SIZE 5
#define SIZE ( 1 << ( OLIGO_SIZE * 2 ) )
#define UINT_BITS 32
#define C 1 /* 01 on the rightmost two bits of bin. */
#define G 2 /* 10 on the rightmost two bits of bin. */
-uint mask_create( int oligo_size );
uint *oligo_count( char *path );
+uint mask_create( int oligo_size );
void oligo_count_output( char *path, uint *array );
void fixedstep_put_entry( char *chr, int beg, int step_size, uint *block_array, int block_size );
int main( int argc, char *argv[] )
{
- char *path;
- uint *array;
+ char *path = NULL;
+ uint *array = NULL;
- path = argv[ 1 ];
+ path = argv[ 1 ];
array = oligo_count( path );
}
-uint mask_create( int oligo_size )
-{
- /* Martin A. Hansen, June 2008 */
-
- /* Create a bit mask for binary encode oligos less than sizeof( uint ). */
-
- uint i;
- uint mask;
-
- mask = 0;
-
- for ( i = 0; i < oligo_size; i++ )
- {
- mask <<= 2;
-
- mask |= 3;
- }
-
- return mask;
-}
-
-
uint *oligo_count( char *path )
{
/* Martin A. Hansen, June 2008 */
/* Count the occurence of all oligos of a fixed size in a FASTA file. */
- uint *array;
- uint i;
- uint mask;
- uint bin;
- uint bin_rc1;
- uint bin_rc2;
- uint j;
- uint A_rc = ( 3 << ( UINT_BITS - 2 ) ); /* 11 on the leftmost two bits an uint. */
- uint G_rc = ( 2 << ( UINT_BITS - 2 ) ); /* 10 on the leftmost two bits an uint. */
- uint C_rc = ( 1 << ( UINT_BITS - 2 ) ); /* 01 on the leftmost two bits an uint. */
- struct seq_entry *entry;
- FILE *fp;
+ uint *array = NULL;
+ uint i = 0;
+ uint mask = 0;
+ uint bin = 0;
+ uint bin_rc1 = 0;
+ uint bin_rc2 = 0;
+ uint j = 0;
+ uint A_rc = ( 3 << ( UINT_BITS - 2 ) ); /* 11 on the leftmost two bits an uint. */
+ uint G_rc = ( 2 << ( UINT_BITS - 2 ) ); /* 10 on the leftmost two bits an uint. */
+ uint C_rc = ( 1 << ( UINT_BITS - 2 ) ); /* 01 on the leftmost two bits an uint. */
+ struct seq_entry *entry = NULL;
+ FILE *fp = NULL;
array = mem_get_zero( sizeof( uint ) * SIZE );
}
+uint mask_create( int oligo_size )
+{
+ /* Martin A. Hansen, June 2008 */
+
+ /* Create a bit mask for binary encode oligos less than sizeof( uint ). */
+
+ uint i;
+ uint mask;
+
+ mask = 0;
+
+ for ( i = 0; i < oligo_size; i++ )
+ {
+ mask <<= 2;
+
+ mask |= 3;
+ }
+
+ return mask;
+}
+
+
void oligo_count_output( char *path, uint *array )
{
/* Martin A. Hansen, June 2008 */
#include "list.h"
#include "fasta.h"
+int main()
+{
+ char *file = NULL;
+ FILE *fp = NULL;
+ struct seq_entry *entry = NULL;
+
+ file = "/Users/m.hansen/test.fna";
+
+ fp = read_open( file );
+
+ while ( ( fasta_get_entry( fp, entry ) != NULL ) )
+ {
+ printf( "seq_name: %s seq: %s seq_len: %i\n", entry->seq_name, entry->seq, entry->seq_len );
+ }
+
+ close_stream( fp );
+
+ return 0;
+}
+
+/*
+
int main()
{
char *file = "/Users/m.hansen/test.fna";
return 0;
}
+*/