(
void);
86 virtual voidExit(
void);
87 boolProcessHGVS(
string&expression,
CRef<CScope>scope,
CHgvsReader&reader,
int&pos_left,
int&pos_right,
bool&is_shifted,
bool&is_different,
int&dleft,
int&dright);
94arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
"Analyze Shift in HGVS objects");
97SetupArgDescriptions(arg_desc.release());
107vector<CRef<CSeq_annot> > annots;
113}
catch(...) {
return false;}
114 if(annots.size() != 1)
return false;
116 a->Assign(*annots.front());
118 if(
a->GetData().GetFtable().empty() ||
a->GetData().GetFtable().size() != 1)
return false;
119 if(!
a->GetData().GetFtable().front()->IsSetLocation())
return false;
121 if(
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().IsSet())
123 for(CVariation_ref::TData::TSet::TVariations::const_iterator inst =
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetSet().GetVariations().begin();
124inst !=
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetSet().GetVariations().end(); ++inst)
125 if((*inst)->IsSetData() && (*inst)->GetData().IsInstance() && (*inst)->IsSetData() && (*inst)->GetData().GetInstance().IsSetType() && (*inst)->GetData().GetInstance().GetType() !=
CVariation_inst::eType_identity)
126 type= (*inst)->GetData().GetInstance().GetType();
128 else if(
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().IsInstance() &&
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().IsSetType()
130 type=
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().GetType();
136CSeq_loc &orig_loc =
a->SetData().SetFtable().front()->SetLocation();
138 intorig_left = pos_left;
139 intorig_right = pos_right;
140 if(orig_loc.IsInt())
142orig_left = orig_loc.GetInt().GetFrom();
143orig_right = orig_loc.GetInt().GetTo();
145 else if(orig_loc.IsPnt())
147orig_left = orig_loc.GetPnt().GetPoint();
148orig_right = orig_left;
150 if(orig_left != pos_left || orig_right != pos_right)
151is_different =
true;
155 intpos = orig_loc.GetInt().GetTo();
158 if(orig_loc.GetInt().IsSetStrand())
159pnt.
SetStrand( orig_loc.GetInt().GetStrand() );
160pnt.
SetId().Assign(orig_loc.GetInt().GetId());
161orig_loc.SetPnt().Assign(pnt);
167 constCSeq_loc &loc =
a->GetData().GetFtable().front()->GetLocation();
169 if(
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().IsSet())
171 for(CVariation_ref::TData::TSet::TVariations::const_iterator inst =
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetSet().GetVariations().begin();
172inst !=
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetSet().GetVariations().end(); ++inst)
173 if( (*inst)->IsSetData() && (*inst)->GetData().IsInstance() && (*inst)->GetData().GetInstance().IsSetDelta() && (*inst)->GetData().GetInstance().GetDelta().size() == 1 &&
174(*inst)->GetData().GetInstance().GetDelta().front()->IsSetSeq() && (*inst)->GetData().GetInstance().GetDelta().front()->GetSeq().IsLiteral() &&
175(*inst)->GetData().GetInstance().GetDelta().front()->GetSeq().GetLiteral().IsSetSeq_data() && (*inst)->GetData().GetInstance().GetDelta().front()->GetSeq().GetLiteral().GetSeq_data().IsIupacna())
176ref = (*inst)->GetData().GetInstance().GetDelta().front()->GetSeq().GetLiteral().GetSeq_data().GetIupacna().Get();
178 else if(
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().IsInstance() &&
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().IsSetDelta()
179&&
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().GetDelta().size() == 1
180&&
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().GetDelta().front()->IsSetSeq()
181&&
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().GetDelta().front()->GetSeq().IsLiteral()
182&&
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().GetDelta().front()->GetSeq().GetLiteral().IsSetSeq_data()
183&&
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().GetDelta().front()->GetSeq().GetLiteral().GetSeq_data().IsIupacna())
184ref =
a->GetData().GetFtable().front()->GetData().GetVariation().GetData().GetInstance().GetDelta().front()->GetSeq().GetLiteral().GetSeq_data().GetIupacna().Get();
188 if(ref.empty())
return false;
192pos_left = loc.GetPnt().GetPoint();
193pos_right = pos_left;
195 else if(loc.IsInt())
197pos_left = loc.GetInt().GetFrom();
198pos_right = loc.GetInt().GetTo();
202 if(pos_left != orig_left || pos_right != orig_right)
204dleft = orig_left - pos_left;
205dright = pos_right - orig_right;
232 while(!line_reader.
AtEOF())
234 stringline = *(++line_reader);
237vector<string> tokens;
238NStr::Tokenize(line,
"|",tokens);
239 stringsnp_id = tokens[0];
240 stringhgvs = tokens[1];
241 stringgi = tokens[2];
242 stringstart = tokens[3];
243 stringstop = tokens[4];
244 stringisClinical = tokens[5];
247 boolis_shifted =
false;
248 boolis_different =
false;
251 if(ProcessHGVS(hgvs,scope,reader,pos_left,pos_right,is_shifted,is_different,dleft,dright))
253ostr <<snp_id<<
"|"<<hgvs<<
"|"<<isClinical<<
"|"<<is_different<<
"|"<<is_shifted<<
"|";
255ostr << dleft<<
"|"<<dright<<
"|"<<pos_left<<
"|"<<pos_right<<
"|";
259ostr << line <<
"ERROR_HGVS_PROCESSING"<<endl;
266 int main(
intargc,
const char* argv[])
269 returnAnalyzeShiftApp.
AppMain(argc, argv);
User-defined methods of the data storage class.
User-defined methods of the data storage class.
int main(int argc, const char *argv[])
Data loader implementation that uses the blast databases.
virtual void Init(void)
Initialize the application.
virtual void Exit(void)
Cleanup on application exit.
bool ProcessHGVS(string &expression, CRef< CScope > scope, CHgvsReader &reader, int &pos_left, int &pos_right, bool &is_shifted, bool &is_different, int &dleft, int &dright)
virtual int Run()
Run the application.
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
CRef< CGC_Assembly > GetAssembly(const string &acc, const string &mode)
virtual void ReadSeqAnnots(vector< CRef< CSeq_annot > > &, CNcbiIstream &, ILineErrorListener *=0)
Simple implementation of ILineReader for i(o)streams.
static void NormalizeVariation(CVariation &var, ETargetContext target_ctxt, CScope &scope)
Include a standard set of the NCBI C++ Toolkit most basic headers.
User-defined methods of the data storage class.
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.
@ fPreOpen
Open file right away; for eInputFile, eOutputFile, eIOFile.
@ eInputFile
Name of file (must exist and be readable)
@ eOutputFile
Name of file (must be writable)
bool AtEOF(void) const
Indicates (negatively) whether there is any more input.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
void Run(void)
Enter the main loop.
void SetPoint(TPoint value)
Assign a value to Point data member.
void SetId(TId &value)
Assign a value to Id data member.
void SetStrand(TStrand value)
Assign a value to Strand data member.
@ eType_identity
delta=[]
Lightweight interface for getting lines of data with minimal memory copying.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
#define GetArgs
Avoid preprocessor name clash with the NCBI C Toolkit.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
NetCache ICache client specs.
Reader-writer based streams.
C++ I/O stream wrappers to compress/decompress data on-the-fly.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4