52 #include <wx/filename.h>
54 #include <wx/msgdlg.h>
112 const CSeq_loc* loc =
dynamic_cast<const CSeq_loc*
>(iter->object.GetPointer());
113 CScope* scope = iter->scope;
118 ostr <<
">" <<
"lcl|" << loc_id << endl;
123 ostr <<
data << endl;
153 m_ToolName(tool_name)
162 m_TmpIn = wxFileName::CreateTempFileName(
wxT(
"in"));
163 m_TmpOut = wxFileName::CreateTempFileName(
wxT(
"out"));
172 wxT(
"Preparing data for alignment..."));
174 bool ors =
false, ands =
true;
176 ors = ors || iter->second;
177 ands = ands && iter->second;
183 m_ToolName +
wxT(
" tool: All input sequences must be either DNA or protein."),
184 wxT(
"Error"), wxOK | wxICON_ERROR
197 if (working_dir.IsEmpty()) {
202 env.cwd = working_dir;
206 string error(
"Failed to launch ");
208 error +=
" executable.";
225 ::wxKill(
m_PId, wxSIGKILL);
229 ncbi::CProcess
proc(
static_cast<int>(
m_PId), ncbi::CProcess::ePid);
230 if (!
proc.IsAlive()) {
236 if (
size == 0 ||
size == wxInvalidSize) {
254 LOG_POST(
Error <<
"CMSAToolJob::x_CreateProjectItems(): more than one alignment!");
271 align = mapper.
Map( *align );
276 annot->
SetData().SetAlign().push_back(align);
280 string align_title(
m_ToolName +
" alignment: ");
281 align_title += title;
285 string comment =
"Generated by ";
287 comment +=
" tool with command line : \n";
292 item->
SetItem().SetAnnot(*annot);
305 err_msg =
"Failed to generate alignment:\n" + e.
GetMsg();
307 catch (std::exception& e) {
308 err_msg =
"Failed to generate alignment:\n" +
string(e.
what());
311 if (!err_msg.empty())
338 const int kLabelId = 0;
339 const int kSeqIdId = 2;
342 feat_descr->SetId(kSeqIdId);
343 feat_descr->SetName(
"seq-id");
344 btc->
SetFdict().Set().push_back(feat_descr);
347 if (!(*node)->CanGetFeatures()) {
351 (*node)->SetFeatures().Set()) {
352 if ((*node_feature)->GetFeatureid() == kLabelId) {
354 id_node_feature->SetFeatureid(kSeqIdId);
355 id_node_feature->SetValue((*node_feature)->GetValue());
356 (*node)->SetFeatures().Set().push_back(id_node_feature);
363 <<
"Failed to read phylogenetic tree:\n"
365 <<
"\nPhylogenetic tree output will not be available.");
369 catch (
const std::exception& e) {
371 <<
"Failed to read phylogenetic tree:\n"
373 <<
"\nPhylogenetic tree output will not be available.");
381 string tree_title =
"Phylogenetic tree: " + title;
385 item->
SetItem().SetOther().Set(*btc);
User-defined methods of the data storage class.
User-defined methods of the data storage class.
std::invoke_result< _Fty, ICanceled & >::type GUI_AsyncExec(_Fty &&_Fnarg, const wxString &msg=wxT("Accessing network..."))
void AddProjectItem(objects::CProjectItem &item)
CRef< objects::CScope > m_Scope
Base class for reading FASTA sequences.
Storage for multiple mapping ranges.
void SetNameDesc(const string &name)
void SetCreateDate(const CTime &dt)
Simple implementation of ILineReader for i(o)streams.
definition of a Culling tree
Template class for iteration on objects of class C.
Interface for testing cancellation request in a long lasting operation.
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
CRef< objects::CBioTreeContainer > MakeBioTreeContainer(const TPhyTreeNode *tree)
Conversion from TPhyTreeNode to CBioTreeContainer.
Operators to edit gaps in sequences.
#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 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)
#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.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
TIdMap m_IdMap
to make the alignment as robust as possible, we assign every sequence a unique identifer independeont...
virtual TConstScopedObjects & x_GetObjects()=0
Returns the sequences that will be aligned.
pair< CConstRef< objects::CSeq_loc >, CRef< objects::CScope > > TLocPair
virtual wxString x_GetWorkingDirectory() const
Returns the directory where to execute the msa tool.
virtual void x_CreateProjectItems()
override this function in derived classes and populate m_Items.
virtual wxString x_GetCommandLine(const wxString &input, const wxString &output, bool is_nucleotide)=0
Returns the command line, that will be used to execute the third-party tool.
virtual bool BeforeRun()
Function will be called on the main thread before execution of Run Should not do any lengthy work ret...
objects::CMappingRanges m_Ranges
virtual void x_AddTreeProjectItem(const string &title, const string &comment)
CMSAToolJob(const wxString &tool_name)
CMSAToolJob.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
virtual bool IsCanceled() const override
vector< SConstScopedObject > TConstScopedObjects
CRef< CSeq_entry > ReadAlignedSet(int reference_row, ILineErrorListener *pMessageListener=nullptr)
Read as many sequences as are available, and interpret them as an alignment, with hyphens marking rel...
@ fParseGaps
Make a delta sequence if gaps found.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
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,...
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
TSeqPos GetStart(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the start of the location.
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
void SetSeqTypeById(const CSeq_id_Handle &idh, ESeqType seqtype) const
Methods for setting sequence types.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void AddConversion(CRef< CMappingRange > cvt)
Add new mapping range to the proper place.
bool IsNucleotide(void) const
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
TObjectType * GetPointer(void) 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.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
@ eCurrent
Use current time. See also CCurrentTime.
Fun TreeDepthFirstTraverse(TTreeNode &tree_node, Fun func)
Depth-first tree traversal algorithm.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
const TValue & GetValue(void) const
Return node's value.
@ eTreeTraverse
Keep traversal.
static const char label[]
void SetNodes(TNodes &value)
Assign a value to Nodes data member.
void SetFdict(TFdict &value)
Assign a value to Fdict data member.
list< CRef< CNodeFeature > > Tdata
void SetTreetype(const TTreetype &value)
Assign a value to Treetype data member.
list< CRef< CNode > > Tdata
TDescr & SetDescr(void)
Assign a value to Descr data member.
void SetLabel(const TLabel &value)
Assign a value to Label data member.
void SetItem(TItem &value)
Assign a value to Item data member.
void SetData(TData &value)
Assign a value to Data data member.
TComment & SetComment(void)
Select the variant.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines a portable execute class.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
TPhyTreeNode * ReadNewickTree(CNcbiIstream &is)
Newick format input.
ETreeTraverseCode operator()(TPhyTreeNode &node, int level)