ncbi::TMaskedQueryRegions
mask;
74 booladd_reference_dtdi =
false,
75 booladd_xml_versioni =
false);
91frame = (start - 1) % 3 + 1;
93frame = -((seq_length - end) % 3 + 1);
111 constncbi::TMaskedQueryRegions* mask_info,
112 intmaster_gentic_code,
intslave_genetic_code)
120 boolquery_is_na, subject_is_na;
121 intquery_length, subject_length;
123 intscore, num_ident;
127list<TGi> use_this_gi;
128CBlastFormatUtil::GetAlnScores(kAlign, score, bit_score, evalue, sum_n,
129num_ident, use_this_gi);
133sprintf(
tmp,
"%.*g", 6, bit_score );
134bit_score = atof(
tmp);
135sprintf(
tmp,
"%.*g", 6, evalue );
136evalue = atof(
tmp);
138xhsp->SetBit_score(bit_score);
139xhsp->SetScore(score);
140xhsp->SetEvalue(evalue);
146query_is_na = kQueryBioseqHandle.
IsNa();
150subject_is_na = kSubjBioseqHandle.
IsNa();
156xhsp->SetQuery_from(0);
157xhsp->SetQuery_to(0);
158xhsp->SetHit_from(0);
160xhsp->SetIdentity(num_ident);
164xhsp_list.push_back(xhsp);
178 if(query_is_na && subject_is_na)
181final_aln = densegAln;
199 stringmasked_query_seq;
206 const boolkIsBlastn =
207(query_is_na && subject_is_na && !kTranslated);
218reversed_ds->
Assign(kDenseg);
220ds_pt = &(*reversed_ds);
223 intq_start, q_end, s_start, s_end, q_frame=0, s_frame=0;
225 unsigned intnum_gaps = 0;
226 intalign_length = 0;
249 if(!kTranslated && query_is_na && subject_is_na) {
250q_frame = s_frame = 1;
259}
else if(kTranslated) {
265q_start, q_end, query_length);
268s_start, s_end, subject_length);
271xhsp->SetQuery_frame(q_frame);
272xhsp->SetHit_frame(s_frame);
274xhsp->SetQuery_from(q_start);
275xhsp->SetQuery_to(q_end);
276xhsp->SetHit_from(s_start);
277xhsp->SetHit_to(s_end);
306 intnum_positives = 0;
307middle_seq = query_seq;
313 const unsigned intkMaxOffset =
static_cast<unsigned int>(
min(query_seq.size(),
314subject_seq.size()));
315 for(
unsigned int i= 0;
i< kMaxOffset; ++
i) {
316 if(query_seq[
i] == subject_seq[
i]) {
320middle_seq[
i] =
'|';
322(*matrix)(query_seq[
i], subject_seq[
i]) > 0 &&
325middle_seq[
i] = kIsBlastn ?
' ':
'+';
327middle_seq[
i] =
' ';
331xhsp->SetIdentity(num_ident);
332xhsp->SetGaps(num_gaps);
333xhsp->SetAlign_len(align_length);
336xhsp->SetQseq(masked_query_seq);
338xhsp->SetQseq(query_seq);
339xhsp->SetHseq(subject_seq);
340xhsp->SetMidline(middle_seq);
341xhsp->SetPositive(num_positives);
344xhsp_list.push_back(xhsp);
359 constncbi::TMaskedQueryRegions* mask_info,
360 boolungapped,
intmaster_gentice_code,
intslave_genetic_code)
366 if(kAlignSet.
Get().empty())
372 const CSeq_id& kSeqId = kAlignSet.
Get().front()->GetSeq_id(1);
378list<TGi> use_this_gi;
387defline =
"No definition line";
390hit->SetDef(defline);
396hit->SetAccession(accession);
405hit->SetDef(
"Unknown");
406hit->SetAccession(
"Unknown");
420matrix, mask_info, master_gentice_code, slave_genetic_code);
423mask_info, master_gentice_code, slave_genetic_code);
455 constncbi::TMaskedQueryRegions* mask_info,
456 boolungapped,
intmaster_gentice_code,
intslave_genetic_code,
460 if(alnset.
Get().empty())
463CSeq_align_set::Tdata::const_iterator iter = alnset.
Get().begin();
466 boolincremental_output = (
bool)out_stream;
467 while(iter != alnset.
Get().end()) {
474 if((*iter)->GetSegs().IsDisc()) {
476ungapped, master_gentice_code, slave_genetic_code);
481 for( ; iter != alnset.
Get().end(); ++iter) {
483 if(!current_id->
Match(*next_id)) {
486one_subject_alnset.
Set().push_back(*iter);
489disc_align_wrap.
SetSegs().SetDisc(one_subject_alnset);
491mask_info, ungapped, master_gentice_code, slave_genetic_code);
495new_hit->SetNum(index);
497 if( !incremental_output ) hits.push_back(new_hit);
503xml_one_hit_os->SetReferenceDTD(
false);
504xml_one_hit_os->Write( &(*new_hit), new_hit->GetThisTypeInfo() );
507string::size_type start_xml_pos = out_str.find(
"<?xml");
508 if( start_xml_pos != string::npos ) {
509string::size_type end_xml_pos = out_str.find_first_of(
"\n\r");
510out_str.erase(0,end_xml_pos+1);
512*out_stream << out_str ;
535 constncbi::TMaskedQueryRegions* mask_info,
536 intindex,
intiteration,
CStatistics& stat,
boolis_ungapped,
537 intmaster_gentice_code,
intslave_genetic_code,
538 constvector<string>& messages,
541 boolincremental_output = (
bool) out_stream;
542list<CRef<CIteration> >& iterations = bxmlout.
SetIterations();
546one_query_iter->SetIter_num(iteration);
557one_query_iter->SetQuery_ID(
559query_def = sequence::CDeflineGenerator().GenerateDefline(bh);
565query_def =
"No definition line";
566one_query_iter->SetQuery_def(query_def);
569one_query_iter->SetStat(stat);
570 if(messages.size() > 0 && !messages[index].empty())
571one_query_iter->SetMessage(messages[index]);
573 stringserial_xml_start, serial_xml_end;
574 if( incremental_output) {
577serial_xml_start, serial_xml_end);
578*out_stream << serial_xml_start <<
"\n<Iteration_hits>\n";
584scope, matrix, mask_info, is_ungapped,
585master_gentice_code, slave_genetic_code,
589 if( incremental_output ) *out_stream <<
"</Iteration_hits>"<< serial_xml_end;
591iterations.push_back(one_query_iter);
602 stringmatrix_name =
data->GetMatrixName();
610 if((
val=
data->GetMatchReward()) != 0)
613 if((
val=
data->GetMismatchPenalty()) != 0)
632 intdb_numseq =
data->GetDbNumSeqs();
633 Int8db_length =
data->GetDbLength();
635 for(
unsigned intindex = 0; index <
data->GetNumQueries(); ++index) {
644stat_vec.push_back(stat);
681 boolincremental_output = (
bool)out_stream;
682 stringprogram_name =
data->GetBlastProgramName();
687bxmlout.
SetDb(
data->GetDatabaseName());
705query_def = sequence::CDeflineGenerator().GenerateDefline(bh);
711query_def =
"No definition line";
719unique_ptr< CBlastFormattingMatrix > matrix(
data->GetMatrix());
721vector<CRef<CStatistics> > stat_vec;
724 stringserial_xml_start, serial_xml_end;
725 if( incremental_output && incremental_struct->
m_IterationNum== 0) {
726 booladd_dtd_reference =
true, add_xml_version =
true;
728serial_xml_start, serial_xml_end,
729add_dtd_reference, add_xml_version );
731*out_stream << serial_xml_start <<
"\n<BlastOutput_iterations>";
732incremental_struct->
m_SerialXmlEnd=
"\n</BlastOutput_iterations>"+ serial_xml_end;
735 for(
unsigned intindex = 0; index <
data->GetNumQueries(); ++index) {
743 if(incremental_struct)
749 data->GetScope(index), matrix.get(),
750 data->GetMaskLocations(index),
752*stat_vec[index], !
data->GetGappedMode(),
753 data->GetMasterGeneticCode(),
data->GetSlaveGeneticCode(),
754 data->GetMessages(),
758 ERR_POST(
Error<<
"Failed s_BlastXMLAddIteration "<< query_label << e.
what() );
762 ERR_POST(
Error<<
"Failed s_BlastXMLAddIteration "<< query_label );
775 booladd_reference_dtd,
776 booladd_xml_version )
778 boolres_code =
false;
779 TTypeInfotypeInfo =
object.GetThisTypeInfo();
780 stringbreake_by_tag =
tag;
781start_part=
"<NOT SET>";
782end_part=
"</NOT SET>";
788xml_one_iter_os->SetReferenceDTD(add_reference_dtd);
789xml_one_iter_os->SetDefaultDTDFilePrefix(
"http://www.ncbi.nlm.nih.gov/dtd/");
790 if( add_xml_version )
791xml_one_iter_os->Write(&
object, typeInfo );
793xml_one_iter_os->WriteObject(&
object, typeInfo );
796string::size_type iterations_insert_point = out_str.find( breake_by_tag );
797 if( iterations_insert_point != string::npos ){
798iterations_insert_point += breake_by_tag.length();
799start_part = out_str.substr(0,iterations_insert_point);
800end_part = out_str.substr(iterations_insert_point);
804start_part = out_str;
User-defined methods of the data storage class.
Declares singleton objects to store the version and reference for the BLAST engine.
BLAST formatter utilities.
Formatting of pairwise sequence alignments in XML form.
Declares class to display one-line descriptions at the top of the BLAST report.
EProgram
This enumeration is to evolve into a task/program specific list that specifies sets of default parame...
@ ePHIBlastn
Nucleotide PHI BLAST.
@ ePHIBlastp
Protein PHI BLAST.
@ eMapper
Jumper alignment for mapping.
@ eMegablast
Nucl-Nucl (traditional megablast)
@ eDeltaBlast
Delta Blast.
static void s_SeqAlignSetToXMLHits(list< CRef< CHit > > &hits, const CSeq_align_set &alnset, CScope *scope, const CBlastFormattingMatrix *matrix, const ncbi::TMaskedQueryRegions *mask_info, bool ungapped, int master_gentice_code, int slave_genetic_code, CNcbiOstream *out_stream)
Fills the list of CHit objects, given a list of Seq-aligns.
static void s_BlastXMLGetStatistics(vector< CRef< CStatistics > > &stat_vec, const IBlastXMLReportData *data)
Fills the search statistics part of the BLAST XML output for all queries.
static void s_SetBlastXMLParameters(CBlastOutput &bxmlout, const IBlastXMLReportData *data)
Fills the parameters part of the BLAST XML output.
void BlastXML_FormatReport(CBlastOutput &bxmlout, const IBlastXMLReportData *data, CNcbiOstream *out_stream, SBlastXMLIncremental *incremental_struct)
Fills all fields in the data structure for a BLAST XML report.
static void s_SeqAlignToXMLHit(CRef< CHit > &hit, const CSeq_align &align_in, CScope *scope, const CBlastFormattingMatrix *matrix, const ncbi::TMaskedQueryRegions *mask_info, bool ungapped, int master_gentice_code, int slave_genetic_code)
Fill the CHit object in BLAST XML output, given an alignment and other information.
static int s_GetTranslationFrame(bool plus_strand, int start, int end, int seq_length)
Returns translation frame given the strand, alignment endpoints and total sequence length.
static CReference::EPublication s_GetBlastPublication(EProgram program)
Given BLAST task, returns enumerated value for the publication to be referenced.
static void s_SeqAlignSetToXMLHsps(list< CRef< CHsp > > &xhsp_list, const CSeq_align_set &alnset, CScope *scope, const CBlastFormattingMatrix *matrix, const ncbi::TMaskedQueryRegions *mask_info, int master_gentic_code, int slave_genetic_code)
Creates a list of CHsp structures for the XML output, given a list of Seq-aligns.
static const CSeq_id * s_GetSubjectId(const CSeq_align &align)
Retrieves subject Seq-id from a Seq-align.
ncbi::TMaskedQueryRegions mask
static bool s_SerializeAndSplitBy(const CSerialObject &object, const char *tag, string &start_part, string &end_part, bool add_reference_dtdi=false, bool add_xml_versioni=false)
serialize givem object and split data by provided XML tag for futher manual integrationa
static void s_BlastXMLAddIteration(CBlastOutput &bxmlout, const CSeq_align_set *alnset, const CSeq_loc &seqloc, CScope *scope, const CBlastFormattingMatrix *matrix, const ncbi::TMaskedQueryRegions *mask_info, int index, int iteration, CStatistics &stat, bool is_ungapped, int master_gentice_code, int slave_genetic_code, const vector< string > &messages, CNcbiOstream *out_stream)
Add an "iteration" to the BLAST XML report, corresponding to all alignments for a single query.
static string GetLabel(CConstRef< objects::CSeq_id > id, bool with_version=false)
Return a label for an ID Tries to recreate behavior of GetLabel before a change that prepends "ti|" t...
256x256 matrix used for calculating positives etc.
void Reverse(void)
Reverse the segments' orientation.
void Assign(const CSerialObject &obj, ESerialRecursionMode how=eRecursive)
overloaded Assign()
static CRef< objects::CSeq_align_set > PrepareBlastUngappedSeqalign(const objects::CSeq_align_set &alnset)
static functions Need to call this if the seqalign is stdseg or dendiag for ungapped blast alignment ...
SeqLocCharOption
character used to display seqloc, such as masked sequence
A generalized representation of a pairwise alignment.
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
CRef< CSeq_align > CreateTranslatedDensegFromNADenseg(void) const
Create a Dense-seg with widths from Dense-seg of nucleotides Used by AlnMgr to handle translated nucl...
CRef< CSeq_align > CreateDensegFromStdseg(SSeqIdChooser *SeqIdChooser=0) const
---------------------------------------------------------------------------- PRE : the Seq-align has ...
TSeqPos GetTotalGapCount(TDim row=-1) const
Retrieves the total number of gaps in the given row an alignment; all gaps by default.
TSeqPos GetSeqStop(TDim row) const
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
TSeqPos GetSeqStart(TDim row) const
ENa_strand GetSeqStrand(TDim row) const
Get strand (the first one if segments have different strands).
TSeqPos GetAlignLength(bool include_gaps=true) const
Get the length of this alignment.
Base class for all serializable objects.
static void GetBioseqHandleDeflineAndId(const objects::CBioseq_Handle &handle, list< TGi > &use_this_gi, string &seqid, string &defline, bool show_gi=true, TGi this_gi_first=INVALID_GI)
Returns sequence id and a BLAST defline as strings, given a Bioseq handle and a list of gis.
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Interface for filling the top layer of the XML report.
string GetSeqIdString(const CSeq_id &id)
static const char * str(char *buf, int n)
static string GetString(EPublication pub)
Reference for requested publication.
EPublication
Enumerates the various BLAST publications.
@ eMaxPublications
Used as sentinel value.
@ ePhiBlast
1998 NAR paper
@ eCompBasedStats
2001 NAR paper
@ eGappedBlast
1997 NAR paper
@ eMegaBlast
2000 J Compt Biol paper
@ eDeltaBlast
2012 Biology Direct on DeltaBLAST
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
@ eNoOwnership
No ownership is assumed.
int m_IterationNum
ctor sets to true, set to false for first chunk.
string m_SerialXmlEnd
tag to be printed at end.
static void GetWholeAlnSeqStrings(string &query, string &subject, const objects::CDense_seg &ds, objects::CScope &scope, int master_gen_code, int slave_gen_code)
static string BlastGetVersion(const string program)
Returns the version and release date, e.g.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
@ eSerialVerifyData_No
do not verify
const string AsFastaString(void) const
CConstRef< CSeq_id > GetSeqId(void) const
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
TSeqPos GetBioseqLength(void) const
void Reset(void)
Reset reference object.
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.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
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.
void SetLambda(TLambda value)
Assign a value to Lambda data member.
void SetExpect(TExpect value)
Assign a value to Expect data member.
void SetGap_open(TGap_open value)
Assign a value to Gap_open data member.
void SetEntropy(TEntropy value)
Assign a value to Entropy data member.
void SetDb_num(TDb_num value)
Assign a value to Db_num data member.
void SetQuery_len(TQuery_len value)
Assign a value to Query_len data member.
void SetHsp_len(THsp_len value)
Assign a value to Hsp_len data member.
void SetSc_match(TSc_match value)
Assign a value to Sc_match data member.
void SetMatrix(const TMatrix &value)
Assign a value to Matrix data member.
void SetProgram(const TProgram &value)
Assign a value to Program data member.
void SetGap_extend(TGap_extend value)
Assign a value to Gap_extend data member.
void SetQuery_ID(const TQuery_ID &value)
Assign a value to Query_ID data member.
void SetVersion(const TVersion &value)
Assign a value to Version data member.
void SetKappa(TKappa value)
Assign a value to Kappa data member.
void SetFilter(const TFilter &value)
Assign a value to Filter data member.
TIterations & SetIterations(void)
Assign a value to Iterations data member.
void SetSc_mismatch(TSc_mismatch value)
Assign a value to Sc_mismatch data member.
void SetDb(const TDb &value)
Assign a value to Db data member.
void SetQuery_def(const TQuery_def &value)
Assign a value to Query_def data member.
void SetParam(TParam &value)
Assign a value to Param data member.
void SetPattern(const TPattern &value)
Assign a value to Pattern data member.
void SetReference(const TReference &value)
Assign a value to Reference data member.
void SetDb_len(TDb_len value)
Assign a value to Db_len data member.
void SetEff_space(TEff_space value)
Assign a value to Eff_space data member.
const TDenseg & GetDenseg(void) const
Get the variant data.
Tdata & Set(void)
Assign a value to data member.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
bool IsDendiag(void) const
Check if variant Dendiag is selected.
const TStd & GetStd(void) const
Get the variant data.
const TDendiag & GetDendiag(void) const
Get the variant data.
bool IsStd(void) const
Check if variant Std is selected.
bool IsDisc(void) const
Check if variant Disc is selected.
const TIds & GetIds(void) const
Get the Ids member data.
list< CRef< CSeq_align > > Tdata
const TDisc & GetDisc(void) const
Get the variant data.
const TStrands & GetStrands(void) const
Get the Strands member data.
const Tdata & Get(void) const
Get the member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
bool IsDenseg(void) const
Check if variant Denseg is selected.
static CRef< CSeq_align > CreateDensegFromDendiag(CSeq_align const &aln)
Structure to hold data for incremental XML formatting.
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