NCBI C++ ToolKit
Classes | Macros | Typedefs | Functions
magicblast_util.cpp File Reference
#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>
+ Include dependency graph for magicblast_util.cpp:

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_seqidTSeq_idHashSet
 

Functions

 USING_SCOPE (objects)
 
static CNcbiOstreamPrintTabularUnaligned (CNcbiOstream &ostr, const CMagicBlastResults &results, const TQueryMap &queries, bool first_seg, const string &user_tag)
 
static CNcbiOstreamPrintSAMUnaligned (CNcbiOstream &ostr, const CMagicBlastResults &results, const TQueryMap &queries, bool first_seg, bool trim_read_ids, const string &user_tag)
 
static char s_Complement (char c)
 
static string s_GetBareId (const CSeq_id &id)
 
static string s_GetSequenceId (const CBioseq &bioseq)
 
static string s_GetFastaDefline (const CBioseq &bioseq)
 
static void s_CreateQueryMap (const CBioseq_set &query_batch, TQueryMap &query_map)
 
static const CBioseqs_GetQueryBioseq (const TQueryMap &queries, const CSeq_id &seqid)
 
static int s_GetQuerySequence (const CBioseq &bioseq, const CRange< TSeqPos > &range, bool reverse_complement, string &sequence)
 
static bool s_GetQualityString (const CBioseq &bioseq, string &quality_str)
 
static CNcbiOstreamPrintFastaUnaligned (CNcbiOstream &ostr, const CMagicBlastResults &results, const TQueryMap &queries, bool first_seg)
 
static CNcbiOstreamPrintUnaligned (CNcbiOstream &ostr, CFormattingArgs::EOutputFormat fmt, const CMagicBlastResults &results, const TQueryMap &queries, bool first_seg, bool trim_read_ids, const string &user_tag)
 
CNcbiOstreamPrintTabularHeader (CNcbiOstream &ostr, const string &version, const string &cmd_line_args, bool user_tag)
 
static CNcbiOstreamPrintTabular (CNcbiOstream &ostr, const CSeq_align &align, const TQueryMap &queries, bool is_paired, int batch_number, int compartment, const string &user_tag, const CSeq_align *mate=NULL)
 
static CNcbiOstreamPrintTabular (CNcbiOstream &ostr, CNcbiOstream &unaligned_ostr, CFormattingArgs::EOutputFormat unaligned_fmt, const CMagicBlastResults &results, const TQueryMap &queries, bool is_paired, int batch_number, int &compartment, bool trim_read_id, bool print_unaligned, bool no_discordant, const string &user_tag)
 
CNcbiOstreamPrintTabular (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)
 
CNcbiOstreamPrintSAMHeader (CNcbiOstream &ostr, CRef< CLocalDbAdapter > db_adapter, const string &cmd_line_args)
 
static ENa_strand s_GetSpliceSiteOrientation (const CSpliced_seg::TExons::const_iterator &exon, const CSpliced_seg::TExons::const_iterator &next_exon)
 
static CNcbiOstreamPrintSAM (CNcbiOstream &ostr, const CSeq_align &align, const TQueryMap &queries, const BlastQueryInfo *query_info, bool is_spliced, int batch_number, bool &first_secondary, bool &last_secondary, bool trim_read_ids, E_StrandSpecificity strand_specific, bool only_specific, bool print_md_tag, bool other=false, const string &user_tag="", const CSeq_align *mate=NULL)
 
static CNcbiOstreamPrintSAM (CNcbiOstream &ostr, CNcbiOstream &unaligned_ostr, CFormattingArgs::EOutputFormat unaligned_fmt, CMagicBlastResults &results, const TQueryMap &queries, 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)
 
CNcbiOstreamPrintSAM (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)
 
CNcbiOstreamPrintASN1 (CNcbiOstream &ostr, const CBioseq_set &query_batch, CSeq_align_set &aligns)
 

Macro Definition Documentation

◆ SAM_FLAG_FIRST_SEGMENT

#define SAM_FLAG_FIRST_SEGMENT   0x40

Definition at line 1003 of file magicblast_util.cpp.

◆ SAM_FLAG_LAST_SEGMENT

#define SAM_FLAG_LAST_SEGMENT   0x80

Definition at line 1004 of file magicblast_util.cpp.

◆ SAM_FLAG_MULTI_SEGMENTS

#define SAM_FLAG_MULTI_SEGMENTS   0x1

Definition at line 997 of file magicblast_util.cpp.

◆ SAM_FLAG_NEXT_REVCOMP

#define SAM_FLAG_NEXT_REVCOMP   0x20

Definition at line 1002 of file magicblast_util.cpp.

◆ SAM_FLAG_NEXT_SEG_UNMAPPED

#define SAM_FLAG_NEXT_SEG_UNMAPPED   0x8

Definition at line 1000 of file magicblast_util.cpp.

◆ SAM_FLAG_SECONDARY

#define SAM_FLAG_SECONDARY   0x100

Definition at line 1005 of file magicblast_util.cpp.

◆ SAM_FLAG_SEG_UNMAPPED

#define SAM_FLAG_SEG_UNMAPPED   0x4

Definition at line 999 of file magicblast_util.cpp.

◆ SAM_FLAG_SEGS_ALIGNED

#define SAM_FLAG_SEGS_ALIGNED   0x2

