82 virtual void Init(
void);
83 virtual int Run(
void);
86 void View8(
int aln_pos);
87 void View9(
int row0,
int row1);
111 arg_desc->SetUsageContext
113 "Alignment manager demo program");
116 arg_desc->AddDefaultKey
118 "Name of file to read the Dense-seg from (standard input by default)",
121 arg_desc->AddDefaultKey
122 (
"b",
"bin_obj_type",
123 "This forced the input file to be read in binary ASN.1 mode\n"
124 "and specifies the type of the top-level ASN.1 object.\n",
127 arg_desc->AddOptionalKey
128 (
"se_in",
"SeqEntryInputFile",
129 "An optional Seq-entry file to load a local top level seq entry from.",
132 arg_desc->AddOptionalKey
134 "Name of log file to write to",
137 arg_desc->AddOptionalKey
139 "Anchor row (zero based)",
146 "2. Popset style using GetAlnSeqString\n"
147 " (memory efficient for large alns, but slower)\n"
148 "3. Popset style using GetSeqString\n"
149 " (memory inefficient)\n"
150 "4. Popset style using GetWholeAlnSeqString\n"
151 " (fastest, but memory inefficient)\n"
152 "5. Print segments\n"
154 "7. Alternative ways to get sequence\n"
155 "8. Demonstrate obtaining column vector in two alternative ways.\n"
156 " (Use numeric param n to choose alignment position)\n"
157 "9. Print relative residue index mapping for two rows.\n"
158 " (Use row0 and row1 params to choose the rows)\n"
159 "10. Iterate forward and backwards through alignment positions\n"
160 " and show corresponding native sequence positions for each row.\n"
161 "11. Clustal style\n",
164 arg_desc->AddDefaultKey
166 "Screen width for some of the viewers",
169 arg_desc->AddDefaultKey
171 "Generic Numeric Parameter, used by some viewers",
174 arg_desc->AddDefaultKey
176 "Generic Row Parameter, used by some viewers",
179 arg_desc->AddDefaultKey
181 "Generic Row Parameter, used by some viewers",
184 arg_desc->AddDefaultKey
185 (
"cf",
"GetChunkFlags",
186 "Flags for GetChunks (CAlnMap::TGetChunkFlags)",
206 string sname = args[
"in"].AsString();
209 string asn_type = args[
"b"].AsString();
210 bool binary = !asn_type.empty();
211 unique_ptr<CObjectIStream>
in
221 if ( args[
"se_in"] ) {
226 unique_ptr<CObjectIStream> se_in
229 se_asn_type = se_in->ReadFileHeader();
234 unique_ptr<CObjectIStream> se_in
237 if (se_asn_type ==
"Seq-entry") {
242 cerr <<
"se_in only accepts a Seq-entry asn text file.";
261 NcbiCout <<
"row " <<
row <<
", seg " << seg <<
" ";
292 rng.
Set(aln_pos, aln_pos);
313 vector<TSignedSeqPos>
result;
321 for (
size_t i = 0;
i <
size;
i++) {
331 vector<TSignedSeqPos> last_seq_pos(dim, -1);
333 for (
int reverse = 0; reverse < 2; ++reverse) {
345 }
else if (last_seq_pos[
row] >= 0) {
349 if (it.
GetSeqPos(
row) >= 0 && last_seq_pos[row2] >= 0) {
352 if (it.
GetSeqPos(row2) >= 0 && last_seq_pos[
row] >= 0) {
359 }
while (reverse ? --it : ++it);
380 int screen_width = args[
"w"].AsInteger();
381 int number = args[
"n"].AsInteger();
382 int row0 = args[
"row0"].AsInteger();
383 int row1 = args[
"row1"].AsInteger();
390 switch (args[
"v"].AsInteger()) {
410 printer.
Chunks(args[
"cf"].AsInteger());
440 int main(
int argc,
const char* argv[])
User-defined methods of the data storage class.
void LogTime(const string &s)
int main(int argc, const char *argv[])
Helper class for reading seq-align objects from a CObjectIStream.
void Read(CObjectIStream *obj_in_stream, TCallback callback, const string &top_level_asn_object=kEmptyStr)
Read all seq-align objects from the stream.
void Chunks(CAlnMap::TGetChunkFlags flags=CAlnMap::fAlnSegsOnly)
void CsvTable(char delim=',')
Printing methods.
TSignedSeqPos GetStop(TNumrow row, TNumseg seg, int offset=0) const
void GetResidueIndexMap(TNumrow row0, TNumrow row1, TRange aln_rng, vector< TSignedSeqPos > &result, TRange &rng0, TRange &rng1) const
TSignedSeqPos GetStart(TNumrow row, TNumseg seg, int offset=0) const
TSignedSeqPos GetAlnPosFromSeqPos(TNumrow row, TSeqPos seq_pos, ESearchDirection dir=eNone, bool try_reverse_dir=true) const
TSignedSeqPos GetSeqPosFromAlnPos(TNumrow for_row, TSeqPos aln_pos, ESearchDirection dir=eNone, bool try_reverse_dir=true) const
TDim GetNumRows(void) const
TSeqPos GetAlnStop(TNumseg seg) const
void SetAnchor(TNumrow anchor)
TSeqPos GetLen(TNumseg seg, int offset=0) const
CDense_seg::TNumseg TNumseg
TSeqPos GetAlnStart(TNumseg seg) const
TNumseg GetNumSegs(void) const
TSignedSeqPos GetSeqPosFromSeqPos(TNumrow for_row, TNumrow row, TSeqPos seq_pos, ESearchDirection dir=eNone, bool try_reverse_dir=true) const
TSignedSeqPos GetSeqPos(CAlnMap::TNumrow row) const
TSeqPos GetAlnPos(void) const
void PopsetStyle(int scrn_width=70, EAlgorithm algorithm=eUseAlnSeqString)
Printing methods.
@ eUseWholeAlnSeqString
memory efficient, recommended for large alns
@ eUseAlnSeqString
memory ineficient
void ClustalStyle(int scrn_width=50, EAlgorithm algorithm=eUseAlnSeqString)
string & GetSeqString(string &buffer, TNumrow row, TSeqPos seq_from, TSeqPos seq_to) const
void SetEndChar(TResidue gap_char)
void SetGapChar(TResidue gap_char)
string & GetColumnVector(string &buffer, TSeqPos aln_pos, TResidueCount *residue_count=0, bool gaps_in_count=false) const
string & GetAlnSeqString(string &buffer, TNumrow row, const CAlnMap::TSignedRange &aln_rng) const
TResidue GetResidue(TNumrow row, TSeqPos aln_pos) const
int CalculatePercentIdentity(TSeqPos aln_pos) const
string & GetSegSeqString(string &buffer, TNumrow row, TNumseg seg, TNumseg offset=0) const
virtual int Run(void)
Run the application.
virtual void Init(void)
Initialize the application.
CRef< CObjectManager > m_ObjMgr
bool AddAlnToMix(const CSeq_align *aln)
void View9(int row0, int row1)
void Validate(bool full_test=false) const
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
ESearchDirection
Position search options.
@ eRight
Towards higher aln coord (always to the right)
@ eLeft
Towards lower aln coord (always to the left)
static const char * column
unsigned int TSeqPos
Type for sequence locations and lengths.
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.
int TSignedSeqPos
Type for signed sequence position.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ fPreOpen
Open file right away; for eInputFile, eOutputFile, eIOFile.
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
TThisType & Set(position_type from, position_type to)
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
const TDenseg & GetDenseg(void) const
Get the variant data.
const TSegs & GetSegs(void) const
Get the Segs member data.
bool IsDenseg(void) const
Check if variant Denseg is selected.
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
Magic spell ;-) needed for some weird compilers... very empiric.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
std::istream & in(std::istream &in_, double &x_)
static pcre_uint8 * buffer
#define row(bind, expected)