NCBI C++ ToolKit
Classes | Functions
blastxml2_format.cpp File Reference

Formatting of BLAST results in XML2 form, using the BLAST XML2 specification. More...

#include <ncbi_pch.hpp>
#include <objmgr/object_manager.hpp>
#include <objects/seqloc/Seq_interval.hpp>
#include <objmgr/util/sequence.hpp>
#include <objects/seqloc/Seq_id.hpp>
#include <objects/seqalign/Dense_diag.hpp>
#include <objects/seqalign/Dense_seg.hpp>
#include <objects/seqalign/Std_seg.hpp>
#include <algo/blast/format/blastxml2_format.hpp>
#include <algo/blast/format/blastfmtutil.hpp>
#include <objtools/align_format/showdefline.hpp>
#include <objtools/align_format/align_format_util.hpp>
#include <objtools/blast/seqdb_reader/seqdb.hpp>
#include <objects/blastxml2/blastxml2__.hpp>
#include <serial/objostrxml.hpp>
#include <serial/objostrjson.hpp>
#include <algo/blast/api/version.hpp>
#include <sstream>
#include <algorithm>
+ Include dependency graph for blastxml2_format.cpp:

Go to the source code of this file.

Go to the SVN repository for this file.

Classes

class  CBlastOStreamXml
 
class  CBlastOStreamJson
 

Functions

 USING_SCOPE (objects)
 
 USING_SCOPE (blast)
 
 USING_SCOPE (align_format)
 
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. More...
 
static void s_SeqAlignSetToXMLHsps (list< CRef< blastxml2::CHsp > > &xhsp_list, const CSeq_align_set &alnset, CRef< CScope > scope, const CBlastFormattingMatrix *matrix, const ncbi::TMaskedQueryRegions &mask_info, int master_gentic_code, int slave_genetic_code)
 Creates a list of blastxml2::CHsp structures for the XML output, given a list of Seq-aligns. More...
 
static void s_SeqAlignToXMLHit (CRef< blastxml2::CHit > &hit, const CSeq_align &align_in, CRef< CScope > scope, const CBlastFormattingMatrix *matrix, const ncbi::TMaskedQueryRegions &mask_info, bool ungapped, int master_gentice_code, int slave_genetic_code, bool hasTaxDB)
 Fill the blastxml2::CHit object in BLAST XML output, given an alignment and other information. More...
 
static const CSeq_ids_GetSubjectId (const CSeq_align &align)
 Retrieves subject Seq-id from a Seq-align. More...
 
static void s_SetBlastXMlHitList (list< CRef< blastxml2::CHit > > &hits, const IBlastXML2ReportData *data, int num)
 Fills the list of blastxml2::CHit objects, given a list of Seq-aligns. More...
 
static void s_SetBlastXMLParameters (blastxml2::CParameters &params, const IBlastXML2ReportData *data)
 Fills the parameters part of the BLAST XML output. More...
 
static void s_SetBlastXMLStatistics (blastxml2::CStatistics &stats, const IBlastXML2ReportData *data, int num)
 Fills the search statistics part of the BLAST XML output for all queries. More...
 
static void s_SetBlastXMLSearch (blastxml2::CSearch &search, const IBlastXML2ReportData *data, int num)
 
static CReference::EPublication s_GetBlastPublication (EProgram program)
 Given BLAST task, returns enumerated value for the publication to be referenced. More...
 
static void s_FillBlastOutput (blastxml2::CBlastOutput2 &bxmlout, const IBlastXML2ReportData *data)
 
