: m_Out(
out), m_FmtSpec(format_spec), m_BlastDb(blastdb), m_GetDefline(
false), m_OtherFields(0)
87 "Invalid format specification");
256os <<
"Unrecognized format specification: '%"<<
m_ReplTypes[
i] <<
"'";
285 if(
config.m_SeqRange.NotEmpty()) {
298 if(
config.m_FiltAlgoId >= 0) {
301 if(!masks.
empty()) {
333 if(df_set.
Empty()) {
344 x_Print(oid, defline_data, other_fields);
350 x_Print(oid, defline_data, other_fields);
355 x_Print(oid, defline_data, other_fields);
364 static const stringkStandardSeparator(
" >");
365 const string kSeparator(use_ctrl_a ?
"\001": kStandardSeparator);
370 for(
autotoken : tokens) {
377 const stringkPossibleId(token, 0, pos !=
NPOS? pos : token.length());
384 if(!seqids.empty()) {
390retval += kStandardSeparator + token;
404 stringold_title = (*desc)->GetTitle();
419: m_BlastDb(blastdb), m_Out(
out), m_fasta(
out), m_UseLongSeqIds(useLongSeqId)
430 mask->SetInt().SetFrom(itr->first);
431 mask->SetInt().SetTo(itr->second-1);
453 if(bioseq.
Empty()) {
463 if(
config.m_FiltAlgoId != -1) {
466 if(!masks.
empty()) {
480 if(
config.m_SeqRange.NotEmpty()) {
491 if(
config.m_UseCtrlA) {
495 if(range.
Empty()) {
507 if(range.
Empty()) {
522 m_Out<< fasta_deflines;
524 if(range.
Empty()) {
549: m_BlastDb(blastdb), m_Out(
out)
561 boolsimpler =
false;
563 if(id_type ==
eGiId) {
573 if(bioseq.
Empty()) {
594 return a+
b.size();
ncbi::TMaskedQueryRegions mask
void DumpAll(const CBlastDB_FormatterConfig &config)
CBlastDB_BioseqFormatter(CSeqDB &blastdb, CNcbiOstream &out)
Constructor.
int Write(CSeqDB::TOID oid, const CBlastDB_FormatterConfig &config, string target_id=kEmptyStr)
Retun 0 if Sucess otherwise -1.
CSeqDB & m_BlastDb
The BLAST database from which to extract data.
void DumpAll(const CBlastDB_FormatterConfig &config)
CSeqDB & m_BlastDb
The BLAST database from which to extract data.
int Write(CSeqDB::TOID oid, const CBlastDB_FormatterConfig &config, string target_id=kEmptyStr)
Retun 0 if Sucess otherwise -1.
CBlastDB_FastaFormatter(CSeqDB &blastdb, CNcbiOstream &out, TSeqPos width=80, bool useLongSeqId=false)
Constructor.
void x_GetSeq(CSeqDB::TOID oid, const CBlastDB_FormatterConfig &config, string &seq)
CNcbiOstream & m_Out
Stream to write output.
vector< char > m_ReplTypes
Vector of convertor objects.
string m_FmtSpec
The output format specification.
int Write(CSeqDB::TOID oid, const CBlastDB_FormatterConfig &config, string target_id=kEmptyStr)
unsigned int m_OtherFields
Bit Mask for other fields.
CBlastDeflineUtil::BlastDeflineFields m_DeflineFields
vector< string > m_Seperators
Vector of offsets where the replacements will take place.
CBlastDB_SeqFormatter(const string &fmt_spec, CSeqDB &blastdb, CNcbiOstream &out)
Constructor.
CSeqDB & m_BlastDb
The BLAST database from which to extract data.
string x_GetSeqMask(CSeqDB::TOID oid, int algo_id)
string x_GetSeqHash(CSeqDB::TOID oid)
void x_Print(CSeqDB::TOID oid, vector< string > &defline_data, vector< string > &other_fields)
Build data for write.
void DumpAll(const CBlastDB_FormatterConfig &config)
@ leaf_node_scientific_names
static void ExtractDataFromBlastDeflineSet(const CBlast_def_line_set &dl_set, vector< string > &results, BlastDeflineFields fields, string target_id, bool use_long_id)
static void ProcessFastaDeflines(CBioseq &bioseq, string &out, bool use_ctrla)
static void ExtractDataFromBlastDefline(const CBlast_def_line &dl, vector< string > &results, BlastDeflineFields fields, bool use_long_id)
static void ApplySeqMask(string &seq, const CSeqDB::TSequenceRanges &masks, const TSeqRange r=TSeqRange::GetEmpty())
static Uint4 GetSeqHash(const char *buffer, int length)
static string GetMasksString(const CSeqDB::TSequenceRanges &masks)
static void GetReverseStrandSeq(string &seq)
Defines invalid user input exceptions.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
int TOID
Sequence type accepted and returned for OID indices.
void GetSequenceAsString(int oid, CSeqUtil::ECoding coding, string &output, TSeqRange range=TSeqRange()) const
Get a sequence in a given encoding.
int GetSeqLength(int oid) const
Returns the sequence length in base pairs or residues.
CRef< CBioseq > GetBioseq(int oid, TGi target_gi=ZERO_GI, const CSeq_id *target_seq_id=NULL) const
Get a CBioseq for a sequence.
bool CheckOrFindOID(int &next_oid) const
Find an included OID, incrementing next_oid if necessary.
CRef< CBlast_def_line_set > GetHdr(int oid) const
Get the ASN.1 header for the sequence.
void GetMaskData(int oid, const vector< int > &algo_ids, TSequenceRanges &ranges)
Get masked ranges of a sequence.
std::ofstream out("events_result.xml")
main entry point for tests
#define GI_FROM(T, value)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define MSerial_AsnText
I/O stream manipulators â.
static SIZE_TYPE ParseIDs(CBioseq::TId &ids, const CTempString &s, TParseFlags flags=fParse_Default)
Parse a string representing one or more Seq-ids, appending the results to IDS.
static int BestRank(const CRef< CSeq_id > &id)
@ fParse_PartialOK
Warn rather than throwing an exception when a FASTA-style ID set contains unparsable portions,...
@ fParse_Default
By default in ParseIDs and IsValid, allow raw parsable non-numeric accessions and plausible local acc...
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
void SetMask(EMaskType type, CConstRef< CSeq_loc > location)
virtual void Write(const CSeq_entry_Handle &handle, const CSeq_loc *location=0)
Unspecified locations designate complete sequences; non-empty custom titles override the usual title ...
void SetWidth(TSeqPos width)
virtual void WriteSequence(const CBioseq_Handle &handle, const CSeq_loc *location=0, CSeq_loc::EOpFlags merge_flags=CSeq_loc::fMerge_AbuttingOnly)
void SetFlag(EFlags flag)
void SetAllFlags(TFlags flags)
void ResetFlag(EFlags flag)
@ fNoExpensiveOps
don't try too hard to find titles
@ fKeepGTSigns
don't convert '>' to '_' in title
@ fEnableGI
Use this flag to enable GI output in the defline.
@ fReverseStrand
flip the (implicit) location
@ eSoftMask
write as lowercase rather than uppercase
CBioseq_Handle AddBioseq(CBioseq &bioseq, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add bioseq, return bioseq handle.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool Empty(void) const THROWS_NONE
Check if CRef is empty â not pointing to any object, which means having a null value.
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
NCBI_NS_STD::string::size_type SIZE_TYPE
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ fSplit_ByPattern
Require full delimiter strings.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
const Tdata & Get(void) const
Get the member data.
list< CRef< CBlast_def_line > > Tdata
list< CRef< CSeqdesc > > Tdata
const TId & GetId(void) const
Get the Id member data.
list< CRef< CSeq_id > > TId
void SetDescr(TDescr &value)
Assign a value to Descr data member.
@ e_Title
a title for this sequence
static void hex(unsigned char c)
constexpr bool empty(list< Ts... >) noexcept
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static void s_ReplaceCtrlAsInTitle(CBioseq &bioseq)
static void s_GetMaskSeqLoc(const CSeqDB::TSequenceRanges &mask_ranges, CSeq_loc &seq_loc)
static string s_RejoinDeflineTitle(const string &title, bool use_ctrl_a)
Auxiliary function to format the defline by rejoining multiple deflines using standard or <CNTRL>-A.
static void s_GetSeqMask(CSeqDB &db, CSeqDB::TOID oid, int algo_id, CSeqDB::TSequenceRanges &masks)
static const string kNoMask
Definition of a blastdb formatter interfaces.
ESeqDBIdType SeqDB_SimplifySeqid(CSeq_id &bestid, const string *acc, Int8 &num_id, string &str_id, bool &simpler)
Seq-id simplification.
ESeqDBIdType
Various identifier formats used in Id lookup.
Configuration object for CBlastDB_Formatter classes.
unsigned int leaf_node_tax_ids
unsigned int leaf_node_tax_names
List of sequence offset ranges.
Auxiliary functor to compute the length of a string (shamlessly copied from seq_writer....
SIZE_TYPE operator()(SIZE_TYPE a, const string &b) const
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