);
54argdescr->AddDefaultKey
55(
"matrix",
"matrix",
"scoring matrix",
60 "the first input sequence in fasta file",
64 "the second input sequence in fasta file",
67argdescr->AddDefaultKey
69 "End-space free alignment. Format: lrLR where each character " 70 "can be z (free end) or x (regular end) representing " 71 "left and right ends. First sequence's ends are specified first.",
75argdescr->AddDefaultKey
77 "gap preference: earlier or later",
81argdescr->AddDefaultKey
82(
"Wm",
"match",
"match bonus (nucleotide sequences)",
86argdescr->AddDefaultKey
87(
"Wms",
"mismatch",
"mismatch penalty (nucleotide sequences)",
91argdescr->AddDefaultKey
92(
"Wg",
"gap",
"gap opening penalty",
96argdescr->AddDefaultKey
97(
"Ws",
"space",
"gap extension (space) penalty",
101argdescr->AddDefaultKey
102(
"band",
"band",
"Band width in banded alignment",
105argdescr->AddDefaultKey
106(
"shift",
"shift",
107 "Band shift in banded alignment " 108 "(specify negative value to indicate second sequence)",
111argdescr->AddFlag(
"sw",
112 "run local alignment (Smith-Waterman)");
114argdescr->AddFlag(
"mm",
115 "Use linear-memory alignment algorithm (Myers & Miller)");
117argdescr->AddFlag(
"mt",
"Use multiple threads");
120argdescr->AddOptionalKey
123argdescr->AddOptionalKey
126argdescr->AddOptionalKey
127(
"ofasta",
"ofasta",
128 "Generate gapped FastA output for the aligner sequences",
131argdescr->AddOptionalKey
135paa_st->
Allow(
"nucl")->
Allow(
"blosum62");
136argdescr->SetConstraint(
"matrix", paa_st);
143argdescr->SetConstraint(
"esf", paa_esf);
146paa_gp->
Allow(
"earlier")->
Allow(
"later");
147argdescr->SetConstraint(
"gp", paa_gp);
162unique_ptr<ofstream> pofs0 (
newofstream (filename.c_str()) );
169 "Cannot write to file"+ filename);
179 const boolbMM = args[
"mm"];
180 const boolbMT = args[
"mt"];
182 booloutput_type1 ( args[
"o1"] );
183 booloutput_type2 ( args[
"o2"] );
184 booloutput_asn ( args[
"oasn"] );
185 booloutput_fasta ( args[
"ofasta"] );
187 intband (args[
"band"].AsInteger());
188 intshift(args[
"shift"].AsInteger());
192eInconsistentParameters,
193 "Mutliple thread mode supported " 194 "for Myers-Miller method only (invoke with -mm)");
197 if(bMM && band >= 0) {
199eInconsistentParameters,
200 "-mm and -band are inconsistent with each other");
207 "This application was built without multithreading support. " 208 "To run in multiple threads, please re-configure and rebuild" 209 " with proper options.");
215vector<char> v1,
v2;
226pnwaligner =
new CMMAligner(&v1[0], v1.size(), &
v2[0],
v2.size(), psm);
229pnwaligner =
new CNWAligner(&v1[0], v1.size(), &
v2[0],
v2.size(), psm);
234 Uint1where = shift >= 0? 0: 1;
239unique_ptr<CNWAligner> aligner (pnwaligner);
242aligner->SetWm (args[
"Wm"]. AsInteger());
243aligner->SetWms (args[
"Wms"].AsInteger());
244aligner->SetScoreMatrix(
NULL);
246aligner->SetWg (args[
"Wg"]. AsInteger());
247aligner->SetWs (args[
"Ws"]. AsInteger());
249aligner->SetScoreMatrix(psm);
254pmma -> EnableMultipleThreads();
257unique_ptr<ofstream> pofs1;
258unique_ptr<ofstream> pofs2;
259unique_ptr<ofstream> pofsAsn;
260unique_ptr<ofstream> pofsFastA;
263pofs1.reset(
open_ofstream(args[
"o1"].AsString()).release());
267pofs2.reset(
open_ofstream(args[
"o2"].AsString()).release());
271pofsAsn.reset(
open_ofstream(args[
"oasn"].AsString()).release());
275pofsFastA.reset(
open_ofstream(args[
"ofasta"].AsString()).release());
279 stringends = args[
"esf"].AsString();
280 boolL1 = ends[0] ==
'z';
281 boolR1 = ends[1] ==
'z';
282 boolL2 = ends[2] ==
'z';
283 boolR2 = ends[3] ==
'z';
284aligner->SetEndSpaceFree(L1, R1, L2, R2);
287aligner->SetSmithWaterman(args[
"sw"]);
289 if( args[
"gp"].AsString() ==
"earlier") {
291}
else if(args[
"gp"].AsString() ==
"later") {
297 intscore = aligner->Run();
298cerr <<
"Score = "<< score << endl;
303 const size_tline_width = 100;
320 if(pofsFastA.get()) {
325 if(!output_type1 && !output_type2
326&& !output_asn && !output_fasta)
341vector<char>* sequence)
const 343vector<char>& vOut = *sequence;
346ifstream ifs(filename.c_str());
352 if(
str[0] ==
'>') {
368 copy(s.begin(), s.end(), back_inserter(vOut));
380 int main(
intargc,
const char* argv[])
virtual int Run()
Run the application.
CRef< objects::CSeq_id > x_ReadFastaFile(const string &filename, vector< char > *sequence) const
virtual void Exit()
Cleanup on application exit.
virtual void Init()
Initialize the application.
static const char * str(char *buf, int n)
void AsText(string *output, ETextFormatType type, size_t line_width=100) const
void SetSeqIds(CConstRef< objects::CSeq_id > id1, CConstRef< objects::CSeq_id > id2)
static TScore GetDefaultWg(void)
static TScore GetDefaultWms(void)
static TScore GetDefaultWs(void)
void SetShift(Uint1 where, size_t offset)
static TScore GetDefaultWm(void)
void HideStdArgs(THideStdArgs hide_mask)
Set the hide mask for the Hide Std Flags.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ fHideLogfile
Hide log file description.
@ fHideConffile
Hide configuration file description.
@ fHideVersion
Hide version description.
CArgAllow_Strings * Allow(const string &value)
Add allowed string values.
@ eString
An arbitrary string.
@ eInteger
Convertible into an integer number (int or Int8)
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Reset(void)
Reset reference object.
uint8_t Uint1
1-byte (8-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string & ToUpper(string &str)
Convert string to upper case â string& version.
#define GetProgramName
Avoid name clash with the NCBI C Toolkit.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
unique_ptr< ofstream > open_ofstream(const string &filename)
int main(int argc, const char *argv[])
const SNCBIPackedScoreMatrix NCBISM_Blosum62
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4