-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5d8483
commit 1806c0c
Showing
4 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,14 +130,21 @@ std::vector<Command> baseCommands = { | |
"<i:fastaFile1[.gz|.bz2]> ... <i:fastaFileN[.gz|.bz2]>|<i:stdin> <o:sequenceDB>", | ||
CITATION_MMSEQS2, {{"fast[a|q]File[.gz|bz2]|stdin", DbType::ACCESS_MODE_INPUT, DbType::NEED_DATA | DbType::VARIADIC, &DbValidator::flatfileStdinAndGeneric }, | ||
{"sequenceDB", DbType::ACCESS_MODE_OUTPUT, DbType::NEED_DATA, &DbValidator::flatfile }}}, | ||
{"makepaddedseqdb", makepaddedseqdb, &par.onlyverbosity, COMMAND_HIDDEN, | ||
"Generate a padded sequence DB", | ||
"Generate a padded sequence DB", | ||
"Martin Steinegger <[email protected]>", | ||
"<i:sequenceDB> <o:sequenceDB>", | ||
CITATION_MMSEQS2, {{"sequenceDB", DbType::ACCESS_MODE_INPUT, DbType::NEED_DATA|DbType::NEED_HEADER, &DbValidator::sequenceDb }, | ||
{"sequenceIndexDB", DbType::ACCESS_MODE_OUTPUT, DbType::NEED_DATA, &DbValidator::sequenceDb }}}, | ||
{"appenddbtoindex", appenddbtoindex, &par.appenddbtoindex, COMMAND_HIDDEN, | ||
NULL, | ||
NULL, | ||
"Milot Mirdita <[email protected]>", | ||
"<i:DB1> ... <i:DBN> <o:DB>", | ||
CITATION_MMSEQS2, {{"DB", DbType::ACCESS_MODE_INPUT, DbType::NEED_DATA | DbType::VARIADIC, &DbValidator::allDb }, | ||
{"DB", DbType::ACCESS_MODE_INPUT, DbType::NEED_DATA, &DbValidator::allDb }}}, | ||
{"indexdb", indexdb, &par.indexdb, COMMAND_HIDDEN, | ||
{"indexdb", indexdb, &par.indexdb, COMMAND_HIDDEN, | ||
NULL, | ||
NULL, | ||
"Martin Steinegger <[email protected]>", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include "Parameters.h" | ||
#include "DBReader.h" | ||
#include "DBWriter.h" | ||
#include "Debug.h" | ||
#include "Util.h" | ||
|
||
int makepaddedseqdb(int argc, const char **argv, const Command &command) { | ||
Parameters &par = Parameters::getInstance(); | ||
par.parseParameters(argc, argv, command, true, 0, 0); | ||
DBReader<unsigned int> dbr(par.db1.c_str(), par.db1Index.c_str(), 1, | ||
DBReader<unsigned int>::USE_INDEX | DBReader<unsigned int>::USE_DATA); | ||
dbr.open(DBReader<unsigned int>::SORT_BY_LENGTH); | ||
DBWriter writer(par.db2.c_str(), par.db2Index.c_str(), 1, false, dbr.getDbtype()); | ||
writer.open(); | ||
std::string result; | ||
const int ALIGN = 4; | ||
for (long id = dbr.getSize() - 1; id >= 0; id--) { | ||
unsigned int key = dbr.getDbKey(id); | ||
char *data = dbr.getData(id, 0); | ||
size_t seqLen = dbr.getSeqLen(id); | ||
const size_t sequencepadding = (seqLen % ALIGN == 0) ? 0 : ALIGN - seqLen % ALIGN; | ||
result.append(data, seqLen); | ||
result.append(sequencepadding, ' '); | ||
writer.writeData(data, seqLen + sequencepadding, key, 0, false); | ||
} | ||
writer.close(true); | ||
DBReader<unsigned int>::softlinkDb(par.db1, par.db2, DBFiles::SEQUENCE_ANCILLARY); | ||
|
||
dbr.close(); | ||
return EXIT_SUCCESS; | ||
} |