| 1 |
#include <stdio.h> |
| 2 |
#include <stdlib.h> |
| 3 |
#include <unistd.h> |
| 4 |
#include <string.h> |
| 5 |
#include <errno.h> |
| 6 |
|
| 7 |
#include "bio.h" |
| 8 |
#include "sim4.H" |
| 9 |
|
| 10 |
int |
| 11 |
main(int argc, char ** argv) { |
| 12 |
sim4polishWriter *GOOD = 0L; |
| 13 |
sim4polishStyle in_style, out_style; |
| 14 |
|
| 15 |
// We limit scaffolds to be below the number of open files per |
| 16 |
// process. |
| 17 |
// |
| 18 |
|
| 19 |
if (argc != 1) { |
| 20 |
fprintf(stderr, "S4DB to GFF3 format converter.\nUsage: %s < input_file > output_file\n", argv[0]); |
| 21 |
exit(1); |
| 22 |
} |
| 23 |
|
| 24 |
sim4polishReader *R = new sim4polishReader("-"); |
| 25 |
sim4polish *p = 0L; |
| 26 |
|
| 27 |
in_style = R->getsim4polishStyle(); |
| 28 |
|
| 29 |
if (in_style == sim4polishS4DB) |
| 30 |
out_style = sim4polishGFF3; |
| 31 |
else if (in_style == sim4polishGFF3) |
| 32 |
out_style = sim4polishS4DB; |
| 33 |
else { |
| 34 |
fprintf(stderr, "ERROR: Unrecognized or unsupported polishes format. Aborting.\n"); exit(1); |
| 35 |
} |
| 36 |
|
| 37 |
if (GOOD == 0L) |
| 38 |
GOOD = new sim4polishWriter("-", out_style); |
| 39 |
|
| 40 |
while (R->nextAlignment(p)) { |
| 41 |
|
| 42 |
#if 0 |
| 43 |
if (noDefLines) |
| 44 |
p->s4p_removeDefLines(); |
| 45 |
if (noAlignments) |
| 46 |
p->s4p_removeAlignments(); |
| 47 |
#endif |
| 48 |
|
| 49 |
GOOD->writeAlignment(p); |
| 50 |
} |
| 51 |
|
| 52 |
delete R; |
| 53 |
|
| 54 |
delete GOOD; |
| 55 |
|
| 56 |
return(0); |
| 57 |
} |