57 #include <wx/dataobj.h>
58 #include <wx/clipbrd.h>
59 #include <wx/filedlg.h>
71 : m_OldSeq(old_bsh), m_UpdSeq(upd_bsh), m_Align(0)
83 m_UpdSeq.GetTopLevelEntry().GetEditHandle().Remove();
106 dense_seg->
SetIds().push_back(query_id);
107 dense_seg->
SetIds().push_back(subject_id);
116 align->
SetSegs().SetDenseg(*dense_seg);
119 annot->
SetData().SetAlign().push_back(align);
121 desc->
SetName(
"Alignment generated between two identical sequences");
122 annot->
SetDesc().Set().push_back(desc);
136 sel_srv->GetActiveObjects(
objects);
192 bool accept_atleast_one =
false;
194 accept_atleast_one =
true;
197 if (align_vector.size() > 1) {
201 if (align_vector.empty()) {
202 LOG_POST(
Info <<
"Could not form alignment between old and update sequence");
208 size_t best_align = 0;
209 for (
size_t i = 0;
i < align_vector.size(); ++
i) {
210 for (
size_t j =
i + 1; j < align_vector.size(); ++j) {
214 _ASSERT(best_align < align_vector.size());
223 return (set_seqs && no_mismatch);
251 bool has_feat =
false;
253 for (
CFeat_CI feat_it(*bseq_it); feat_it && !has_feat; ++feat_it) {
254 auto feat = feat_it->GetOriginalSeq_feat();
255 if (feat->IsSetData() && feat->GetData().IsProt() && !feat->GetData().GetProt().IsSetProcessed())
276 wxFileDialog openDlg(
NULL,
wxT(
"Open a file"), wxEmptyString, wxEmptyString, ext, wxFD_OPEN | wxFD_FILE_MUST_EXIST);
277 if (openDlg.ShowModal() != wxID_OK)
280 wxString path = openDlg.GetPath();
306 "Failed to recognize the format of update sequence. Please try ASN.1 or Fasta.\n" + e.
GetMsg());
333 oi = objIstrm->ReadObject();
340 if (oi.
GetName() ==
"Bioseq") {
350 if (oi.
GetName() ==
"Seq-entry") {
352 seq_entry =
Ref(entry);
354 else if (oi.
GetName() ==
"Seq-submit") {
395 if (msg_listener && msg_listener->
Count() > 0) {
425 unsigned int count = 0;
466 if (!it->IsLiteral()) {
471 if (!
ok)
return false;
524 bseq.
SetInst().SetRepr(objects::CSeq_inst::eRepr_raw);
525 bseq.
SetInst().SetSeq_data().SetIupacna().Set(seqdata);
557 seq_ids.push_back(*upd_id);
578 old_ids.push_back(*upd_id);
591 if (seq_dlg.ShowModal() == wxID_OK) {
592 string acc_id = seq_dlg.
GetData();
608 string msg =
"'" + acc_id +
"' is not a valid accession";
616 string msg =
"Failed to load sequence for accession '" + acc_id +
"'";
631 if ((*id_iter)->Which() == feat_id_type){
644 new_inst->
SetRepr(objects::CSeq_inst::eRepr_raw);
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
TSeqPos GetLength(void) const
Base class for reading FASTA sequences.
static wxString GetDialogFilter(EFileType fileType)
Sequence update exception class.
void ReassignConflictingIds(void)
static TSeqPos Pack(CSeq_data *in_seq, TSeqPos uLength=ncbi::numeric_limits< TSeqPos >::max())
static CSimpleClipboard & Instance()
virtual size_t Count() const =0
virtual const ILineError & GetError(size_t) const =0
0-based error retrieval.
virtual const std::string & ErrorMessage(void) const
IWorkbench is the central interface in the application framework.
static bool CompareAlignments(const objects::CSeq_align &align_first, const objects::CSeq_align &align_sec)
Returns true if the first alignment is 'better' than the second one Compares the Blast scores and in ...
static vector< CConstRef< objects::CSeq_align > > RunBlast2Seq(const objects::CBioseq_Handle &subject, const objects::CBioseq_Handle &query, bool accept_atleast_one, ICanceled *canceled=nullptr)
static bool HaveIdenticalResidues(const objects::CBioseq_Handle &bsh1, const objects::CBioseq_Handle &bsh2)
static void FixCollidingIDs_Bioseq(objects::CBioseq &bseq, const objects::CBioseq::TId &seq_ids)
Operators to edit gaps in sequences.
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
@ eNoOwnership
No ownership is assumed.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
Get error code.
#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.
void Info(CExceptionArgs_Base &args)
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
vector< SConstScopedObject > TConstScopedObjects
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
static const TObjectType * SafeCast(TTypeInfo type)
@ eSerial_AsnText
ASN.1 text.
CRef< CSeq_entry > ReadSet(int max_seqs=kMax_Int, ILineErrorListener *pMessageListener=nullptr)
Read multiple sequences (by default, as many as are available.)
long TFlags
binary OR of EFlags
@ fDLOptional
Don't require a leading defline.
@ fHyphensIgnoreAndWarn
When a hyphen is encountered in seq data, ignore it but warn.
@ fNoSplit
Don't split out ambiguous sequence regions.
@ fAssumeNuc
Assume nucs unless accns indicate otherwise.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
CSeq_id & Set(const CTempString &the_id, TParseFlags flags=fParse_AnyRaw)
Reassign based on flat specifications; arguments interpreted as with constructors.
CSeq_id::E_Choice Which(void) const
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
const string & GetName(void) const
Get type name.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void SetInst(TInst &v) const
CScope & GetScope(void) const
Get scope this handle belongs to.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
CSeq_id_Handle GetLocationId(void) const
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
void SetCoding(TCoding coding)
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
TLens & SetLens(void)
Assign a value to Lens data member.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
void SetDim(TDim value)
Assign a value to Dim data member.
void SetDim(TDim value)
Assign a value to Dim data member.
void SetType(TType value)
Assign a value to Type data member.
TStarts & SetStarts(void)
Assign a value to Starts data member.
void SetNumseg(TNumseg value)
Assign a value to Numseg data member.
TIds & SetIds(void)
Assign a value to Ids data member.
@ eType_partial
mapping pieces together
@ e_not_set
No variant selected.
const TSeq & GetSeq(void) const
Get the variant data.
TSet & SetSet(void)
Select the variant.
const TSet & GetSet(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
bool IsSetSeq_set(void) const
Check if a value has been assigned to Seq_set data member.
bool IsSet(void) const
Check if variant Set is selected.
list< CRef< CSeq_entry > > TSeq_set
TSeq & SetSeq(void)
Select the variant.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
bool IsSetLinkage(void) const
Check if a value has been assigned to Linkage data member.
TRepr GetRepr(void) const
Get the Repr member data.
void SetData(TData &value)
Assign a value to Data data member.
const TInst & GetInst(void) const
Get the Inst member data.
const TGap & GetGap(void) const
Get the variant data.
void SetDesc(TDesc &value)
Assign a value to Desc data member.
bool IsSetRepr(void) const
Check if a value has been assigned to Repr data member.
TType GetType(void) const
Get the Type member data.
const TId & GetId(void) const
Get the Id member data.
TName & SetName(void)
Select the variant.
bool IsSetExt(void) const
extensions for special types Check if a value has been assigned to Ext data member.
bool IsSetInst(void) const
the sequence data Check if a value has been assigned to Inst data member.
TLength GetLength(void) const
Get the Length member data.
list< CRef< CSeq_id > > TId
bool IsDelta(void) const
Check if variant Delta is selected.
void SetInst(TInst &value)
Assign a value to Inst data member.
bool IsSetType(void) const
Check if a value has been assigned to Type data member.
const TExt & GetExt(void) const
Get the Ext member data.
const TDelta & GetDelta(void) const
Get the variant data.
void SetRepr(TRepr value)
Assign a value to Repr data member.
const Tdata & Get(void) const
Get the member data.
bool IsSetSeq_data(void) const
may have the data Check if a value has been assigned to Seq_data data member.
void SetLength(TLength value)
Assign a value to Length data member.
bool IsGap(void) const
Check if variant Gap is selected.
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
void ResetExt(void)
Reset Ext data member.
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
@ eRepr_delta
sequence made by changes (delta) to others
@ e_Iupacna
IUPAC 1 letter nuc acid code.
@ eMol_na
just a nucleic acid
void GetViewObjects(IWorkbench *workbench, TConstScopedObjects &objects)
bool FocusedOnAll(TConstScopedObjects &objects, const objects::CSeq_entry_Handle &tse)
CRef< CSeq_entry > SeqEntryFromSeqSubmit(const CSeq_submit &submit)
Create a Seq-entry from a Seq-submit.
Utility macros and typedefs for exploring NCBI objects from seq.asn.