12 #include "PolyARules.h"
13 #include "RefSeqPolicy.h"
14 #include "AlignerRefSeqPolicy.h"
21 AlignerRefSeqPolicy aligner_refp;
26 char refF[STRLEN], alignerFastaF[STRLEN];
28 int polyAChoice, polyALen;
29 char exceptionF[STRLEN];
30 bool ntog; // true , change N into G; false do not change. Default is true.
31 bool quiet; // verbose = !quiet;
33 // always generate references for aligners, default convert all N into G
34 int main(int argc, char* argv[]) {
37 printf("USAGE : rsem-preref refFastaF polyAChoice refName [-l polyALen] [-f exceptionF] [--no-ntog] [-q]\n\n");
38 printf(" refFastaF: a FASTA format file contains all reference transcripts\n");
39 printf(" polyAChoice: choice for polyA tail padding.It is a number from {0,1,2}\n");
40 printf(" 0: pad polyA tail\n");
41 printf(" 1: do not pad polyA tail at all\n");
42 printf(" 2: pad polyA tail for all references but those in exceptionF\n");
43 printf(" -l: polyALen: specify the length of polyA tail you want to pad. Default is 100\n");
44 printf(" -f: exceptionF: file contains a list of exception reference ids. IDs starts from 1. Must set if polyAChoice = 2\n");
45 printf(" --no-ntog: do not convert N in references into G\n");
46 printf(" -q: quiet\n");
51 polyAChoice = atoi(argv[2]);
56 memset(exceptionF, 0, sizeof(exceptionF));
58 for (int i = 4; i < argc; i++) {
59 if (!strcmp(argv[i], "-l")) { polyALen = atoi(argv[i + 1]); }
60 if (!strcmp(argv[i], "-f")) { strcpy(exceptionF, argv[i + 1]); }
61 if (!strcmp(argv[i], "--no-ntog")) { ntog = false; }
62 if (!strcmp(argv[i], "-q")) { quiet = true; }
68 rules = PolyARules(polyAChoice, polyALen, exceptionF);
69 refs.makeRefs(argv[1], refp, rules);
73 sprintf(refF, "%s.seq", argv[3]);
76 sprintf(alignerFastaF, "%s.idx.fa", argv[3]);
77 fout.open(alignerFastaF);
78 for (int i = 1; i <= M; i++) {
79 fout<<">"<<refs.getRef(i).getName()<<endl<<(ntog ? aligner_refp.convert(refs.getRef(i).getSeq()) : refs.getRef(i).getSeq())<<endl;
83 if (verbose) { printf("IDX.fa generated!\n"); }