Skip to content

Commit

Permalink
Accept .fa
Browse files Browse the repository at this point in the history
  • Loading branch information
thegenemyers committed Sep 18, 2023
1 parent 8662b7d commit 77f3a21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
11 changes: 6 additions & 5 deletions ONElib.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifdef DEBUG
#include <assert.h>
#else
#define assert(x) 0
#define assert(x)
#endif

#include "ONElib.h"
Expand Down Expand Up @@ -390,9 +390,10 @@ static OneSchema *oneSchemaCreateDynamic (char *fileType, char *subType)
assert (fileType && strlen(fileType) > 0) ;
assert (!subType || strlen(subType) > 0) ;
if (subType)
sprintf (text, "P %ld %s\nS %ld %s\n", strlen(fileType),fileType, strlen(subType), subType) ;
sprintf (text, "P %d %s\nS %d %s\n", (int) strlen(fileType),fileType,
(int) strlen(subType), subType) ;
else
sprintf (text, "P %ld %s\n", strlen(fileType), fileType) ;
sprintf (text, "P %d %s\n", (int) strlen(fileType), fileType) ;
OneSchema *vs = oneSchemaCreateFromText (text) ;
return vs ;
}
Expand Down Expand Up @@ -3485,7 +3486,7 @@ static inline int intGet (unsigned char *u, I64 *pval)
case 0:
switch (u[0] & 0x07)
{
case 0: die ("int packing error") ;
case 0: die ("int packing error") ; break ;
case 1: *pval = *(I64*)(u+1) & 0x0000000000ffff ; return 3 ;
case 2: *pval = *(I64*)(u+1) & 0x00000000ffffff ; return 4 ;
case 3: *pval = *(I64*)(u+1) & 0x000000ffffffff ; return 5 ;
Expand All @@ -3497,7 +3498,7 @@ static inline int intGet (unsigned char *u, I64 *pval)
case 4:
switch (u[0] & 0x07)
{
case 0: die ("int packing error") ;
case 0: die ("int packing error") ; break ;
case 1: *pval = *(I64*)(u+1) | 0xffffffffffff0000 ; return 3 ;
case 2: *pval = *(I64*)(u+1) | 0xffffffffff000000 ; return 4 ;
case 3: *pval = *(I64*)(u+1) | 0xffffffff00000000 ; return 5 ;
Expand Down
8 changes: 6 additions & 2 deletions fasta2DAM.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,12 @@ int main(int argc, char *argv[])

path = PathTo(ng->name);
core = Root(ng->name,".fasta");
if ((input = Fopen(Catenate(path,"/",core,".fasta"),"r")) == NULL)
goto error;
if ((input = fopen(Catenate(path,"/",core,".fasta"),"r")) == NULL)
{ free(core);
core = Root(ng->name,".fa");
if ((input = fopen(Catenate(path,"/",core,".fa"),"r")) == NULL)
goto error;
}
free(path);
}

Expand Down
8 changes: 6 additions & 2 deletions fasta2DB.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,12 @@ int main(int argc, char *argv[])

path = PathTo(ng->name);
core = Root(ng->name,".fasta");
if ((input = Fopen(Catenate(path,"/",core,".fasta"),"r")) == NULL)
goto error;
if ((input = fopen(Catenate(path,"/",core,".fasta"),"r")) == NULL)
{ free(core);
core = Root(ng->name,".fa");
if ((input = fopen(Catenate(path,"/",core,".fa"),"r")) == NULL)
goto error;
}
free(path);
}

Expand Down

0 comments on commit 77f3a21

Please sign in to comment.