static void s_WriteXML2ObjectNoHeader (blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
 
static void s_WriteXML2Object (blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
 
void BlastXML2_FormatReport (const IBlastXML2ReportData *data, CNcbiOstream *out_stream)
 Fills all fields in the data structure for a BLAST XML report. More...
 
void BlastXML2_FormatReport (const IBlastXML2ReportData *data, string file_name)
 
void BlastXML2_PrintHeader (CNcbiOstream *out_stream)
 
void BlastXML2_FormatError (int exit_code, string err_msg, CNcbiOstream *out_stream)
 
void BlastJSON_PrintHeader (CNcbiOstream *out_stream)
 
static void s_WriteJSONObjectNoHeader (blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
 
static void s_WriteJSONObject (blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
 
void BlastJSON_FormatReport (const IBlastXML2ReportData *data, string file_name)
 
void BlastJSON_FormatReport (const IBlastXML2ReportData *data, CNcbiOstream *out_stream)
 

Detailed Description

Formatting of BLAST results in XML2 form, using the BLAST XML2 specification.

Definition in file blastxml2_format.cpp.

Function Documentation

◆ s_FillBlastOutput()

static void s_FillBlastOutput ( blastxml2::CBlastOutput2 &  bxmlout,
const IBlastXML2ReportData data 
)
static

◆ s_GetBlastPublication()

static CReference::EPublication s_GetBlastPublication ( EProgram  program)
static

Given BLAST task, returns enumerated value for the publication to be referenced.

Parameters
programBLAST task [in]
Returns
What publication to reference?

Definition at line 637 of file blastxml2_format.cpp.

References CReference::eCompBasedStats, eDeltaBlast, CReference::eDeltaBlast, CReference::eGappedBlast, CReference::eMaxPublications, eMegablast, CReference::eMegaBlast, CReference::ePhiBlast, ePHIBlastn, ePHIBlastp, and ePSIBlast.

Referenced by s_FillBlastOutput().

◆ s_GetSubjectId()

static const CSeq_id* s_GetSubjectId ( const CSeq_align align)
static

◆ s_GetTranslationFrame()

static int s_GetTranslationFrame ( bool  plus_strand,
int  start,
int  end,
int  seq_length 
)
static

Returns translation frame given the strand, alignment endpoints and total sequence length.

Parameters
plus_strandIs this position on a forward strand? [in]
startStarting position, in 1-offset coordinates. [in]
endEnding position in 1-offset coordinates [in]
seq_lengthTotal length of sequence [in]
Returns
Frame number.

Definition at line 74 of file blastxml2_format.cpp.

Referenced by s_SeqAlignSetToXMLHsps().

◆ s_SeqAlignSetToXMLHsps()

static void s_SeqAlignSetToXMLHsps ( list< CRef< blastxml2::CHsp > > &  xhsp_list,
const CSeq_align_set alnset,
CRef< CScope scope,
const CBlastFormattingMatrix matrix,
const ncbi::TMaskedQueryRegions &  mask_info,
int  master_gentic_code,
int  slave_genetic_code 
)
static

◆ s_SeqAlignToXMLHit()

static void s_SeqAlignToXMLHit ( CRef< blastxml2::CHit > &  hit,
const CSeq_align align_in,
CRef< CScope scope,
const CBlastFormattingMatrix matrix,
const ncbi::TMaskedQueryRegions &  mask_info,
bool  ungapped,
int  master_gentice_code,
int  slave_genetic_code,
bool  hasTaxDB 
)
static

Fill the blastxml2::CHit object in BLAST XML output, given an alignment and other information.

Parameters
hitblastxml2::CHit object to fill [in] [out]
align_inSequence alignment [in]
scopeScope for retrieving sequences [in]
matrixASCII-alphabet matrix for calculation of positives [in]
mask_infoList of masking locations [in]
ungappedIs this an ungapped search? [in]
master_genetic_codequery genetic code [in]
slave_genetic_codesubject genetic code [in]
hasTaxDBHave access to taxonomy file [in]

Definition at line 347 of file blastxml2_format.cpp.

References _ASSERT, CSeq_id::AsFastaString(), CSeqDB::ExtractBlastDefline(), FindBestChoice(), CBlast_def_line_set_Base::Get(), CSeq_align_set_Base::Get(), CScope::GetBioseqHandle(), CBioseq_Handle::GetBioseqLength(), CSeq_align_Base::C_Segs::GetDisc(), CSeq_id_Handle::GetHandle(), CAlignFormatUtil::GetLabel(), GetLength(), CSeq_align_Base::GetSegs(), CBlast_def_line_Base::GetSeqid(), CSeq_id_Handle::GetSeqId(), CShowBlastDefline::GetSeqIdList(), CShowBlastDefline::GetSeqIdListString(), CBlast_def_line_Base::GetTaxid(), CSeqDB::GetTaxInfo(), CBlast_def_line_Base::GetTitle(), CSeq_align_Base::C_Segs::IsDisc(), CSeq_id_Base::IsLocal(), CBlast_def_line_set_Base::IsSet(), CBlast_def_line_Base::IsSetTaxid(), CBlast_def_line_Base::IsSetTitle(), ITERATE, kEmptyStr, CRef< C, Locker >::NotEmpty(), CDisplaySeqalign::PrepareBlastUngappedSeqalign(), s_SeqAlignSetToXMLHsps(), SSeqDBTaxInfo::scientific_name, CSeq_id::Score(), and ZERO_TAX_ID.

Referenced by s_SetBlastXMlHitList().

◆ s_SetBlastXMlHitList()

static void s_SetBlastXMlHitList ( list< CRef< blastxml2::CHit > > &  hits,
const IBlastXML2ReportData data,
int  num 
)
static

Fills the list of blastxml2::CHit objects, given a list of Seq-aligns.

Parameters
hitsList of blastxml2::CHit objects to fill [in] [out]

Definition at line 460 of file blastxml2_format.cpp.

References data, CSeq_id::Match(), s_GetSubjectId(), s_SeqAlignToXMLHit(), CSeq_align_set_Base::Set(), and CSeq_align_Base::SetSegs().

Referenced by s_SetBlastXMLSearch().

◆ s_SetBlastXMLParameters()

static void s_SetBlastXMLParameters ( blastxml2::CParameters &  params,
const IBlastXML2ReportData data 
)
static

Fills the parameters part of the BLAST XML output.

Parameters
bxmloutBLAST XML output object [in] [out]
dataData structure, from which all necessary information can be retrieved [in]

Definition at line 515 of file blastxml2_format.cpp.

References data, NcbiEmptyString, str(), and val.

Referenced by s_FillBlastOutput().

◆ s_SetBlastXMLSearch()

static void s_SetBlastXMLSearch ( blastxml2::CSearch &  search,
const IBlastXML2ReportData data,
int  num 
)
static

◆ s_SetBlastXMLStatistics()

static void s_SetBlastXMLStatistics ( blastxml2::CStatistics &  stats,
const IBlastXML2ReportData data,
int  num 
)
static

Fills the search statistics part of the BLAST XML output for all queries.

Parameters
stat_vecVector of the blastxml2::CStatics objects, to be filled. [in] [out]
dataData structure, from which all necessary information can be retrieved [in]

Definition at line 562 of file blastxml2_format.cpp.

References data, and stats.

Referenced by s_SetBlastXMLSearch().

◆ s_WriteJSONObject()

static void s_WriteJSONObject ( blastxml2::CBlastOutput2 &  bxmlout,
CNcbiOstream out_stream 
)
static

Definition at line 852 of file blastxml2_format.cpp.

References eEncoding_Ascii, and eNoOwnership.

Referenced by BlastJSON_FormatReport().

◆ s_WriteJSONObjectNoHeader()

static void s_WriteJSONObjectNoHeader ( blastxml2::CBlastOutput2 &  bxmlout,
CNcbiOstream out_stream 
)
static

Definition at line 840 of file blastxml2_format.cpp.

References eEncoding_Ascii, and eNoOwnership.

Referenced by BlastJSON_FormatReport().

◆ s_WriteXML2Object()

static void s_WriteXML2Object ( blastxml2::CBlastOutput2 &  bxmlout,
CNcbiOstream out_stream 
)
static

◆ s_WriteXML2ObjectNoHeader()

static void s_WriteXML2ObjectNoHeader ( blastxml2::CBlastOutput2 &  bxmlout,
CNcbiOstream out_stream 
)
static

Definition at line 717 of file blastxml2_format.cpp.

References eEncoding_Ascii, eNoOwnership, and eSerialVerifyData_No.

Referenced by BlastXML2_FormatReport().

◆ USING_SCOPE() [1/3]

USING_SCOPE ( align_format  )

◆ USING_SCOPE() [2/3]

USING_SCOPE ( blast  )

◆ USING_SCOPE() [3/3]

USING_SCOPE ( objects  )
Modified on Wed May 01 14:25:35 2024 by modify_doxy.py rev. 669887