NCBI C++ ToolKit
|
#include <ncbi_pch.hpp>
#include <corelib/ncbiapp.hpp>
#include <algo/blast/api/magicblast.hpp>
#include <algo/blast/api/remote_blast.hpp>
#include <algo/blast/api/magicblast_options.hpp>
#include <algo/blast/blastinput/blast_fasta_input.hpp>
#include <algo/blast/blastinput/blast_asn1_input.hpp>
#include <algo/blast/blast_sra_input/blast_sra_input.hpp>
#include <algo/blast/blastinput/magicblast_args.hpp>
#include <algo/blast/api/objmgr_query_data.hpp>
#include <algo/blast/format/blast_format.hpp>
#include "../blast/blast_app_util.hpp"
#include <objtools/format/sam_formatter.hpp>
#include <algo/blast/api/objmgrfree_query_data.hpp>
#include <objects/seqset/Seq_entry.hpp>
#include <objects/seqalign/Spliced_seg.hpp>
#include <objects/seqalign/Spliced_exon.hpp>
#include <objects/seqalign/Spliced_exon_chunk.hpp>
#include <objects/seqalign/Product_pos.hpp>
#include <objects/seqalign/Splice_site.hpp>
#include <objects/general/User_field.hpp>
#include <objects/general/User_object.hpp>
#include <objects/general/Dbtag.hpp>
#include <objects/seqres/Byte_graph.hpp>
#include <algo/blast/core/blast_nalookup.h>
#include <algo/blast/api/blast_seqinfosrc_aux.hpp>
#include <algo/sequence/consensus_splice.hpp>
#include <util/sequtil/sequtil_manip.hpp>
#include <util/sequtil/sequtil_convert.hpp>
#include "magicblast_util.hpp"
#include <unordered_set>
#include <unordered_map>
#include <memory>
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | hash_seqid |
struct | eq_seqid |
Macros | |
#define | SAM_FLAG_MULTI_SEGMENTS 0x1 |
#define | SAM_FLAG_SEGS_ALIGNED 0x2 |
#define | SAM_FLAG_SEG_UNMAPPED 0x4 |
#define | SAM_FLAG_NEXT_SEG_UNMAPPED 0x8 |
#define | SAM_FLAG_SEQ_REVCOMP 0x10 |
#define | SAM_FLAG_NEXT_REVCOMP 0x20 |
#define | SAM_FLAG_FIRST_SEGMENT 0x40 |
#define | SAM_FLAG_LAST_SEGMENT 0x80 |
#define | SAM_FLAG_SECONDARY 0x100 |
Typedefs | |
typedef unordered_map< string, CRef< CSeq_entry > > | TQueryMap |
typedef unordered_set< const CSeq_id *, hash_seqid, eq_seqid > | TSeq_idHashSet |
#define SAM_FLAG_FIRST_SEGMENT 0x40 |
Definition at line 1003 of file magicblast_util.cpp.
#define SAM_FLAG_LAST_SEGMENT 0x80 |
Definition at line 1004 of file magicblast_util.cpp.
#define SAM_FLAG_MULTI_SEGMENTS 0x1 |
Definition at line 997 of file magicblast_util.cpp.
#define SAM_FLAG_NEXT_REVCOMP 0x20 |
Definition at line 1002 of file magicblast_util.cpp.
#define SAM_FLAG_NEXT_SEG_UNMAPPED 0x8 |
Definition at line 1000 of file magicblast_util.cpp.
#define SAM_FLAG_SECONDARY 0x100 |
Definition at line 1005 of file magicblast_util.cpp.
#define SAM_FLAG_SEG_UNMAPPED 0x4 |
Definition at line 999 of file magicblast_util.cpp.
#define SAM_FLAG_SEGS_ALIGNED 0x2 |
Definition at line 998 of file magicblast_util.cpp.
#define SAM_FLAG_SEQ_REVCOMP 0x10 |
Definition at line 1001 of file magicblast_util.cpp.
typedef unordered_map<string, CRef<CSeq_entry> > TQueryMap |
Definition at line 80 of file magicblast_util.cpp.
typedef unordered_set<const CSeq_id*, hash_seqid, eq_seqid> TSeq_idHashSet |
Definition at line 918 of file magicblast_util.cpp.
CNcbiOstream& PrintASN1 | ( | CNcbiOstream & | ostr, |
const CBioseq_set & | query_batch, | ||
CSeq_align_set & | aligns | ||
) |
Definition at line 1696 of file magicblast_util.cpp.
References CSeq_id_Base::e_Local, CSeq_align_Base::C_Segs::e_Spliced, CSeq_descr_Base::Get(), CBioseq_Base::GetDescr(), CBioseq_Base::IsSetDescr(), MSerial_AsnText, CRef< C, Locker >::NotEmpty(), CRef< C, Locker >::Reset(), s_CreateQueryMap(), s_GetQueryBioseq(), CSeq_align_set_Base::Set(), and NStr::Split().
Referenced by CMagicBlastThread::Main().
|
static |
Definition at line 344 of file magicblast_util.cpp.
References compile_time_bits::range(), results, s_GetFastaDefline(), s_GetQueryBioseq(), s_GetQuerySequence(), and CSeq_id::Set().
Referenced by PrintUnaligned().
|
static |
Definition at line 1606 of file magicblast_util.cpp.
References eFwdRev, CMagicBlastResults::eFwRevFirst, eRevFwd, CMagicBlastResults::eRevFwFirst, CMagicBlastResults::fUnaligned, PrintSAM(), PrintUnaligned(), and results.
CNcbiOstream& PrintSAM | ( | CNcbiOstream & | ostr, |
CNcbiOstream & | unaligned_ostr, | ||
CFormattingArgs::EOutputFormat | unaligned_fmt, | ||
const CMagicBlastResultSet & | results, | ||
const CBioseq_set & | query_batch, | ||
const BlastQueryInfo * | query_info, | ||
bool | is_spliced, | ||
int | batch_number, | ||
bool | trim_read_id, | ||
bool | print_unaligned, | ||
bool | no_discordant, | ||
E_StrandSpecificity | strand_specific, | ||
bool | only_specific, | ||
bool | print_md_tag, | ||
const string & | user_tag | ||
) |
Definition at line 1666 of file magicblast_util.cpp.
References PrintSAM(), results, and s_CreateQueryMap().
|
static |
Definition at line 1008 of file magicblast_util.cpp.
References _ASSERT, abs, context, BlastQueryInfo::contexts, CSeq_align_Base::C_Segs::e_Denseg, CSpliced_exon_chunk_Base::e_Genomic_ins, CSpliced_exon_chunk_Base::e_Match, CSpliced_exon_chunk_Base::e_Mismatch, CSpliced_exon_chunk_Base::e_Product_ins, CSeq_align_Base::C_Segs::e_Spliced, eFwdRev, eNa_strand_minus, eNa_strand_plus, NStr::EndsWith(), eNonSpecific, eRevFwd, CSeq_align::eScore_Score, fFirstSegmentFlag, CSeq_align::FindExt(), first(), fLastSegmentFlag, fPartialFlag, CSeq_align_set_Base::Get(), CUser_object_Base::GetData(), CSeq_align_Base::C_Segs::GetDenseg(), CSeq_align_Base::C_Segs::GetDisc(), CSpliced_seg_Base::GetExons(), CRange_Base::GetFrom(), CDense_seg_Base::GetLens(), CSeq_align::GetNamedScore(), CSpliced_seg_Base::GetProduct_length(), CSeq_align_Base::GetSegs(), CSeq_align::GetSeq_id(), CSeq_align::GetSeqRange(), CSeq_align::GetSeqStart(), CSeq_align::GetSeqStrand(), CSeq_align_Base::C_Segs::GetSpliced(), CDense_seg_Base::GetStarts(), CRange_Base::GetTo(), COpenRange< Position >::GetToOpen(), i, int, NStr::IntToString(), CSeq_align_Base::C_Segs::IsDisc(), ITERATE, log10(), MAGICBLAST_MAX_INSERT_SIZE_NONSPLICED, MAGICBLAST_MAX_INSERT_SIZE_SPLICED, CSeq_id::Match(), MIN, NCBI_THROW, CConstRef< C, Locker >::NotEmpty(), r(), compile_time_bits::range(), s_GetBareId(), s_GetQualityString(), s_GetQueryBioseq(), s_GetQuerySequence(), s_GetSequenceId(), s_GetSpliceSiteOrientation(), SAM_FLAG_FIRST_SEGMENT, SAM_FLAG_LAST_SEGMENT, SAM_FLAG_MULTI_SEGMENTS, SAM_FLAG_NEXT_REVCOMP, SAM_FLAG_NEXT_SEG_UNMAPPED, SAM_FLAG_SECONDARY, SAM_FLAG_SEGS_ALIGNED, SAM_FLAG_SEQ_REVCOMP, BlastContextInfo::segment_flags, NStr::Split(), NStr::StringToInt(), and CSeq_align_Base::C_Segs::Which().
Referenced by CMagicBlastThread::Main(), and PrintSAM().
CNcbiOstream& PrintSAMHeader | ( | CNcbiOstream & | ostr, |
CRef< CLocalDbAdapter > | db_adapter, | ||
const string & | cmd_line_args | ||
) |
Definition at line 848 of file magicblast_util.cpp.
References _ASSERT, BLAST_SEQSRC_EOF, CSeq_id::BlastRank(), BlastSeqSrcIteratorFree(), BlastSeqSrcIteratorNew(), BlastSeqSrcIteratorNext(), BlastSeqSrcResetChunkIterator(), CLocalDbAdapter::GetSearchDatabase(), CSearchDatabase::GetSeqDb(), GetSequenceLengthAndId(), CSeqDB::GetTaxIDs(), CLocalDbAdapter::IsBlastDb(), CLocalDbAdapter::MakeSeqInfoSrc(), CLocalDbAdapter::MakeSeqSrc(), CRef< C, Locker >::NotEmpty(), CRef< C, Locker >::Reset(), and s_GetBareId().
Referenced by CMagicBlastApp::Run().
|
static |
Definition at line 1507 of file magicblast_util.cpp.
References NStr::EndsWith(), CMagicBlastResults::fFiltered, flags, info, compile_time_bits::range(), results, s_GetQualityString(), s_GetQueryBioseq(), s_GetQuerySequence(), s_GetSequenceId(), SAM_FLAG_FIRST_SEGMENT, SAM_FLAG_LAST_SEGMENT, SAM_FLAG_MULTI_SEGMENTS, SAM_FLAG_NEXT_SEG_UNMAPPED, SAM_FLAG_SEG_UNMAPPED, and CSeq_id::Set().
Referenced by PrintUnaligned().
|
static |
Definition at line 776 of file magicblast_util.cpp.
References CMagicBlastResults::fUnaligned, PrintTabular(), PrintUnaligned(), and results.
CNcbiOstream& PrintTabular | ( | CNcbiOstream & | ostr, |
CNcbiOstream & | unaligned_ostr, | ||
CFormattingArgs::EOutputFormat | unaligned_fmt, | ||
const CMagicBlastResultSet & | results, | ||
const CBioseq_set & | query_batch, | ||
bool | is_paired, | ||
int | batch_number, | ||
bool | trim_read_id, | ||
bool | print_unaligned, | ||
bool | no_discordant, | ||
const string & | user_tag | ||
) |
Definition at line 823 of file magicblast_util.cpp.
References PrintTabular(), results, and s_CreateQueryMap().
|
static |
Definition at line 441 of file magicblast_util.cpp.
References _ASSERT, eNa_strand_minus, CSeq_align::eScore_PercentIdentity_Gapped, CSeq_align::eScore_Score, CSeq_align::FindExt(), first(), CSeq_align_set_Base::Get(), CUser_object_Base::GetData(), CSeq_align_Base::C_Segs::GetDisc(), CBioseq_Base::GetInst(), CSeq_inst_Base::GetLength(), CSeq_align::GetNamedScore(), CSpliced_seg_Base::GetProduct_length(), CSeq_align_Base::GetSegs(), CSeq_align::GetSeq_id(), CSeq_align::GetSeqRange(), CSeq_align::GetSeqStart(), CSeq_align::GetSeqStrand(), CSeq_align_Base::C_Segs::GetSpliced(), i, isalpha(), CSeq_align_Base::C_Segs::IsDenseg(), isdigit(), CSeq_align_Base::C_Segs::IsDisc(), CSpliced_seg_Base::IsSetProduct_length(), CSeq_align_Base::C_Segs::IsSpliced(), ITERATE, CSeq_id::Match(), MAX, MIN, CConstRef< C, Locker >::NotEmpty(), r(), compile_time_bits::range(), s_Complement(), s_GetBareId(), s_GetQueryBioseq(), s_GetQuerySequence(), and s_GetSequenceId().
Referenced by CMagicBlastThread::Main(), and PrintTabular().
CNcbiOstream& PrintTabularHeader | ( | CNcbiOstream & | ostr, |
const string & | version, | ||
const string & | cmd_line_args, | ||
bool | user_tag | ||
) |
Definition at line 396 of file magicblast_util.cpp.
References dtl::version.
Referenced by CMagicBlastApp::Run().
|
static |
Definition at line 686 of file magicblast_util.cpp.
References CMagicBlastResults::fFiltered, CBioseq_Base::GetInst(), CSeq_inst_Base::GetLength(), info, results, s_GetQueryBioseq(), s_GetSequenceId(), and CSeq_id::Set().
Referenced by PrintUnaligned().
|
static |
Definition at line 372 of file magicblast_util.cpp.
References CFormattingArgs::eFasta, CFormattingArgs::eTabular, PrintFastaUnaligned(), PrintSAMUnaligned(), PrintTabularUnaligned(), and results.
Referenced by PrintSAM(), and PrintTabular().
|
static |
Definition at line 99 of file magicblast_util.cpp.
Referenced by PrintTabular().
|
static |
Definition at line 220 of file magicblast_util.cpp.
References CBioseq::GetFirstId(), CSeq_entry_Base::GetSeq(), CBioseq_set_Base::GetSeq_set(), CSeq_id::GetSeqIdString(), and NCBI_THROW.
Referenced by PrintASN1(), PrintSAM(), and PrintTabular().
Definition at line 156 of file magicblast_util.cpp.
References CObject_id_Base::GetId(), CObject_id_Base::GetStr(), CDbtag_Base::GetTag(), NStr::IntToString(), CObject_id_Base::IsId(), and CObject_id_Base::IsStr().
Referenced by PrintSAM(), PrintSAMHeader(), PrintTabular(), s_GetFastaDefline(), s_GetQueryBioseq(), and s_GetSequenceId().
Definition at line 201 of file magicblast_util.cpp.
References CSeq_descr_Base::Get(), CBioseq_Base::GetDescr(), CBioseq::GetFirstId(), CBioseq_Base::IsSetDescr(), and s_GetBareId().
Referenced by PrintFastaUnaligned().
Definition at line 301 of file magicblast_util.cpp.
References CSeq_descr_Base::Get(), CBioseq_Base::GetAnnot(), CBioseq_Base::GetDescr(), CBioseq_Base::IsSetAnnot(), and CBioseq_Base::IsSetDescr().
Referenced by PrintSAM(), and PrintSAMUnaligned().
Definition at line 237 of file magicblast_util.cpp.
References _ASSERT, CSeq_id::GetSeqIdString(), NCBI_THROW, and s_GetBareId().
Referenced by PrintASN1(), PrintFastaUnaligned(), PrintSAM(), PrintSAMUnaligned(), PrintTabular(), and PrintTabularUnaligned().
|
static |
Definition at line 250 of file magicblast_util.cpp.
References CSeqConvert::Convert(), CSeq_data_Base::e_Iupacna, CSeqUtil::e_Iupacna, CSeq_data_Base::e_Ncbi2na, CSeqUtil::e_Ncbi2na, CSeq_data_Base::e_Ncbi4na, CSeqUtil::e_Ncbi4na, CSeq_data_Base::e_Ncbi8na, CSeqUtil::e_Ncbi8na, CAliasBase< TPrim >::Get(), CBioseq_Base::GetInst(), CSeq_data_Base::GetIupacna(), CSeq_data_Base::GetNcbi2na(), CSeq_data_Base::GetNcbi4na(), CSeq_data_Base::GetNcbi8na(), CSeq_inst_Base::GetSeq_data(), NCBI_THROW, compile_time_bits::range(), reverse_complement(), CSeqManip::ReverseComplement(), tmp, and CSeq_data_Base::Which().
Referenced by PrintFastaUnaligned(), PrintSAM(), PrintSAMUnaligned(), and PrintTabular().
Definition at line 180 of file magicblast_util.cpp.
References CSeq_descr_Base::Get(), CBioseq_Base::GetDescr(), CBioseq::GetFirstId(), CBioseq_Base::IsSetDescr(), s_GetBareId(), and NStr::Split().
Referenced by PrintSAM(), PrintSAMUnaligned(), PrintTabular(), and PrintTabularUnaligned().
|
static |
Definition at line 922 of file magicblast_util.cpp.
References CSeqUtil::e_Iupacna, eNa_strand_minus, eNa_strand_plus, eNa_strand_unknown, IsConsensusSplice(), IsKnownNonConsensusSplice(), result, and CSeqManip::ReverseComplement().
Referenced by PrintSAM().
USING_SCOPE | ( | objects | ) |