NCBI C++ ToolKit
clustalw_tool_job.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: clustalw_tool_job.cpp 38490 2017-05-16 18:21:11Z evgeniev $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors: Roman Katargin
27 */
28 
29 
30 #include <ncbi_pch.hpp>
31 
33 
34 #include <wx/filename.h>
35 #include <wx/sstream.h>
36 #include <wx/txtstrm.h>
37 #include <wx/utils.h>
38 
41 
42 ///////////////////////////////////////////////////////////////////////////////
43 /// CClustalwToolJob
45  : CMSAToolJob("ClustalW")
46  , m_Params(params)
47 {
48  m_Descr = "ClustalW Job";
49 }
50 
51 wxString CClustalwToolJob::x_GetCommandLine(const wxString &input, const wxString &output, bool is_nucleotide)
52 {
53  wxString clustalwExe = m_Params.GetClustalWPath();
54  if (!wxFileName::FileExists(clustalwExe)) {
55  NCBI_THROW(CException, eUnknown, "Path to ClustalW executable does not exist!");
56  }
57 
59  m_TmpTreeOut = wxFileName::CreateTempFileName(wxT("tree"));
60 
61  ///
62  /// compose the ClustalW command line
63  ///
64 
65  wxStringOutputStream strstr;
66  wxTextOutputStream os(strstr);
67 
68  os << wxT("\"") << clustalwExe << wxT("\"")
69  << wxT(" -INFILE=") << input
70  << wxT(" -OUTFILE=") << output
71  << wxT(" -OUTPUT=FASTA")
72  << wxT(" -ALIGN");
73 
74  if (!m_TmpTreeOut.empty()) {
75  os << wxT(" -OUTPUTTREE=nexus")
76  << wxT(" -NEWTREE=") << m_TmpTreeOut
77  << wxT(" -TREE");
78  }
79 
80  wxString moreParams = m_Params.GetCommandLine();
81  moreParams.Trim(true);
82  moreParams.Trim(false);
83  if (!moreParams.empty())
84  os << wxT(" ") << moreParams;
85 
86  wxString cmdline = strstr.GetString();
87 
88  return strstr.GetString();
89 }
90 
92 
string m_Descr
mutex to sync our internals
static SQLCHAR output[256]
Definition: print.c:5
wxString GetCommandLine() const
virtual wxString x_GetCommandLine(const wxString &input, const wxString &output, bool is_nucleotide)
Returns the command line, that will be used to execute the third-party tool.
wxString m_TmpTreeOut
CClustalwToolJob(const CClustalwToolParams &params)
CClustalwToolJob.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
wxString GetClustalWPath() const
CClustalwToolParams m_Params
#define wxT(x)
Definition: muParser.cpp:41
USING_SCOPE(objects)
CMSAToolJob Provides basic functionality for the integration of third-party multiple sequence alignme...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string...
Definition: ncbiexpt.hpp:547
static std::unique_ptr< CParams > params
Definition: wgs_params.cpp:491
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
static int input()
Modified on Sat Apr 21 13:40:43 2018 by modify_doxy.py rev. 546573