35 #include <wx/stattext.h>
36 #include <wx/msgdlg.h>
37 #include <wx/statbox.h>
102 Create(parent,
id, caption, pos,
size, style);
113 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
119 GetSizer()->SetSizeHints(
this);
163 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
164 itemCBulkCmdDlg1->SetSizer(itemBoxSizer2);
169 m_Inner =
new wxRadioButton( itemCBulkCmdDlg1,
wxID_ANY,
_(
"Convert inner CDSs to mat_peptides"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
171 itemBoxSizer2->Add(
m_Inner, 0, wxALIGN_LEFT|wxALL, 5);
173 m_Merge =
new wxRadioButton( itemCBulkCmdDlg1,
wxID_ANY,
_(
"Merge multiple CDSs to one CDS and convert inner CDSs to mat_peptides"), wxDefaultPosition, wxDefaultSize, 0 );
175 itemBoxSizer2->Add(
m_Merge, 0, wxALIGN_LEFT|wxALL, 5);
177 m_Each =
new wxRadioButton( itemCBulkCmdDlg1,
wxID_ANY,
_(
"Create mat_peptide from protein on each CDS"), wxDefaultPosition, wxDefaultSize, 0 );
179 itemBoxSizer2->Add(
m_Each, 0, wxALIGN_LEFT|wxALL, 5);
181 m_EntireRange =
new wxCheckBox( itemCBulkCmdDlg1,
wxID_ANY,
_(
"New CDS should cover the entire sequence"), wxDefaultPosition, wxDefaultSize, 0 );
184 m_ProductFirst =
new wxRadioButton( itemCBulkCmdDlg1,
wxID_ANY,
_(
"Use product name from first CDS"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
188 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
189 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_LEFT, 0);
190 m_ProductThis =
new wxRadioButton( itemCBulkCmdDlg1,
wxID_ANY,
_(
"Use this product name"), wxDefaultPosition, wxDefaultSize, 0 );
193 m_ProductName =
new wxTextCtrl( itemCBulkCmdDlg1,
wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
204 itemBoxSizer2->Add(
m_OkCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
283 vector<CConstRef<CObject> > objs;
286 bool leave_original =
true;
291 cmd->AddCommand(*subcmd);
312 vector<CConstRef<CObject> > objs;
327 vector<string> products;
333 products.push_back(product);
337 new_loc->
Assign(
f->GetLocation());
338 new_product = product;
345 add_loc->
Assign(
f->GetLocation());
356 new_cds->
SetProduct().SetWhole().Assign(*prot_id);
357 annot->
SetData().SetFtable().push_back(new_cds);
361 protein->SetId().push_back(prot_id);
363 pdesc->SetMolinfo().SetBiomol(objects::CMolInfo::eBiomol_peptide);
364 pdesc->SetMolinfo().SetCompleteness(objects::CMolInfo::eCompleteness_complete);
367 pdesc->SetMolinfo().SetCompleteness(objects::CMolInfo::eCompleteness_no_left);
371 if (pdesc->GetMolinfo().GetCompleteness() == objects::CMolInfo::eCompleteness_complete) {
372 pdesc->SetMolinfo().SetCompleteness(objects::CMolInfo::eCompleteness_no_right);
374 pdesc->SetMolinfo().SetCompleteness(objects::CMolInfo::eCompleteness_no_ends);
377 protein->SetDescr().Set().push_back(pdesc);
379 prot_feat->SetData().SetProt();
384 prot_feat->SetData().SetProt().SetName().push_back(new_product);
385 prot_feat->SetLocation().SetInt().SetId(*prot_id);
386 prot_feat->SetLocation().SetInt().SetFrom(0);
387 prot_feat->SetLocation().SetInt().SetTo(protein->GetLength() - 1);
392 prot_annot->
SetData().SetFtable().push_back(prot_feat);
393 protein->SetAnnot().push_back(prot_annot);
395 prot_entry->
SetSeq(*protein);
416 loc->
SetId(*prot_id);
428 if (
i < products.size())
429 mat_peptide->
SetData().SetProt().SetName().push_back(products[
i++]);
432 prot_annot->
SetData().SetFtable().push_back(mat_peptide);
461 vector<CConstRef<CObject> > objs;
463 bool leave_original =
false;
472 for (
size_t i = 0;
i < feats.size();
i++)
476 if (!inner->
Equals(*
f) && already_converted.
find(inner_fh) == already_converted.
end())
478 already_converted.
insert(inner_fh);
485 mat_peptide->
Assign(*inner);
488 mat_peptide->
SetData().SetProt().SetName().push_back(product);
522 CSeq_entry::TAnnot::iterator annot_it = entry->
SetAnnot().begin();
523 while ( annot_it != entry->
SetAnnot().end() )
525 if ((*annot_it)->IsSetData() && (*annot_it)->GetData().IsFtable())
529 if ((*feat_it)->IsSetData() && (*feat_it)->GetData().GetSubtype() == feat->
GetData().
GetSubtype() && feat->
Equals(**feat_it))
534 if ((*annot_it)->GetData().GetFtable().empty())
536 annot_it = entry->
SetAnnot().erase(annot_it);
548 else if (entry->
IsSeq())
568 if ((*entry_it)->IsSeq() && (*entry_it)->GetSeq().IsAa() && (*entry_it)->GetSeq().GetFirstId()->Match(*feat->
GetProduct().
GetId()))
601 CSeq_entry::TAnnot::iterator annot_it = entry->
SetAnnot().begin();
602 while ( annot_it != entry->
SetAnnot().end() )
604 if ((*annot_it)->IsSetData() && (*annot_it)->GetData().IsFtable())
608 if ((*feat_it)->IsSetData() && (*feat_it)->GetData().GetSubtype() == feat->
GetData().
GetSubtype() && feat->
Compare(**feat_it) == 0)
621 if (!annot && entry->
IsSet())
637 wxSizerItemList& slist = sizer->GetChildren();
639 for (wxSizerItemList::iterator iter = slist.begin(); iter != slist.end(); ++iter, ++
n) {
640 if ((*iter)->IsSizer()) {
642 }
else if ((*iter)->IsWindow()) {
643 wxWindow* child = (*iter)->GetWindow();
649 wxSizer* subsizer = child->GetSizer();
667 id->GetMatchingIds(matches);
@ eExtreme_Positional
numerical value
@ eExtreme_Biological
5' and 3'
CRef< objects::CSeq_id > GetNewProtId(objects::CBioseq_Handle bsh, int &offset, string &id_label, bool general_only)
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
USING_SCOPE(ncbi::objects)
objects::CSeq_entry_Handle m_TopSeqEntry
bool Create(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
bool GetTopLevelSeqEntryAndProcessor()
void UpdateChildrenFeaturePanels(wxSizer *sizer)
void FindAnnot(CRef< CSeq_entry > entry, const CSeq_feat *feat, CRef< CSeq_annot > &annot)
wxCheckBox * m_EntireRange
~CCdsToMatPeptide()
Destructor.
void ConvertEach(CRef< CCmdComposite > cmd)
virtual CRef< CCmdComposite > GetCommand()
void RemoveFeature(CRef< CSeq_entry > entry, const CSeq_feat *feat)
void MergeConvert(CRef< CCmdComposite > cmd)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CStringConstraintPanel * m_StringConstraintPanel
CRef< CMiscSeqTableColumn > m_col
CFeatureFieldNamePanel * m_FeatureConstraint
virtual string GetErrorMessage()
void RemoveProteins(CRef< CSeq_entry > entry, const CSeq_feat *feat, CSeq_entry_Handle seh)
CRef< CConvertFeatureBase > m_converter
static bool ShowToolTips()
Should we show tooltips?
CCdsToMatPeptide()
Constructors.
COkCancelPanel * m_OkCancel
void ConvertInner(CRef< CCmdComposite > cmd)
void OnRadioButton(wxCommandEvent &event)
wxRadioButton * m_ProductFirst
void Init()
Initialises member variables.
wxTextCtrl * m_ProductName
void CreateControls()
Creates the controls and sizers.
wxRadioButton * m_ProductThis
bool Create(wxWindow *parent, wxWindowID id=10568, const wxString &caption=_("Convert CDS to Mat-peptide"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(900, 500), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void ProcessUpdateFeatEvent(wxCommandEvent &event)
static CRef< CConvertFeatureBase > Create(objects::CSeqFeatData::ESubtype subtype_from, objects::CSeqFeatData::ESubtype subtype_to)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
string x_GetCDSProduct(const objects::CSeq_feat &orig, objects::CScope &scope)
map< CSeq_id_Handle, TSeqPos > m_SeqLen
map< CSeq_id_Handle, set< CSeq_id_Handle > > m_Synonyms
void AddSeq(const CSeq_id_Handle &idh, TSeqType seq_type, TSeqPos seq_len)
virtual TSeqType GetSequenceType(const CSeq_id_Handle &idh)
Get information about sequence type (nuc or prot).
map< CSeq_id_Handle, TSeqType > m_SeqType
void AddSynonym(const CSeq_id_Handle &idh1, const CSeq_id_Handle &idh2)
virtual void CollectSynonyms(const CSeq_id_Handle &id, TSynonyms &synonyms)
Collect all synonyms for the id including the id itself.
virtual TSeqPos GetSequenceLength(const CSeq_id_Handle &idh)
Get sequence length or kInvalidSeqPos.
void PopulateFeatureListbox(void)
virtual string GetFieldName(const bool subfield=false)
Returns the name of the field as selected in the panel.
void ListPresentFeaturesFirst(const objects::CSeq_entry_Handle &entry, vector< const objects::CFeatListItem * > *featlist=nullptr)
vector< CConstRef< CObject > > GetObjects(objects::CBioseq_Handle bsh)
ESubtype GetSubtype(void) const
@ eSubtype_mat_peptide_aa
const TAnnot & GetAnnot(void) const
namespace ncbi::objects::
int Compare(const CSeq_feat &f2) const
Compare relative order of this feature and feature f2, ordering first by features' coordinates,...
CSeq_loc_Mapper_Options –.
CRef< edit::CStringConstraint > GetStringConstraint()
IWorkbench is the central interface in the application framework.
const_iterator end() const
iterator_bool insert(const value_type &val)
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
const string kPartialStart
#define EVT_UPDATE_FEATURE_LIST(id, fn)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
ENa_strand GetStrand(void) const
Get the location's strand.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
void SetPartialStop(bool val, ESeqLocExtremes ext)
bool IsPartialStop(ESeqLocExtremes ext) const
TSeqPos GetStop(ESeqLocExtremes ext) const
CRef< CSeq_loc > Seq_loc_Subtract(const CSeq_loc &loc1, const CSeq_loc &loc2, CSeq_loc::TOpFlags flags, CScope *scope)
Subtract the second seq-loc from the first one.
CRef< CSeq_loc > Seq_loc_Add(const CSeq_loc &loc1, const CSeq_loc &loc2, CSeq_loc::TOpFlags flags, CScope *scope)
Add two seq-locs.
@ eOverlap_Subset
2nd is a subset of 1st ranges
CConstRef< CSeq_feat > GetOverlappingmRNA(const CSeq_loc &loc, CScope &scope)
static CRef< CBioseq > TranslateToProtein(const CSeq_feat &cds, CScope &scope)
CConstRef< CSeq_feat > GetOverlappingGene(const CSeq_loc &loc, CScope &scope, ETransSplicing eTransSplicing=eTransSplicing_Auto)
vector< TFeatScore > TFeatScores
void GetOverlappingFeatures(const CSeq_loc &loc, CSeqFeatData::E_Choice feat_type, CSeqFeatData::ESubtype feat_subtype, EOverlapType overlap_type, TFeatScores &feats, CScope &scope, const TBestFeatOpts opts=0, CGetOverlappingFeaturesPlugin *plugin=NULL)
Find all features overlapping the location.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
CRef< CSeq_loc > MapTotalRange(const CSeq_loc &seq_loc)
Take the total range from the location and run it through the mapper.
CSeq_loc_Mapper_Base & SetMergeAbutting(void)
Merge only abutting intervals, keep overlapping.
CSeq_feat_Handle GetSeq_featHandle(const CSeq_feat &feat, EMissing action=eMissing_Default)
@ eLocationToProduct
Map from the feature's location to product.
TSeqPos GetBioseqLength(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CBioseq_set_Handle GetParentBioseq_set(void) const
Get parent bioseq-set handle.
bool IsProtein(void) const
CSeq_entry_Handle GetParentEntry(void) const
Return a handle for the parent seq-entry of the bioseq.
TInst_Length GetInst_Length(void) const
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
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,...
const TId & GetId(void) const
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
bool IsSetDesc(void) const
description (instead of name) Check if a value has been assigned to Desc data member.
const TDesc & GetDesc(void) const
Get the Desc member data.
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
bool IsProt(void) const
Check if variant Prot is selected.
void SetLocation(TLocation &value)
Assign a value to Location data member.
void SetPartial(TPartial value)
Assign a value to Partial data member.
void SetProduct(TProduct &value)
Assign a value to Product data member.
const TLocation & GetLocation(void) const
Get the Location member data.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
void ResetComment(void)
Reset Comment data member.
const TProduct & GetProduct(void) const
Get the Product member data.
const TProt & GetProt(void) const
Get the variant data.
void ResetProduct(void)
Reset Product data member.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
bool IsInt(void) const
Check if variant Int is selected.
TSet & SetSet(void)
Select the variant.
bool IsSeq(void) const
Check if variant Seq is selected.
void ResetAnnot(void)
Reset Annot data member.
bool IsSet(void) const
Check if variant Set is selected.
TSeq & SetSeq(void)
Select the variant.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
void SetData(TData &value)
Assign a value to Data data member.
void ResetAnnot(void)
Reset Annot data member.
const struct ncbi::grid::netcache::search::fields::SIZE size
double f(double x_, const double &y_)
Utility macros and typedefs for exploring NCBI objects from seq.asn.
#define ERASE_SEQFEAT_ON_SEQANNOT(Itr, Var)
ERASE_SEQFEAT_ON_SEQANNOT.
#define EDIT_EACH_SEQFEAT_ON_SEQANNOT(Itr, Var)
#define FOR_EACH_SEQFEAT_ON_SEQANNOT(Itr, Var)
FOR_EACH_SEQFEAT_ON_SEQANNOT EDIT_EACH_SEQFEAT_ON_SEQANNOT.
Utility macros and typedefs for exploring NCBI objects from seqset.asn.
#define FOR_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
FOR_EACH_SEQENTRY_ON_SEQSET EDIT_EACH_SEQENTRY_ON_SEQSET.
#define EDIT_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
#define ERASE_SEQENTRY_ON_SEQSET(Itr, Var)
ERASE_SEQENTRY_ON_SEQSET.
void GetProductToCDSMap(objects::CScope &scope, map< objects::CBioseq_Handle, set< objects::CSeq_feat_Handle > > &product_to_cds)
CRef< CCmdComposite > GetDeleteFeatureCommand(const objects::CSeq_feat_Handle &fh, bool remove_proteins=true)