61 "Remove redundant elements from alignments",
62 "Merge and remove redundant elements from alignments to "
63 "create a cleaner diagonalized representation",
64 "https://www.ncbi.nlm.nih.gov/tools/gbench/tutorial1/#manipulate",
65 "Alignment Creation"),
73 return "cleanup_alignments_tool_manager";
79 return "Clean Up Alignments Tool";
124 err =
"Please select at least one set of alignments!";
164 for(
int q = 0; q < num_seqs; q++ ){
170 if( idh_set.
size() > 1 ){
206 m_Descr =
"Cleaning alignments";
214 if (annot.IsSetDesc()) {
215 ITERATE (CSeq_annot::TDesc::Tdata, iter, annot.GetDesc().Get()) {
216 const CAnnotdesc& desc = **iter;
217 if ( !desc.IsName() ) {
221 annot_name = desc.GetName();
242 }
else if (scope != &*iter->scope) {
265 (
dynamic_cast<const CSeq_align*
>(&*iter->object));
267 aligns_in.push_back(al);
277 cleanup.Cleanup(aligns_in, aligns_out_tmp,
301 (
dynamic_cast<const CSeq_align*
>(&*iter->object));
308 if(hitref->GetIdentity() >= min_idty &&
309 hitref->GetLength() >= min_len)
311 if(hitref->GetQueryStrand() ==
false) {
312 hitref->FlipStrands();
314 hitrefs.push_back(hitref);
319 if(hitref->GetIdentity() >= min_idty &&
320 hitref->GetLength() >= min_len)
322 if(hitref->GetQueryStrand() ==
false) {
323 hitref->FlipStrands();
325 hitrefs.push_back(hitref);
331 if ( !hitrefs.size() ) {
341 hitrefs.erase(
remove_if(hitrefs.begin(), hitrefs.end(),
343 copy(hits_new.begin(), hits_new.end(), back_inserter(hitrefs));
355 const THit& h = **ii;
372 vector< CRef< CSeq_id > > &ids = ds->
SetIds();
373 for(
Uint1 where = 0; where < 2; ++where) {
376 id->Assign(*h.
GetId(where));
382 score->SetValue().SetReal(h.
GetScore());
383 scores.push_back(score);
387 seq_align->
SetSegs().SetDenseg(*ds);
388 align_list.push_back(seq_align);
410 if (aligns_out.size()) {
422 aligns_out_tmp.push_back(al);
426 string annot_base_name(
"Cleaned Alignment: ");
443 string name(
"Cleaned Alignment: ");
445 if ( !name.empty() ) {
446 annot->SetNameDesc(name);
447 annot->SetTitleDesc(name);
452 pitem->
SetItem().SetAnnot(*annot);
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void remove_if(Container &c, Predicate *__pred)
class CAlignCleanup implements an alignment cleanup utility based on the C++ alignment manager.
list< CConstRef< CSeq_align > > TConstAligns
list< CRef< CSeq_align > > TAligns
void GroupByStrand(const TAlignList &aligns, TAnnotList &align_groups, const string &annot_base_name, objects::CScope &scope)
Group alignments into bins for each set of strands.
list< CRef< objects::CSeq_align > > TAlignList
list< CRef< objects::CSeq_annot > > TAnnotList
bool GetQueryStrand(void) const
TCoord GetQueryStart(void) const
static string s_RunLengthDecode(const string &in)
TCoord GetSubjStart(void) const
bool GetSubjStrand(void) const
const TId & GetId(Uint1 where) const
const TTranscript & GetTranscript(void) const
float GetScore(void) const
CDataLoadingAppJob - a base class for Jobs loading data into projects.
void AddProjectItem(objects::CProjectItem &item)
void FromTranscript(TSeqPos query_start, ENa_strand query_strand, TSeqPos subj_start, ENa_strand subj_strand, const string &transcript)
Initialize from pairwise alignment transcript (a string representation produced by CNWAligner)
void AddScore(CScope &scope, CSeq_align &align, EScoreType score)
deprecated: use CSeq_align::EScoreType directly
TDim CheckNumRows(void) const
Validatiors.
const CSeq_id & GetSeq_id(TDim row) const
Get seq-id (the first one if segments have different ids).
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
iterator_bool insert(const value_type &val)
CSplign::THitRefs THitRefs
static void cleanup(void)
static void s_RunGreedy(typename THitRefs::iterator hri_beg, typename THitRefs::iterator hri_end, THitRefs *phits_new, TCoord min_hit_len=100, double min_hit_idty=.9, TCoord margin=1, TCoord retain_overlap=0, EUnique_type unique_type=e_Strict)
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.
#define NCBI_USER_THROW(message)
Throw a quick-and-dirty runtime exception of type 'CException' with the given error message and error...
bool x_AreSelfAlignmentsOnly() const
virtual CAlgoToolManagerParamsPanel * x_GetParamsPanel()
returns a pointer to the parameters panel, override in derived classes
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
SCleanupAlignmentsParams m_Params
bool m_AlnMgr_PreserveRows
void SetParams(SCleanupAlignmentsParams *params, TConstScopedObjects *objects)
virtual IRegSettings * x_GetParamsAsRegSetting()
return a pointer to Parameters object as IRegSettings interface
TConstScopedObjects m_Alignments
virtual CDataLoadingAppJob * x_CreateLoadingJob()
factory method for creating the job that executes the tool algorithm override in derived classes
CCleanupAlignmentsToolManager()
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
bool Create(wxWindow *parent, wxWindowID id=ID_CCLEANUPALIGNMENTSPARAMSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
virtual void x_CreateProjectItems()
override this function in derived classes and populate m_Items.
CCleanupAlignmentsJob(const SCleanupAlignmentsParams ¶ms)
CCleanupAlignmentsJob.
int m_HitFilter_MinLength
virtual bool x_CreateParamsPanelIfNeeded()
returns / creates Parameters panel, override in derived classes see cpp file for example
virtual void InitUI()
override this function in a derived class and initialize extra members
CCleanupAlignmentsParamsPanel * m_ParamsPanel
virtual bool x_ValidateParams()
validates user input in Parameters panel, report errors if any
void x_SelectCompatibleInputObjects()
select only Seq-aligns
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
SCleanupAlignmentsParams m_Params
TConstScopedObjects m_Alignments
float m_HitFilter_MinIdentity
bool m_AlnMgr_FillUnaligned
virtual void CleanUI()
override this function in a derived class and clean extra members
virtual void LoadSettings()
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
string m_Descr
mutex to sync our internals
void NcbiErrorBox(const string &message, const string &title="Error")
specialized Message Box function for reporting critical errors
virtual const string & GetLabel() const
vector< SConstScopedObject > TConstScopedObjects
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
void Reset(void)
Reset reference object.
uint8_t Uint1
1-byte (8-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
@ eCurrent
Use current time. See also CCurrentTime.
void SetLabel(const TLabel &value)
Assign a value to Label data member.
void SetItem(TItem &value)
Assign a value to Item data member.
void SetSegs(TSegs &value)
Assign a value to Segs data member.
TScores & SetScores(void)
Assign a value to Scores data member.
void ResetStrands(void)
Reset Strands data member.
void SetType(TType value)
Assign a value to Type data member.
bool IsDisc(void) const
Check if variant Disc is selected.
vector< CRef< CScore > > TScores
list< CRef< CSeq_align > > Tdata
TIds & SetIds(void)
Assign a value to Ids data member.
const TDisc & GetDisc(void) const
Get the variant data.
const Tdata & Get(void) const
Get the member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
@ eType_disc
discontinuous alignment
ENa_strand
strand of nucleic acid
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)