32 #include "wx/wxprec.h"
103 Create(parent,
id, caption, pos,
size, style);
114 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
115 wxDialog::Create( parent,
id, caption, pos,
size, style );
120 GetSizer()->SetSizeHints(
this);
162 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
163 itemDialog1->SetSizer(itemBoxSizer2);
167 vector<bool> checked;
168 wxArrayString choices;
172 for (
auto row = 0;
row < num_rows;
row++)
180 if (!disable && !
msg.empty())
182 checked.push_back(
check);
186 if (
label.size() > label_max.size())
191 wxGraphicsContext *gc = wxGraphicsContext::Create();
192 gc->SetFont(GetFont(), *wxBLACK);
197 choices.Add(wxString(
label + msgs[
i]));
201 if (choices.IsEmpty())
206 for (
size_t i = 0;
i < checked.size();
i++)
210 wxBoxSizer* itemBoxSizer10 =
new wxBoxSizer(wxHORIZONTAL);
211 itemBoxSizer2->Add(itemBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
213 wxButton* itemButton11 =
new wxButton( itemDialog1, wxID_OK,
_(
"Replace Selected Sequences"), wxDefaultPosition, wxDefaultSize, 0 );
214 itemBoxSizer10->Add(itemButton11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
216 wxButton* itemButton12 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
217 itemBoxSizer10->Add(itemButton12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
219 wxButton* itemButton13 =
new wxButton( itemDialog1,
ID_FARPOINTERSEQ_EXPORT,
_(
"Export FarPointer Error Messages"), wxDefaultPosition, wxDefaultSize, 0 );
220 itemBoxSizer10->Add(itemButton13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
230 wxDouble externalLeading;
231 gc->GetTextExtent(wxString(
str), &width, &height, &descent, &externalLeading);
232 wxDouble space_width;
233 gc->GetTextExtent(
_(
" "), &space_width, &height, &descent, &externalLeading);
235 gc->GetTextExtent(wxString(label_max), &max_width, &height, &descent, &externalLeading);
236 if (max_width >= width)
238 int add_spaces =
int((max_width - width) / space_width) + 1;
246 int i =
event.GetInt();
260 msg +=
i->first +
"\t" +
i->second +
"\n";
265 report->SetTitle(
wxT(
"FarPointer Errors"));
279 if (!align_it->IsSetSegs() || !align_it->GetSegs().IsDenseg() ||
280 !align_it->GetSegs().GetDenseg().IsSetIds())
284 new_align->
Assign(align_it.GetOriginalSeq_align());
286 bool modified(
false);
288 for (
size_t j = 0; j < checked.GetCount(); j++)
290 int i = checked.Item(j);
297 for (
auto row = 0;
row < num_rows;
row++)
315 new_align->
SetSegs().SetDenseg().SetIds()[
row]->Assign(*new_id);
323 new_align->
SetSegs().SetDenseg().RemovePureGapSegs();
325 new_align->
SetSegs().SetDenseg().Compact();
327 cmd->AddCommand(*chgAlign);
331 for (
size_t j = 0; j < checked.GetCount(); j++)
333 int i = checked.Item(j);
415 return "Not a far pointer";
417 string orig_label(
label);
427 catch(
const CException&) {}
catch (
const exception&) {}
444 catch (
const CException&) {}
catch (
const exception&) {}
460 blast::SSeqLoc query_sl(*query_seqloc, scope);
461 blast::SSeqLoc subject_sl(*subject_seqloc, scope);
463 blast::CBlastNucleotideOptionsHandle& opts =
dynamic_cast<blast::CBlastNucleotideOptionsHandle&
>(bl2seq.SetOptionsHandle());
464 opts.SetTraditionalMegablastDefaults();
466 opts.SetMaskAtHash(
true);
467 opts.SetDustFiltering(
true);
469 opts.SetMismatchPenalty(-3);
472 vector< CRef<objects::CSeq_align_set> > res = bl2seq.Run();
475 if (align && align->
IsSet() && !align->
Get().empty())
476 return (align->
Get().front());
484 return(
"No alignment found!");
490 int num_rows = align->CheckNumRows();
500 bool flip_strand = (align->GetSeqStrand(0) != align->GetSeqStrand(1));
503 if (align->GetSeq_id(0).Match(*bsh1.
GetSeqId()))
505 start1 = align->GetSeqStart(0);
506 stop1 = align->GetSeqStop(0);
507 start2 = align->GetSeqStart(1);
508 stop2 = align->GetSeqStop(1);
510 else if (align->GetSeq_id(1).Match(*bsh1.
GetSeqId()))
512 start1 = align->GetSeqStart(1);
513 stop1 = align->GetSeqStop(1);
514 start2 = align->GetSeqStart(0);
515 stop2 = align->GetSeqStop(0);
528 assem_len = stop1 - start1 + 1;
530 assem_len = start1 - stop1 + 1;
536 for (
size_t i = 0;
i < seq1.size();
i++)
544 for (
int i = length - 1;
i >= 0;
i--)
552 for (
size_t i = 0;
i < seq1.size();
i++)
560 if (!align->IsSetSegs() || !align->GetSegs().IsDenseg() ||
561 !align->GetSegs().GetDenseg().IsSetStarts() || !align->GetSegs().GetDenseg().IsSetLens())
568 vector< TSignedSeqPos > starts(align->GetSegs().GetDenseg().GetStarts());
569 vector< TSeqPos > lens(align->GetSegs().GetDenseg().GetLens());
570 size_t num_segs = lens.size();
576 for (
size_t seg = 0; seg < num_segs; ++seg)
582 if (seg_start1 < 0 || seg_start2 < 0)
587 for (
size_t i = 0;
i <
len;
i++)
589 char a = seq1[
i + seg_start1];
590 char b = seq2[
i + seg_start2];
593 if (
a !=
'N' &&
b !=
'N')
602 tmp[
i + seg_start1] =
'+';
606 int uncovered_non_n = 0;
607 for (
size_t i = 0;
i <
tmp.size();
i++)
617 if (gaps>0 || mismatches>0 ||
n > 0)
619 if (beg > 0 || end > 0)
621 errors +=
"The local sequence has " +
NStr::ULongToString(beg + end) +
" terminal N" + (beg+end > 1 ?
"s. " :
". ");
625 errors +=
"The local sequence has " +
NStr::ULongToString(nctr) +
" internal N" + (nctr > 1 ?
"s. " :
". ");
630 if (!errors.empty() && assem_len == length && gaps == 0 && mismatches == 0)
632 errors +=
"There are no other differences between the local and database sequences.";
636 if ((
TSeqPos)assem_len < length)
638 errors +=
"The alignment to the database sequence does not cover all of the local sequence. ";
640 if (uncovered_n != 0 && uncovered_non_n == 0)
642 errors +=
"The unaligned sequence consists only of Ns. ";
644 if (uncovered_non_n != 0)
646 errors +=
"There are non-N residues in the unaligned sequence. ";
650 if (gaps > 0 || mismatches > 0 ||
n > 0)
652 errors +=
"The alignment to the database sequence has " +
NStr::ULongToString(gaps) +
" gap" + (gaps != 1 ?
"s, " :
", ")
Declares the CBl2Seq (BLAST 2 Sequences) class.
Declares the CBlastNucleotideOptionsHandle class.
Definitions of special type used in BLAST.
@ eMegablast
Nucl-Nucl (traditional megablast)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
void AddSpaces(string &str, const string &label_max, wxGraphicsContext *gc)
map< CBioseq_Handle, int > m_offset
map< string, CBioseq_Handle > m_label_to_bsh1
void ReverseRow(CDense_seg &dense_seg, int offset, size_t row, CSeq_align::TDim num_rows)
string ValidateAlignment(CRef< objects::CSeq_align > align, CBioseq_Handle bsh1, CBioseq_Handle bsh2, bool &check)
string GetMessageForId(const CSeq_id &id, string label, bool &check, bool &disable)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Far Pointer Sequences"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
CRef< objects::CSeq_align > RunBlast(const CBioseq_Handle &sh, const CBioseq_Handle &qh)
vector< string > m_labels
map< CBioseq_Handle, bool > m_flip_strand
void OnCheck(wxCommandEvent &event)
CFarPointerSeq()
Constructors.
void OnExport(wxCommandEvent &event)
~CFarPointerSeq()
Destructor.
map< string, string > m_errors
map< string, CBioseq_Handle > m_label_to_bsh2
CRef< CCmdComposite > GetCommand()
static bool ShowToolTips()
Should we show tooltips?
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void CreateControls()
Creates the controls and sizers.
void Init()
Initialises member variables.
CSeq_entry_Handle m_TopSeqEntry
wxCheckListBox * m_CheckListBox
vector< bool > m_disabled
void SetText(const wxString &text)
void OffsetRow(TDim row, TSignedSeqPos offset)
Offset row's coords.
const_iterator begin() const
const_iterator end() const
#define ID_FARPOINTERSEQ_EXPORT
#define ID_FARPOINTERSEQ_CHECKLISTBOX
static const char * str(char *buf, int n)
unsigned int TSeqPos
Type for sequence locations and lengths.
int TSignedSeqPos
Type for signed sequence position.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
CConstRef< CSeq_id > GetSeqId(void) const
@ fParse_Default
By default in ParseIDs and IsValid, allow raw parsable non-numeric accessions and plausible local acc...
@ eContent
Untagged human-readable accession or the like.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TClass GetClass(void) const
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
TSeqPos GetBioseqLength(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
bool IsSetClass(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
CScope & GetScope(void) const
Get scope this handle belongs to.
CRef< CSeq_loc > GetRangeSeq_loc(TSeqPos start, TSeqPos stop, ENa_strand strand=eNa_strand_unknown) const
Return CSeq_loc referencing the given range and strand on the bioseq If start == 0,...
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static string ULongToString(unsigned long value, TNumToStringFlags flags=0, int base=10)
Convert unsigned long to string.
static void TrimPrefixInPlace(string &str, const CTempString prefix, ECase use_case=eCase)
Trim prefix from a string (in-place)
static const char label[]
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
const TStarts & GetStarts(void) const
Get the Starts member data.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
const TLens & GetLens(void) const
Get the Lens member data.
TStarts & SetStarts(void)
Assign a value to Starts data member.
TStrands & SetStrands(void)
Assign a value to Strands data member.
bool IsSet(void) const
Check if a value has been assigned to data member.
const TStrands & GetStrands(void) const
Get the Strands member data.
const Tdata & Get(void) const
Get the member data.
@ eClass_nuc_prot
nuc acid and coded proteins
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
Definition of SSeqLoc structure.
#define row(bind, expected)