66 const string& parms_file,
67 const string& table_xform,
68 const string& accession);
81 arg_desc->AddOptionalKey(
"xform",
"TransformationType",
82 "Desired transformation for table - none, seqlocs or features. Default: none",
85 arg_desc->AddOptionalKey(
"acc",
"Accession",
86 "Optional accession, e.g. GCF_000001405.17, used to look up ids for chromosome fields",
89 arg_desc->AddOptionalKey(
"table-format",
"TableFormatDescription",
90 "ASN table format description for table(s) being imported",
100 const string& parms_file,
101 const string& table_xform,
102 const string& accession)
108 string transformation_type = table_xform;
112 if (parms_file ==
"") {
124 for (
size_t i=0;
i<delims.size(); ++
i)
134 if (accession !=
"") {
148 LOG_POST(
Error <<
"Could not find a delimiter for table: " << fname);
154 LOG_POST(
Error <<
"Could not open parameters file: " << parms_file);
159 LOG_POST(
Info <<
"Loading Parameters file: " << parms_file);
164 if (table_xform ==
"" &&
165 user_object.
HasField(
"conversion-type") &&
167 transformation_type = user_object.
168 GetField(
"conversion-type").
GetData().GetStr();
171 success = ds->
LoadTable(fname, user_object);
187 string output_type =
"";
197 if (transformation_type ==
"seqlocs") {
198 vector<CTableAnnotDataSource::STableLocation> locations =
201 if (locations.size() == 0) {
205 for (
size_t i=0;
i<locations.size(); ++
i) {
206 if (!locations[
i].m_IsRsid)
207 success = annot_table_ds->
AddSeqLoc(locations[
i],
static_cast<int>(
i+1),
NULL);
211 output_type =
".locs";
214 else if (transformation_type ==
"features") {
215 vector<CTableAnnotDataSource::STableLocation> locations =
220 if (locations.size() > 1) {
221 LOG_POST(
Error <<
"Unable to create features - table has more than 1 location per row");
224 else if (locations.size() == 0) {
228 if (!locations[0].m_IsRsid)
232 output_type =
".feats";
236 string out_fname = fname + output_type +
".asn";
238 annot_table_ds->
WriteAsn(out_fname);
253 if (args.
Size() == 0)
257 string table_xform =
"";
258 string accession =
"";
264 if (parsed_args[
"table-format"].
HasValue()) {
265 parms_file = parsed_args[
"table-format"].AsString();
266 LOG_POST(
Info <<
"Loading tables using format from asn file: " <<
270 if (parsed_args[
"xform"].
HasValue()) {
271 table_xform = parsed_args[
"xform"].AsString();
275 if (parsed_args[
"acc"].
HasValue()) {
276 accession = parsed_args[
"acc"].AsString();
279 for (
size_t idx = 1; idx<=parsed_args.
GetNExtra(); ++idx) {
280 string arg = parsed_args[idx].AsString();
289 string ext =
file.GetExt();
291 cout <<
"Skipping asn file: " << arg << endl;
297 LoadTable(arg, parms_file, table_xform, accession);
300 cout <<
"file: " << arg <<
" is not a file name" << endl;
302 " is not a file name.\n");
void SetAssemblyAcc(string value)
bool AddSeqLoc(const STableLocation &fc, int loc_number, ICanceled *cancel=NULL)
Add a location to the table based on the specified columns.
CRef< CSeq_annot > GetContainer()
vector< STableLocation > FindLocations(string &msg, bool strand_required)
Find colums that can be combined to form locations based on column info If no locations are found,...
bool CreateSnpFeature(const STableLocation &fc, ICanceled *cancel=NULL)
Create a region feature for each snp using specified snp (rsid) column.
bool AddSnpSeqLoc(const STableLocation &fc, int loc_number, ICanceled *cancel=NULL)
Add a location to the table using the rsid (snp/variation) ids location from the snp db.
bool CreateFeature(const STableLocation &fc, ICanceled *cancel=NULL)
Create a feature using specified columns.
void WriteAsn(const string &fname)
Write seqtable to file 'fname'.
CTableColumnTypeGuesser -.
void GuessColumns()
Update columns in data source with type info based on best-guesses.
const vector< char > & GetDelimiters() const
bool GetMergeDelimiters() const
CTableImportDataSource -.
const CTableDelimiterRules & GetDelimiterRules() const
Get set all delimiter rules (for delimited tables)
vector< CTableImportColumn > & GetColumns()
return the array of column data
EFieldSeparatorType GetTableType() const
bool LoadTable(const wxString &fname, CUser_object &user_object)
void ConvertToSeqAnnot(CRef< CSeq_annot > annot_container)
Save data in table into annot_container.
int Run(void)
Run the application.
void LoadTable(const string &fname, const string &parms_file, const string &table_xform, const string &accession)
void Init(void)
Initialize the application.
bool HasField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Verify that a named field exists.
const CUser_field & GetField(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Access a named field in this user object.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
size_t GetNExtra(void) const
Get the number of unnamed positional (a.k.a. extra) args.
@ eRegularArgs
Regular application.
@ eString
An arbitrary string.
void SetDiagPostFlag(EDiagPostFlag flag)
Set the specified flag (globally).
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
void SetDiagTrace(EDiagTrace how, EDiagTrace dflt=eDT_Default)
Set the diagnostic trace settings.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
@ eDPF_All
All flags (except for the "unusual" ones!)
@ eDS_ToMemory
Keep in a temp.memory buffer, see FlushMessages()
@ eDT_Enable
Enable messages of severity "eDiag_Trace".
@ eDiag_Info
Informational message.
SIZE_TYPE Size(void) const
Get size (number) of arguments.
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
void Info(CExceptionArgs_Base &args)
#define MSerial_AsnText
I/O stream manipulators –.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static string & ToLower(string &str)
Convert string to lower case – string& version.
const TData & GetData(void) const
Get the Data member data.
bool IsStr(void) const
Check if variant Str is selected.
const TData & GetData(void) const
Get the Data member data.
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines unified interface to application:
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
Process information in the NCBI Registry, including working with configuration files.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
int NcbiSys_main(int argc, ncbi::TXChar *argv[])