1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#include <string>
#include <vector>
#include <alignment/algorithms/sorting/qsufsort.hpp>
#include <alignment/suffixarray/SuffixArray.hpp>
#include <alignment/suffixarray/SuffixArrayTypes.hpp>
#include <alignment/suffixarray/ssort.hpp>
#include <pbdata/FASTAReader.hpp>
#include <pbdata/FASTASequence.hpp>
#include <pbdata/NucConversion.hpp>
void PrintUsage()
{
std::cout << "samodify changes word size of input suffix array." << std::endl;
std::cout << "Usage: samodify in.sa genome.fasta out.sa [-blt p]" << std::endl;
std::cout << " -blt p Build a lookup table on prefixes of length 'p' " << std::endl;
}
int main(int argc, char* argv[])
{
if (argc < 4) {
PrintUsage();
std::exit(EXIT_FAILURE);
}
int argi = 1;
std::string saInFile = argv[argi++];
std::string genomeFileName = argv[argi++];
std::string saOutFile = argv[argi++];
std::vector<std::string> inFiles;
int doBLT = 0;
int doBLCP = 0;
int bltPrefixLength = 0;
int lcpLength = 0;
int parsingOptions = 0;
while (argi < argc) {
if (strcmp(argv[argi], "-blt") == 0) {
doBLT = 1;
bltPrefixLength = atoi(argv[++argi]);
} else if (strcmp(argv[argi], "-blcp") == 0) {
doBLCP = 1;
lcpLength = atoi(argv[++argi]);
} else {
PrintUsage();
std::cout << "Bad option: " << argv[argi] << std::endl;
std::exit(EXIT_FAILURE);
}
++argi;
}
//
// Read the suffix array to modify.
//
DNASuffixArray sa;
sa.Read(saInFile);
FASTAReader reader;
reader.Initialize(genomeFileName);
FASTASequence seq;
reader.ReadAllSequencesIntoOne(seq);
if (doBLT) {
sa.BuildLookupTable(seq.seq, seq.length, bltPrefixLength);
}
if (doBLCP) {
std::cout << "LCP Table not yet implemented." << std::endl;
}
sa.Write(saOutFile);
}
|