59 #include <wx/filename.h>
70 "Search/Find Repetitive Sequences with WindowMasker",
71 "Find low-complexity sequences using WindowMasker "
72 "data rearrangements and clarifications",
73 "https://www.ncbi.nlm.nih.gov/tools/gbench/tutorial2/",
81 return "windowmasker_tool";
87 return "Windowmasker Tool";
126 wxFileName fname(storage.
GetPath(), wxEmptyString);
129 wxDir dir(fname.GetPath());
130 if (dir.IsOpened()) {
133 bool cont = dir.GetFirst(&dirName, wxEmptyString, wxDIR_DIRS);
135 cont = dir.GetNext(&dirName)
137 fname.AppendDir(dirName);
142 return fname.GetPath();
155 if ( !wxFileName::FileExists(path) ) {
156 static const wxChar* sc_Files[] = {
157 wxT(
"wmasker.obinary"),
158 wxT(
"wmasker.oascii"),
162 for (
const wxChar** p = sc_Files; p && *p; ++p) {
163 wxString filepath = wxFileName(path, *p).GetFullPath();
164 if (wxFileName::FileExists(filepath)) {
170 if ( !wxFileName::FileExists(path) ) {
172 wxT(
"Failed to find WindowMasker statistics file\nat ") + path,
174 wxT(
"WindowMasker Run Tool")
190 if (!o.scope)
continue;
191 const CSeq_loc* seqLoc =
dynamic_cast<const CSeq_loc*
>(o.object.GetPointerOrNull());
192 if (!seqLoc)
continue;
238 #if defined(NCBI_OS_UNIX)
274 if ( !wxFileName::FileExists(path) ) {
275 static const wxChar* sc_Files[] = {
276 wxT(
"wmasker.obinary"),
277 wxT(
"wmasker.oascii"),
281 for (
const wxChar** p = sc_Files; p && *p; ++p) {
282 wxString filepath = wxFileName(path, *p).GetFullPath();
283 if (wxFileName::FileExists(filepath)) {
289 if ( !wxFileName::FileExists(path) ) {
294 vector<SMaskResult> mask_res;
299 wxString prog_name =
wxT(
"windowmasker");
301 prog_name +=
wxT(
".exe");
306 wxFileName fname(agent_path, wxEmptyString);
307 #if !defined( NCBI_OS_DARWIN ) || defined( _DEBUG )
308 fname.AppendDir(
wxT(
"bin"));
310 fname.SetFullName(prog_name);
312 string agent_path_utf8(fname.GetFullPath().ToUTF8());
315 args.push_back(
"-ustat");
316 string lstat_name(path.ToUTF8());
317 args.push_back(lstat_name);
318 args.push_back(
"-outfmt");
319 args.push_back(
"seqloc_asn1_text");
320 args.push_back(
"-parse_seqids");
324 ITERATE(vector<string>, arg, args){
325 agent_args += *arg +
" ";
330 ERR_POST(
Trace <<
"We are about to start program on path '" << agent_path_utf8 <<
"'");
337 CScope& scope =
const_cast<CScope&
>(o.scope.GetObject());
341 name +=
": WindowMasker Repeat Regions";
349 fastm.
Write(handle, &loc);
362 Info <<
"Command completed with status "
369 switch (res_loc->
Which()){
377 pair_loc->
SetInt(**int_iter);
382 mask_res.push_back(rv);
393 mask_res.push_back(rv);
406 string lstat_name(path.ToUTF8());
429 size_t count_failures = 0;
432 CScope& scope =
const_cast<CScope&
>(o.scope.GetObject());
439 name +=
": WindowMasker Repeat Regions";
444 unique_ptr<CSeqMasker::TMaskList> mask_list( masker( vec ) );
453 CSeqMasker::TMaskList::const_iterator it = mask_list->begin();
454 it != mask_list->end();
457 tmp_loc.
SetInt().SetFrom( it->first );
458 tmp_loc.
SetInt().SetTo( it->second );
466 mask_res.push_back( rv );
472 if (output_type == 0 || output_type == 2) {
484 feat->
SetData().SetImp().SetKey(
"repeat_region");
486 annot->
SetData().SetFtable().push_back(feat);
492 item->
SetItem().SetAnnot(*annot);
501 if (output_type == 1 || output_type == 2) {
508 big_mask_loc->
Add(**locitr);
User-defined methods of the data storage class.
CConn_PipeStream for command piping.
CDataLoadingAppJob - a base class for Jobs loading data into projects.
void AddProjectItem(objects::CProjectItem &item)
FASTA-format output; see also ReadFasta in <objtools/readers/fasta.hpp>
Main interface to window based masker functionality.
void SetNameDesc(const string &name)
void SetCreateDate(const CTime &dt)
namespace ncbi::objects::
static wxString GetStdPath(void)
the applicaton installation directory.
static CWinMaskerFileStorage & GetInstance()
access the application-wide singleton
CWindowMaskerJob(const CWindowMaskerParams ¶ms)
TProcessHandle m_ProcHandle
virtual void RequestCancel()
RequestCancel() is called to notify the Job that it shall exit Run() function ASAP.
CWindowMaskerParams m_Params
virtual void x_CreateProjectItems()
override this function in derived classes and populate m_Items.
void SetObjects(TConstScopedObjects *objects)
CWindowMaskerParams & GetData()
Data access.
void SetData(const CWindowMaskerParams &data)
bool Create(wxWindow *parent, wxWindowID id=ID_CWINDOWMASKERPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
Creation.
virtual void LoadSettings()
int GetOutputType() const
const TConstScopedObjects & GetObjects() const
bool GetStandalone() const
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
#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.
CPipe & GetPipe(void)
Return an underlying CPipe; it's valid for as long as the stream exists.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#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 Trace(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
static CRef< objects::CSeq_loc > RemapChildToParent(const objects::CSeq_loc &parent, const objects::CSeq_loc &child, objects::CScope *scope=NULL)
remap a location to a parent location.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
string m_Descr
mutex to sync our internals
EDialogReturnValue NcbiMessageBoxW(const wxString &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const wxString &title=wxT("Error"), EDialogTextMode text_mode=eRaw)
virtual bool IsCanceled() const override
virtual void RequestCancel() override
RequestCancel() is called to notify the Job that it shall exit Run() function ASAP.
vector< SConstScopedObject > TConstScopedObjects
#define MSerial_AsnText
I/O stream manipulators –.
void SetPacked_int(TPacked_int &v)
void Add(const CSeq_loc &other)
Simple adding of seq-locs.
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
virtual void Write(const CSeq_entry_Handle &handle, const CSeq_loc *location=0)
Unspecified locations designate complete sequences; non-empty custom titles override the usual title ...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void Reset(void)
Reset reference object.
TProcessHandle GetProcessHandle(void) const
Get the process handle for the piped child.
EIO_Status CloseHandle(EChildIOHandle handle)
Close the specified child's pipe handle (even for CPipe opened with OpenSelf()).
EIO_Status Close(int *exitcode=0)
Close pipe.
@ fStdErr_Share
Keep stderr (share it with child)
bool Kill(unsigned long timeout=kDefaultKillTimeout)
Terminate process.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
@ eCurrent
Use current time. See also CCurrentTime.
const char * IO_StatusStr(EIO_Status status)
Get the text form of an enum status value.
#define INVALID_HANDLE_VALUE
A value for an invalid file handle.
void SetLabel(const TLabel &value)
Assign a value to Label data member.
void SetItem(TItem &value)
Assign a value to Item data member.
void SetLocation(TLocation &value)
Assign a value to Location data member.
void SetData(TData &value)
Assign a value to Data data member.
E_Choice Which(void) const
Which variant is currently selected.
void SetData(TData &value)
Assign a value to Data data member.
vector< CRef< CSeq_loc > > mask_locs