39 #include <wx/msgdlg.h>
101 bool modified =
false;
103 string strain_str, serotype_str;
104 bool found_strain =
false, found_serotype =
false;
107 if ((*orgmod)->IsSetSubtype() && (*orgmod)->IsSetSubname()) {
109 strain_str = (*orgmod)->GetSubname();
113 serotype_str = (*orgmod)->GetSubname();
114 found_serotype =
true;
118 if (!found_strain || !found_serotype)
122 string infl_name =
"Influenza A virus";
123 string infl_name_wstrain = infl_name +
" (" + strain_str +
")";
124 string new_name = infl_name +
" (" + strain_str +
"(" + serotype_str +
"))";
131 biosource.
SetOrg().SetTaxname(new_name);
144 bool modified =
false;
157 new_taxname.insert(pos + 5,
" ");
161 biosource.
SetOrg().SetTaxname(new_taxname);
170 bool modified =
false;
173 bool found_multiple_strain =
false;
174 list<string> array_str;
176 if ((*orgmod)->IsSetSubtype() && (*orgmod)->IsSetSubname()) {
178 string multiple_strain = (*orgmod)->GetSubname();
181 found_multiple_strain =
true;
184 (*orgmod)->SetSubname() = array_str.front();
190 if (found_multiple_strain && array_str.size()>1) {
191 list<string>::iterator it = array_str.begin();
193 for (it; it != array_str.end(); ++it) {
196 if (!strain.empty()) {
198 biosource.
SetOrg().SetOrgname().SetMod().push_back(new_orgmod);
209 bool modified =
false;
211 if ((*orgmod)->IsSetSubtype() && (*orgmod)->IsSetSubname()) {
218 string multiple_mod = (*orgmod)->GetSubname();
220 bool atleastone =
false;
222 list<string>::iterator iter;
225 for (iter =
tmp.begin(); iter !=
tmp.end(); iter++) {
227 if (!(*iter).empty())
233 while (iter !=
tmp.end() && (*iter).empty())
235 (*orgmod)->SetSubname() = *iter;
240 while (iter !=
tmp.end()) {
241 if (!(*iter).empty()) {
243 biosource.
SetOrg().SetOrgname().SetMod().insert(orgmod, new_orgmod);
262 bool modified =
false;
267 vector<string> array_str;
271 if (array_str.size() >
len) {
276 new_taxname = array_str[0] +
" ";
279 short index = uncult ? 1 : 0;
280 bool is_spec_word =
false;
282 while (index < (
short)array_str.size()
283 && ((uncult && index < 4) || (!uncult && index < 3))
290 new_taxname += array_str[index] +
" ";
292 if (index < (
short)array_str.size()) {
293 new_taxname += array_str[index];
297 if ((uncult && index < 3) || (!uncult && index < 2)) {
298 new_taxname += array_str[index] +
" ";
306 if (new_taxname.back() ==
':') {
307 new_taxname.pop_back();
310 biosource.
SetOrg().SetTaxname() = new_taxname;
323 int nr_conflicts = 0;
333 if (nr_conflicts > 0) {
335 +
" affected fields already contain a value. Do you wish to overwrite existing text?";
337 wxYES_NO | wxCANCEL | wxICON_QUESTION);
352 else if (nr_conflicts == 0) {
361 int nr_conflicts = 0;
370 if (nr_conflicts > 0) {
373 else if (nr_conflicts == 0) {
382 if ((*it)->IsSource()) {
397 string strain, serotype;
418 list<string> array_str;
423 if (array_str.size() > 3) {
424 wxMessageBox(
wxT(
"Warning"),
425 wxT(
"Cannot distinguish the strain from the serotype as there are additional '(' characters."),
429 else if (array_str.size() == 3) {
430 strain = *(++array_str.begin());
431 serotype = array_str.back();
436 while (pos !=
NPOS) {
442 while (pos !=
NPOS) {
448 else if (array_str.size() == 2) {
449 strain = array_str.back();
451 while (pos !=
NPOS) {
470 if ((*orgmod)->IsSetSubtype() && (*orgmod)->IsSetSubname()) {
494 new_feat->
Assign(feat_it->GetOriginalFeature());
505 if ((*it)->IsSource()) {
508 new_desc->
Assign(orig_desc);
525 string strain, serotype;
534 CBioSource& biosource,
const string& strain,
const string& serotype,
bool update)
547 bool modified =
false;
549 bool found_strain =
false, found_serotype =
false;
551 if((*orgmod)->IsSetSubtype() && (*orgmod)->IsSetSubname()){
555 (*orgmod)->SetSubname() = strain;
562 if (update && !serotype.empty() && !
NStr::EqualCase((*orgmod)->GetSubname(), serotype)){
563 (*orgmod)->SetSubname() = serotype;
572 orgname.
SetMod().push_back(new_strain);
575 if (!serotype.empty() && !found_serotype){
577 orgname.
SetMod().push_back(new_serotype);
const string & GetTaxname(void) const
bool IsSetOrgMod(void) const
bool IsSetTaxname(void) const
void AddCommand(IEditCommand &command)
@OrgMod.hpp User-defined methods of the data storage class.
namespace ncbi::objects::
void x_ParseStrainSerotype(CCmdComposite *composite)
bool x_SplittingStructCollections(objects::CBioSource &biosource)
void x_ParseEntry(CCmdComposite *composite, bool update)
CRef< CCmdComposite > GetCommand(objects::CSeq_entry_Handle tse, const string &title)
void x_TestEntryForParsing(const objects::CSeq_entry &se, int &count)
bool x_FixupOrganismNames(objects::CBioSource &biosource)
void x_TestBiosourceForParsing(const objects::CBioSource &biosource, int &count)
bool x_TrimmingOrganismNames(objects::CBioSource &biosource)
bool x_UpdateStrainSerotype(objects::CBioSource &biosource, const string &strain, const string &serotype, bool update)
virtual bool x_ApplyToBioSource(objects::CBioSource &biosource)
void x_ParseDescriptors(const objects::CSeq_entry &se, CCmdComposite *composite, bool update)
bool x_IsParsableInfluenzaVirusName(const objects::CBioSource &biosource, string &strain, string &serotype)
bool x_AddToInfluenzaNames(objects::CBioSource &biosource)
int x_GetStrainSerotypeConflicts(const objects::CBioSource &biosource, const string &strain, const string &serotype)
bool x_SplittingQualifiersAtCommas(objects::CBioSource &biosource)
@ eCommandInfluenza_fixup
@ eCommandTrimOrganismNames
@ eCommandSplitQualsAtCommas
@ eCommandSplitStructuredCollections
@ eCommandInfluenza_parse
bool x_ParseBiosource(objects::CBioSource &biosource, bool update)
objects::CSeq_entry_Handle m_Seh
void x_ApplyToSeqAndFeat(CCmdComposite *composite)
void CleanupForTaxnameChange(CObjectInfo oi)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eTrunc_End
Truncate trailing spaces only.
@ eNocase
Case insensitive compare.
@ eCase
Case sensitive compare.
const TOrg & GetOrg(void) const
Get the Org member data.
void SetOrg(TOrg &value)
Assign a value to Org data member.
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
bool IsSetMod(void) const
Check if a value has been assigned to Mod data member.
bool IsSetOrgname(void) const
Check if a value has been assigned to Orgname data member.
TMod & SetMod(void)
Assign a value to Mod data member.
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
@ eSubtype_specimen_voucher
@ eSubtype_culture_collection
void SetData(TData &value)
Assign a value to Data data member.
const TSet & GetSet(void) const
Get the variant data.
bool IsSet(void) const
Check if variant Set is selected.
TSource & SetSource(void)
Select the variant.
#define EDIT_EACH_ORGMOD_ON_BIOSOURCE(Itr, Var)
#define FOR_EACH_ORGMOD_ON_BIOSOURCE(Itr, Var)
FOR_EACH_ORGMOD_ON_BIOSOURCE EDIT_EACH_ORGMOD_ON_BIOSOURCE.
#define FOR_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
FOR_EACH_SEQENTRY_ON_SEQSET EDIT_EACH_SEQENTRY_ON_SEQSET.
#define FOR_EACH_SEQDESC_ON_SEQENTRY(Itr, Var)
FOR_EACH_SEQDESC_ON_SEQENTRY EDIT_EACH_SEQDESC_ON_SEQENTRY.
CRef< CCmdComposite > TestCStrainSerotypeInfluenza_Parse(CStrainSerotypeInfluenza &parser, CSeq_entry_Handle tse, const string &title, bool overwrite)
wxString ToWxString(const string &s)