NCBI C++ ToolKit
|
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>
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_id * | s_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 ¶ms, 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) |
Formatting of BLAST results in XML2 form, using the BLAST XML2 specification.
Definition in file blastxml2_format.cpp.
|
static |
Definition at line 656 of file blastxml2_format.cpp.
References CBlastFormatUtil::BlastGetVersion(), data, eUnknown, CReference::GetString(), i, NCBI_THROW, NULL, s_GetBlastPublication(), s_SetBlastXMLParameters(), and s_SetBlastXMLSearch().
Referenced by BlastJSON_FormatReport(), and BlastXML2_FormatReport().
|
static |
Given BLAST task, returns enumerated value for the publication to be referenced.
program | BLAST task [in] |
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().
|
static |
Retrieves subject Seq-id from a Seq-align.
align | Seq-align object [in] |
Definition at line 440 of file blastxml2_format.cpp.
References CSeq_align_Base::C_Segs::GetDendiag(), CSeq_align_Base::C_Segs::GetDenseg(), CDense_seg_Base::GetIds(), CSeq_align_Base::GetSegs(), CSeq_align_Base::C_Segs::GetStd(), CSeq_align_Base::C_Segs::IsDendiag(), CSeq_align_Base::C_Segs::IsDenseg(), CSeq_align_Base::C_Segs::IsStd(), and NULL.
Referenced by s_SetBlastXMlHitList().
Returns translation frame given the strand, alignment endpoints and total sequence length.
plus_strand | Is this position on a forward strand? [in] |
start | Starting position, in 1-offset coordinates. [in] |
end | Ending position in 1-offset coordinates [in] |
seq_length | Total length of sequence [in] |
Definition at line 74 of file blastxml2_format.cpp.
Referenced by s_SeqAlignSetToXMLHsps().
|
static |
Creates a list of blastxml2::CHsp structures for the XML output, given a list of Seq-aligns.
xhsp_list | List of blastxml2::CHsp's to populate [in] [out] |
alnset | Set of alignments to get data from [in] |
scope | Scope for retrieving sequences [in] |
matrix | 256x256 matrix for calculating positives for a protein search. NULL is passed for a nucleotide search. |
mask_info | Masking locations [in] |
Definition at line 96 of file blastxml2_format.cpp.
References CDense_seg::Assign(), CreateDensegFromDendiag(), CSeq_align::CreateDensegFromStdseg(), CSeq_align::CreateTranslatedDensegFromNADenseg(), CDisplaySeqalign::eLowerCase, eNa_strand_minus, CSeq_align_set_Base::Get(), CSeq_align::GetAlignLength(), CScope::GetBioseqHandle(), CBioseq_Handle::GetBioseqLength(), CSeq_align_Base::C_Segs::GetDenseg(), CSeq_align_Base::GetSegs(), CSeq_align::GetSeq_id(), CSeq_align::GetSeqStart(), CSeq_align::GetSeqStop(), CSeq_align::GetSeqStrand(), CDense_seg_Base::GetStrands(), CSeq_align::GetTotalGapCount(), CBlastFormatUtil::GetWholeAlnSeqStrings(), i, CSeq_align_Base::C_Segs::IsDendiag(), CBioseq_Handle::IsNa(), CDense_seg_Base::IsSetStrands(), CSeq_align_Base::C_Segs::IsStd(), ITERATE, min(), NcbiEmptyString, CRef< C, Locker >::Reset(), CDense_seg::Reverse(), s_GetTranslationFrame(), and tmp.
Referenced by s_SeqAlignToXMLHit().
|
static |
Fill the blastxml2::CHit object in BLAST XML output, given an alignment and other information.
hit | blastxml2::CHit object to fill [in] [out] |
align_in | Sequence alignment [in] |
scope | Scope for retrieving sequences [in] |
matrix | ASCII-alphabet matrix for calculation of positives [in] |
mask_info | List of masking locations [in] |
ungapped | Is this an ungapped search? [in] |
master_genetic_code | query genetic code [in] |
slave_genetic_code | subject genetic code [in] |
hasTaxDB | Have 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().
|
static |
Fills the list of blastxml2::CHit objects, given a list of Seq-aligns.
hits | List 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().
|
static |
Fills the parameters part of the BLAST XML output.
bxmlout | BLAST XML output object [in] [out] |
data | Data 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().
|
static |
Definition at line 579 of file blastxml2_format.cpp.
References CSeq_id::AsFastaString(), data, eNa_strand_minus, CBioseq_Handle::GetBioseqCore(), CScope::GetBioseqHandle(), CSeqLocInfo::GetInterval(), GetLength(), GetSeqIdString(), CSeqLocInfo::GetStrand(), ITERATE, kEmptyStr, s_SetBlastXMlHitList(), s_SetBlastXMLStatistics(), and stats.
Referenced by s_FillBlastOutput().
|
static |
Fills the search statistics part of the BLAST XML output for all queries.
stat_vec | Vector of the blastxml2::CStatics objects, to be filled. [in] [out] |
data | Data structure, from which all necessary information can be retrieved [in] |
Definition at line 562 of file blastxml2_format.cpp.
Referenced by s_SetBlastXMLSearch().
|
static |
Definition at line 852 of file blastxml2_format.cpp.
References eEncoding_Ascii, and eNoOwnership.
Referenced by BlastJSON_FormatReport().
|
static |
Definition at line 840 of file blastxml2_format.cpp.
References eEncoding_Ascii, and eNoOwnership.
Referenced by BlastJSON_FormatReport().
|
static |
Definition at line 729 of file blastxml2_format.cpp.
References eEncoding_Ascii, eNoOwnership, and eSerialVerifyData_No.
Referenced by BlastXML2_FormatError(), and BlastXML2_FormatReport().
|
static |
Definition at line 717 of file blastxml2_format.cpp.
References eEncoding_Ascii, eNoOwnership, and eSerialVerifyData_No.
Referenced by BlastXML2_FormatReport().
USING_SCOPE | ( | align_format | ) |
USING_SCOPE | ( | blast | ) |
USING_SCOPE | ( | objects | ) |