frame = (start - 1) % 3 + 1;
81frame = -((seq_length - end) % 3 + 1);
99 constncbi::TMaskedQueryRegions & mask_info,
100 intmaster_gentic_code,
intslave_genetic_code)
108 boolquery_is_na, subject_is_na;
109 intquery_length, subject_length;
111 intscore, num_ident;
115list<TGi> use_this_gi;
116CBlastFormatUtil::GetAlnScores(kAlign, score, bit_score, evalue, sum_n,
117num_ident, use_this_gi);
121sprintf(
tmp,
"%.*g", 6, bit_score );
122bit_score = atof(
tmp);
123sprintf(
tmp,
"%.*g", 6, evalue );
124evalue = atof(
tmp);
126xhsp->SetBit_score(bit_score);
127xhsp->SetScore(score);
128xhsp->SetEvalue(evalue);
134query_is_na = kQueryBioseqHandle.
IsNa();
138subject_is_na = kSubjBioseqHandle.
IsNa();
144xhsp->SetQuery_from(0);
145xhsp->SetQuery_to(0);
146xhsp->SetHit_from(0);
148xhsp->SetIdentity(num_ident);
152xhsp_list.push_back(xhsp);
166 if(query_is_na && subject_is_na)
169final_aln = densegAln;
187 stringmasked_query_seq;
194 const boolkIsBlastn =
195(query_is_na && subject_is_na && !kTranslated);
206reversed_ds->
Assign(kDenseg);
208ds_pt = &(*reversed_ds);
211 intq_start, q_end, s_start, s_end, q_frame=0, s_frame=0;
213 unsigned intnum_gaps = 0;
214 intalign_length = 0;
237 if(!kTranslated && query_is_na && subject_is_na) {
238xhsp->SetQuery_strand(
"Plus");
239xhsp->SetHit_strand(
"Plus");
241xhsp->SetHit_strand(
"Minus");
247}
else if(kTranslated) {
253q_start, q_end, query_length);
254xhsp->SetQuery_frame(q_frame);
258s_start, s_end, subject_length);
259xhsp->SetHit_frame(s_frame);
263xhsp->SetQuery_from(q_start);
264xhsp->SetQuery_to(q_end);
265xhsp->SetHit_from(s_start);
266xhsp->SetHit_to(s_end);
268 if(mask_info.empty())
293 intnum_positives = 0;
294middle_seq = query_seq;
300 const unsigned intkMaxOffset =
min(query_seq.size(),
302 for(
unsigned int i= 0;
i< kMaxOffset; ++
i) {
303 if(query_seq[
i] == subject_seq[
i]) {
307middle_seq[
i] =
'|';
309(*matrix)(query_seq[
i], subject_seq[
i]) > 0 &&
312middle_seq[
i] = kIsBlastn ?
' ':
'+';
314middle_seq[
i] =
' ';
318xhsp->SetIdentity(num_ident);
319xhsp->SetGaps(num_gaps);
320xhsp->SetAlign_len(align_length);
322 if(mask_info.empty())
323xhsp->SetQseq(query_seq);
325xhsp->SetQseq(masked_query_seq);
326xhsp->SetHseq(subject_seq);
327xhsp->SetMidline(middle_seq);
328 if(!(query_is_na && subject_is_na && !kTranslated) )
329xhsp->SetPositive(num_positives);
331xhsp_list.push_back(xhsp);
350 constncbi::TMaskedQueryRegions & mask_info,
351 boolungapped,
intmaster_gentice_code,
352 intslave_genetic_code,
boolhasTaxDB)
357 const CSeq_id& kSeqId = kAlignSet.
Get().front()->GetSeq_id(1);
363list <CRef<blastxml2::CHitDescr> > & descr_list = hit->SetDescription();
365 if(bdlRef.
NotEmpty() && bdlRef->
IsSet() && (!bdlRef->
Get().empty())) {
375hit_exp->SetAccession(accession);
378hit_exp->SetTitle(defline.
GetTitle());
382hit_exp->SetTaxid(tax_id);
389descr_list.push_back(hit_exp);
394list<CRef<objects::CSeq_id> > ids;
402hit_exp->SetAccession(accession);
405hit_exp->SetTitle(sequence::CDeflineGenerator().GenerateDefline(subj_handle));
406descr_list.push_back(hit_exp);
415hit->SetDescription().push_back(hit_exp);
429matrix, mask_info, master_gentice_code, slave_genetic_code);
432mask_info, master_gentice_code, slave_genetic_code);
465CSeq_align_set::Tdata::const_iterator iter = alnset->Get().begin();
469 constncbi::TMaskedQueryRegions & mask_info =
data->GetMaskLocations();
470 boolungapped = !(
data->IsGappedSearch());
471 intmaster_gentice_code =
data->GetQueryGeneticCode();
472 intslave_genetic_code =
data->GetDbGeneticCode();
473 boolhasTaxDB =
data->CanGetTaxInfo();
476 while(iter != alnset->Get().end()) {
478new_hit->SetNum(index);
485 if((*iter)->GetSegs().IsDisc()) {
487ungapped, master_gentice_code, slave_genetic_code, hasTaxDB);
492 for( ; iter != alnset->Get().end(); ++iter) {
494 if(!current_id->
Match(*next_id)) {
497one_subject_alnset.
Set().push_back(*iter);
500disc_align_wrap.
SetSegs().SetDisc(one_subject_alnset);
502mask_info, ungapped, master_gentice_code, slave_genetic_code, hasTaxDB);
505hits.push_back(new_hit);
517 stringmatrix_name =
data->GetMatrixName();
519params.SetMatrix(matrix_name);
521params.SetExpect(
data->GetEvalueThreshold());
525 if((
val=
data->GetMatchReward()) != 0)
526params.SetSc_match(
val);
528 if((
val=
data->GetMismatchPenalty()) != 0)
529params.SetSc_mismatch(
val);
531 if(
data->IsGappedSearch()) {
532params.SetGap_open(
data->GetGapOpeningCost());
533params.SetGap_extend(
data->GetGapExtensionCost());
536params.SetPattern(
str);
539params.SetFilter(
str);
542params.SetBl2seq_mode(
str);
544 if((
val=
data->GetCompositionBasedStats()) != 0)
545params.SetCbs(
val);
548params.SetEntrez_query(
str);
550 if((
val=
data->GetQueryGeneticCode()) != 0)
551params.SetQuery_gencode(
val);
553 if((
val=
data->GetDbGeneticCode()) != 0)
554params.SetDb_gencode(
val);
565 if(!
data->IsBl2seq()) {
566 stats.SetDb_num(
data->GetDbNumSeqs());
570 stats.SetHsp_len(
data->GetLengthAdjustment(num));
571 stats.SetEff_space(
data->GetEffectiveSearchSpace(num));
573 stats.SetLambda(
data->GetLambda(num));
574 stats.SetEntropy(
data->GetEntropy(num));
583 const CSeq_id* q_id = q_loc->GetId();
590 stringq_title = sequence::CDeflineGenerator().GenerateDefline(bh);
592search.SetQuery_title(q_title);
599 if(!
data->GetMaskLocations().empty()) {
600list<CRef< blastxml2::CRange> > & masks = search.SetQuery_masking();
609masks.push_back(rng);
613blastxml2::CStatistics &
stats= search.SetStat();
616 string msg=
data->GetMessages(num);
618 if(
data->GetAlignmentSet(num).Empty()) {
620 msg+= CBlastFormatUtil::kNoHitsFound;
621search.SetMessage(
msg);
626search.SetMessage(
msg);
628list<CRef<blastxml2::CHit> > & hit_list = search.SetHits();
662blastxml2::CReport & report = bxmlout.SetReport();
663 stringprogram_name =
data->GetBlastProgramName();
664report.SetProgram(program_name);
668 if(!
data->GetSubjectIds().empty()) {
669report.SetSearch_target().SetSubjects() =
data->GetSubjectIds();
672report.SetSearch_target().SetDb(
data->GetDatabaseName());
675blastxml2::CParameters & params = report.SetParams();
678blastxml2::CResults &
results= report.SetResults();
679 if(
data->IsBl2seq()) {
680list<CRef<blastxml2::CSearch> > & bl2seq =
results.SetBl2seq();
681 for(
int i=0;
i<
data->GetNumOfSearchResults();
i++ ) {
684bl2seq.push_back(search);
688 else if(
data->IsIterativeSearch()) {
689list<CRef<blastxml2::CIteration> > & iterations =
results.SetIterations();
690 for(
int i=0;
i<
data->GetNumOfSearchResults();
i++ ) {
692itr->SetIter_num(
i+1);
693blastxml2::CSearch & search = itr->SetSearch();
695iterations.push_back(itr);
699blastxml2::CSearch & search =
results.SetSearch();
719 TTypeInfotypeInfo = bxmlout.GetThisTypeInfo();
723xml_out->SetEnforcedStdXml();
724xml_out->Write(&bxmlout, typeInfo );
731 TTypeInfotypeInfo = bxmlout.GetThisTypeInfo();
736xml_out->SetReferenceSchema();
737xml_out->SetUseSchemaLocation(
true);
738xml_out->SetEnforcedStdXml();
739xml_out->SetDTDFilePrefix(
"http://www.ncbi.nlm.nih.gov/data_specs/schema_alt/");
740xml_out->SetDefaultSchemaNamespace(
"http://www.ncbi.nlm.nih.gov");
741xml_out->Write(&bxmlout, typeInfo );
752blastxml2::CBlastOutput2 bxmlout;
770blastxml2::CBlastOutput2 bxmlout;
773 if(!out_stream.is_open())
787xml_out->SetReferenceSchema();
788xml_out->SetUseSchemaLocation(
true);
789xml_out->SetEnforcedStdXml();
790xml_out->SetDTDFilePrefix(
"http://www.ncbi.nlm.nih.gov/data_specs/schema_alt/");
791xml_out->SetDefaultSchemaNamespace(
"http://www.ncbi.nlm.nih.gov");
793blastxml2::CBlastXML2 xml2;
794 TTypeInfotypeInfo = xml2.GetThisTypeInfo();
795xml_out->Write(&xml2, typeInfo);
798string::size_type end_pos = out_str.find(
"</BlastXML2>");
799out_str.erase(end_pos);
801*out_stream << out_str;
808blastxml2::CBlastOutput2 bxmlout;
809bxmlout.SetError().SetCode(exit_code);
811bxmlout.SetError().SetMessage(err_msg);
836*out_stream <<
"{\n\"BlastOutput2\": [\n";
842 TTypeInfotypeInfo = bxmlout.GetThisTypeInfo();
847json_out->Write(&bxmlout, typeInfo );
854 TTypeInfotypeInfo = bxmlout.GetThisTypeInfo();
859json_out->Write(&bxmlout, typeInfo );
866blastxml2::CBlastOutput2 bxmlout;
869 if(!out_stream.is_open())
879blastxml2::CBlastOutput2 bxmlout;
User-defined methods of the data storage class.
Declares singleton objects to store the version and reference for the BLAST engine.
BLAST formatter utilities.
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.
@ eMegablast
Nucl-Nucl (traditional megablast)
@ eDeltaBlast
Delta Blast.
static void s_WriteXML2ObjectNoHeader(blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
static void s_SetBlastXMLSearch(blastxml2::CSearch &search, const IBlastXML2ReportData *data, int num)
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.
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.
static void s_FillBlastOutput(blastxml2::CBlastOutput2 &bxmlout, const IBlastXML2ReportData *data)
static void s_WriteJSONObjectNoHeader(blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
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_WriteJSONObject(blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
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.
static void s_SetBlastXMLParameters(blastxml2::CParameters ¶ms, const IBlastXML2ReportData *data)
Fills the parameters part of the BLAST XML output.
static const CSeq_id * s_GetSubjectId(const CSeq_align &align)
Retrieves subject Seq-id from a Seq-align.
static void s_WriteXML2Object(blastxml2::CBlastOutput2 &bxmlout, CNcbiOstream *out_stream)
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.
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.
virtual void WriteFileHeader(TTypeInfo type)
virtual ~CBlastOStreamJson(void)
virtual void EndOfWrite(void)
CBlastOStreamJson(CNcbiOstream &stream, EOwnership deleteOut)
CBlastOStreamXml(CNcbiOstream &stream, EOwnership deleteOut)
virtual ~CBlastOStreamXml(void)
virtual void WriteFileHeader(TTypeInfo type)
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
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
static void GetTaxInfo(TTaxId taxid, SSeqDBTaxInfo &info)
Get taxonomy information.
static CRef< CBlast_def_line_set > ExtractBlastDefline(const CBioseq &bioseq)
Extract a Blast-def-line-set object from a Bioseq retrieved by CSeqDB.
objects::ENa_strand GetStrand() const
Convert the frame to a strand.
const objects::CSeq_interval & GetInterval() const
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.
static void GetSeqIdList(const objects::CBioseq_Handle &bh, list< CRef< objects::CSeq_id > > &ids)
Converts a Bioseq handle's sequence id type into a list of objects::CSeq_id references,...
static string GetSeqIdListString(const list< CRef< objects::CSeq_id > > &id, bool show_gi)
Creates a '|' delimited string, corresponding to a list of Seq-ids.
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.
Collection of masked regions for a single query sequence.
string GetSeqIdString(const CSeq_id &id)
std::ofstream out("events_result.xml")
main entry point for tests
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.
SStrictId_Tax::TId TTaxId
Taxon id type.
@ eNoOwnership
No ownership is assumed.
void BlastXML2_FormatError(int exit_code, string err_msg, CNcbiOstream *out_stream)
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.
void BlastXML2_FormatReport(const IBlastXML2ReportData *data, CNcbiOstream *out_stream)
Fills all fields in the data structure for a BLAST XML report.
void BlastJSON_FormatReport(const IBlastXML2ReportData *data, string file_name)
void BlastXML2_PrintHeader(CNcbiOstream *out_stream)
void BlastJSON_PrintHeader(CNcbiOstream *out_stream)
#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.
const string & GetMsg(void) const
Get 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.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
static int Score(const CRef< CSeq_id > &id)
Wrappers for use with FindBestChoice from <corelib/ncbiutil.hpp>
virtual void EndOfWrite(void)
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
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.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty â pointing to an object and has a non-null value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void IncIndentLevel(size_t step=2)
void PutEol(bool indent=true)
void DecIndentLevel(size_t step=2)
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
enum ENcbiOwnership EOwnership
Ownership relations between objects.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
const TSeqid & GetSeqid(void) const
Get the Seqid member data.
bool IsSetTitle(void) const
simple title Check if a value has been assigned to Title data member.
TTaxid GetTaxid(void) const
Get the Taxid member data.
bool IsSet(void) const
Check if a value has been assigned to data member.
bool IsSetTaxid(void) const
Check if a value has been assigned to Taxid data member.
const Tdata & Get(void) const
Get the member data.
const TTitle & GetTitle(void) const
Get the Title member data.
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.
bool IsLocal(void) const
Check if variant Local is selected.
static CRef< CSeq_align > CreateDensegFromDendiag(CSeq_align const &aln)
Defines BLAST database access classes.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
string scientific_name
Scientific name, such as "Aotus vociferans".
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