Definition at line 998 of file magicblast_util.cpp.

◆ SAM_FLAG_SEQ_REVCOMP

#define SAM_FLAG_SEQ_REVCOMP   0x10

Definition at line 1001 of file magicblast_util.cpp.

Typedef Documentation

◆ TQueryMap

typedef unordered_map<string, CRef<CSeq_entry> > TQueryMap

Definition at line 80 of file magicblast_util.cpp.

◆ TSeq_idHashSet

typedef unordered_set<const CSeq_id*, hash_seqid, eq_seqid> TSeq_idHashSet

Definition at line 918 of file magicblast_util.cpp.

Function Documentation

◆ PrintASN1()

CNcbiOstream& PrintASN1 ( CNcbiOstream ostr,
const CBioseq_set query_batch,
CSeq_align_set aligns 
)

◆ PrintFastaUnaligned()

static CNcbiOstream& PrintFastaUnaligned ( CNcbiOstream ostr,
const CMagicBlastResults results,
const TQueryMap queries,
bool  first_seg 
)
static

◆ PrintSAM() [1/3]

static CNcbiOstream& PrintSAM ( CNcbiOstream ostr,
CNcbiOstream unaligned_ostr,
CFormattingArgs::EOutputFormat  unaligned_fmt,
CMagicBlastResults results,
const TQueryMap queries,
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 
)
static

◆ PrintSAM() [2/3]

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().

◆ PrintSAM() [3/3]

static CNcbiOstream& PrintSAM ( CNcbiOstream ostr,
const CSeq_align align,
const TQueryMap queries,
const BlastQueryInfo query_info,
bool  is_spliced,
int  batch_number,
bool first_secondary,
bool last_secondary,
bool  trim_read_ids,
E_StrandSpecificity  strand_specific,
bool  only_specific,
bool  print_md_tag,
bool  other = false,
const string user_tag = "",
const CSeq_align mate = NULL 
)
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().

◆ PrintSAMHeader()

CNcbiOstream& PrintSAMHeader ( CNcbiOstream ostr,
CRef< CLocalDbAdapter db_adapter,
const string cmd_line_args 
)

◆ PrintSAMUnaligned()

static CNcbiOstream& PrintSAMUnaligned ( CNcbiOstream ostr,
const CMagicBlastResults results,
const TQueryMap queries,
bool  first_seg,
bool  trim_read_ids,
const string user_tag 
)
static

◆ PrintTabular() [1/3]

static CNcbiOstream& PrintTabular ( CNcbiOstream ostr,
CNcbiOstream unaligned_ostr,
CFormattingArgs::EOutputFormat  unaligned_fmt,
const CMagicBlastResults results,
const TQueryMap queries,
bool  is_paired,
int  batch_number,
int compartment,
bool  trim_read_id,
bool  print_unaligned,
bool  no_discordant,
const string user_tag 
)
static

◆ PrintTabular() [2/3]

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().

◆ PrintTabular() [3/3]

static CNcbiOstream& PrintTabular ( CNcbiOstream ostr,
const CSeq_align align,
const TQueryMap queries,
bool  is_paired,
int  batch_number,
int  compartment,
const string user_tag,
const CSeq_align mate = NULL 
)
static

◆ PrintTabularHeader()

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().

◆ PrintTabularUnaligned()

static CNcbiOstream& PrintTabularUnaligned ( CNcbiOstream ostr,
const CMagicBlastResults results,
const TQueryMap queries,
bool  first_seg,
const string user_tag 
)
static

◆ PrintUnaligned()

static CNcbiOstream& PrintUnaligned ( CNcbiOstream ostr,
CFormattingArgs::EOutputFormat  fmt,
const CMagicBlastResults results,
const TQueryMap queries,
bool  first_seg,
bool  trim_read_ids,
const string user_tag 
)
static

◆ s_Complement()

static char s_Complement ( char  c)
static

Definition at line 99 of file magicblast_util.cpp.

Referenced by PrintTabular().

◆ s_CreateQueryMap()

static void s_CreateQueryMap ( const CBioseq_set query_batch,
TQueryMap query_map 
)
static

◆ s_GetBareId()

static string s_GetBareId ( const CSeq_id id)
static

◆ s_GetFastaDefline()

static string s_GetFastaDefline ( const CBioseq bioseq)
static

◆ s_GetQualityString()

static bool s_GetQualityString ( const CBioseq bioseq,
string quality_str 
)
static

◆ s_GetQueryBioseq()

static const CBioseq& s_GetQueryBioseq ( const TQueryMap queries,
const CSeq_id seqid 
)
static

◆ s_GetQuerySequence()

static int s_GetQuerySequence ( const CBioseq bioseq,
const CRange< TSeqPos > &  range,
bool  reverse_complement,
string sequence 
)
static

◆ s_GetSequenceId()

static string s_GetSequenceId ( const CBioseq bioseq)
static

◆ s_GetSpliceSiteOrientation()

static ENa_strand s_GetSpliceSiteOrientation ( const CSpliced_seg::TExons::const_iterator &  exon,
const CSpliced_seg::TExons::const_iterator &  next_exon 
)
static

◆ USING_SCOPE()

USING_SCOPE ( objects  )
Modified on Fri Sep 20 14:58:03 2024 by modify_doxy.py rev. 669887