12 #include "PolyARules.h"
13 #include "RefSeqPolicy.h"
14 #include "AlignerRefSeqPolicy.h"
21 AlignerRefSeqPolicy aligner_refp;
26 char refF[STRLEN], idxF[STRLEN], n2g_idxF[STRLEN];
28 int polyAChoice, polyALen;
29 char exceptionF[STRLEN];
30 bool quiet; // verbose = !quiet;
32 // always generate references for aligners, default convert all N into G
33 int main(int argc, char* argv[]) {
36 printf("USAGE : rsem-preref refFastaF polyAChoice refName [-l polyALen] [-f exceptionF] [-q]\n\n");
37 printf(" refFastaF: a FASTA format file contains all reference transcripts\n");
38 printf(" polyAChoice: choice for polyA tail padding.It is a number from {0,1,2}\n");
39 printf(" 0: pad polyA tail\n");
40 printf(" 1: do not pad polyA tail at all\n");
41 printf(" 2: pad polyA tail for all references but those in exceptionF\n");
42 printf(" -l: polyALen: specify the length of polyA tail you want to pad. Default is 100\n");
43 printf(" -f: exceptionF: file contains a list of exception reference ids. IDs starts from 1. Must set if polyAChoice = 2\n");
44 printf(" -q: quiet\n");
48 polyAChoice = atoi(argv[2]);
52 memset(exceptionF, 0, sizeof(exceptionF));
54 for (int i = 4; i < argc; i++) {
55 if (!strcmp(argv[i], "-l")) { polyALen = atoi(argv[i + 1]); }
56 if (!strcmp(argv[i], "-f")) { strcpy(exceptionF, argv[i + 1]); }
57 if (!strcmp(argv[i], "-q")) { quiet = true; }
63 rules = PolyARules(polyAChoice, polyALen, exceptionF);
64 refs.makeRefs(argv[1], refp, rules);
68 sprintf(refF, "%s.seq", argv[3]);
71 sprintf(idxF, "%s.idx.fa", argv[3]);
73 for (int i = 1; i <= M; i++) {
74 fout<< ">"<< refs.getRef(i).getName()<< endl<< refs.getRef(i).getSeq()<< endl;
77 if (verbose) printf("%s is generated!\n", idxF);
79 sprintf(n2g_idxF, "%s.n2g.idx.fa", argv[3]);
81 for (int i = 1; i <= M; i++) {
82 fout<< ">"<< refs.getRef(i).getName()<< endl<< aligner_refp.convert(refs.getRef(i).getSeq())<< endl;
85 if (verbose) printf("%s is generated!\n", n2g_idxF);