wxFileDialog
file(parent,
wxT(
"Import file"), wxEmptyString, wxEmptyString,
60 if(
file.ShowModal() != wxID_OK) {
75 if(dlg.ShowModal() == wxID_OK) {
96 for(
size_tindex = 0; index <
m_Ids.size(); ++index) {
100}
catch(exception &) {
106 for(
CBioseq_CIbi(tse); bi && !found; ++bi) {
107 for(
auto&& id_it : bi->GetId()) {
109 if(id2 && id1->
Match(*id2)) {
133wxArrayString choices;
134choices.Add(
_(
"All unmatched sequences are far pointers"));
135choices.Add(
_(
"Remove all unmatched sequences from the alignment"));
136choices.Add(
_(
"Read in a file that maps alignment IDs to sequence IDs"));
143 msg<<
" from alignment in set";
145 intanswer = wxGetSingleChoiceIndex(
msg,
_(
"Unmatched sequences found"), choices);
149 else if(answer == 1) {
152 else if(answer == 2) {
156 return(answer != -1);
163SFind_ID(
const string& id_name) : m_IdName(id_name) {}
165 booloperator() (
constpair<string, string>& str_pair)
const 175 for(CUpdateAlign::TIdToRowVec::iterator it = nonPresentIDs.begin();
176it != nonPresentIDs.end(); ++it) {
177 if(it->second == index) {
181 returnnonPresentIDs.end();
184 strings_GetIDLabel(
const string& initial_val)
186 stringid_label = initial_val;
187 size_tpos = id_label.find(
"|");
188 if(pos != string::npos) {
189id_label = id_label.substr(pos + 1, string::npos);
205 intdim =
static_cast<int>(dense_seg.
GetIds().size());
209rows.push_back(it.second);
218 autostarts_it = dense_seg.
GetStarts().begin();
220 for(
intseg = 0; seg < numseg; ++seg) {
221 for(
intindex = 0; index < dim; ++index) {
222 if(find(rows.begin(), rows.end(), index) == rows.end()) {
223new_starts.push_back(*starts_it);
228dense_seg.
SetStarts().swap(new_starts);
234 autostrand_it = dense_seg.
GetStrands().begin();
236 for(
intseg = 0; seg < numseg; ++seg) {
237 for(
intindex = 0; index < dim; ++index) {
238 if(find(rows.begin(), rows.end(), index) == rows.end()) {
239new_strands.push_back(*strand_it);
250 for(
size_tindex = 0; index < dense_seg.
GetIds().size(); ++index) {
251 if(find(rows.begin(), rows.end(), (
int)index) == rows.end()) {
252new_ids.push_back(dense_seg.
GetIds()[index]);
258dense_seg.
SetIds().swap(new_ids);
274 size_tprevious_ids = dense_seg.
GetIds().size();
277 for(
size_tindex = 0; index < dense_seg.
GetIds().
size(); ++index) {
280 if((
int)index == it.second) {
281 stringfarptrID =
"acc"+ s_GetIDLabel(it.first);
283new_ids.push_back(new_id);
290new_ids.push_back(dense_seg.
GetIds()[index]);
294dense_seg.
SetIds().swap(new_ids);
308vector<pair<string, string>> oldId_toNewId;
309wxFileDialog
file(parent,
wxT(
"Import ID map from file"), wxEmptyString, wxEmptyString,
311wxFD_OPEN | wxFD_FILE_MUST_EXIST);
312 if(
file.ShowModal() != wxID_OK) {
316wxString path =
file.GetPath();
317 if(!path.IsEmpty()) {
322 string str= *++line_reader;
326list<string> row_values;
328 if(row_values.size() == 2) {
329oldId_toNewId.emplace_back(*row_values.begin(), *row_values.rbegin());
331}
while(!line_reader.
AtEOF());
335 size_tprevious_ids = dense_seg.
GetIds().size();
338 stringunmapped_ids =
"(";
341 for(
size_tindex = 0; index < dense_seg.
SetIds().
size(); ++index) {
344new_ids.push_back(dense_seg.
GetIds()[index]);
347std::function<
bool(
constpair<string, string>& str_pair)> tester = SFind_ID(id_it->first);
348 automap_it = find_if(begin(oldId_toNewId), end(oldId_toNewId), tester);
349 if(map_it == oldId_toNewId.end()) {
351unmapped_ids += id_it->first;
352unmapped_ids +=
", ";
353new_ids.push_back(dense_seg.
GetIds()[index]);
357new_ids.push_back(new_id);
362dense_seg.
SetIds().swap(new_ids);
365unmapped_ids.pop_back();
366unmapped_ids.pop_back();
367unmapped_ids +=
")";
369 string msg=
"Mapping not found for ";
378 msg+=
"Is this a far pointer? ";
381 msg+=
"Are these far pointers?";
384 if(wxYES == wxMessageBox(
ToWxString(
msg),
"Info", wxYES_DEFAULT|wxYES_NO, parent)) {
451 const string&
id= (*iter2).GetID();
452 int line_num= (*iter2).GetLineNum();
458errmsg +=
"At line ";
462errmsg +=
"(Sequence ID ";
466errmsg += (*iter2).GetMsg();
479vector<CAlnReader::EAlphabet> alphas;
494 ITERATE(vector<CAlnReader::EAlphabet>, iter, alphas) {
511 _TRACE(
"reading text alignment failed: "<< e.what());
class CAlnReader supports importing a large variety of text-based alignment formats into standard dat...
const TErrorList & GetErrorList(void) const
void Read(bool guess, bool generate_local_ids=false, objects::ILineErrorListener *pErrorListener=nullptr)
void SetMatch(const string &value)
CRef< objects::CSeq_align > GetSeqAlign(TFastaFlags fasta_flags=0, objects::ILineErrorListener *pErrorListener=nullptr)
Create ASN.1 classes from the parsed alignment.
const vector< string > & GetIds(void) const
Parsed result data accessors.
void SetMiddleGap(const string &value)
void SetEndGap(const string &value)
void SetBeginningGap(const string &value)
void SetAlphabet(const string &value)
void SetMissing(const string &value)
void RemovePureGapSegs()
Remove any segments in which every row has a gap (these can arise when ExtractRows is used)
static wxString GetDialogFilter(EFileType fileType)
const CTextAlignParams & GetData() const
void SetData(const CTextAlignParams &data)
Simple implementation of ILineReader for i(o)streams.
void SetEnd(wxString value)
void SetMatch(wxString value)
void SetMiddle(wxString value)
wxString GetBegin() const
void SetSeqType(int value)
wxString GetUnknown() const
wxString GetMatch() const
void SetBegin(wxString value)
void SetUnknown(wxString value)
wxString GetMiddle() const
vector< pair< string, int > > TIdToRowVec
bool x_ProcessNotPresentIDs(wxWindow *parent)
CRef< objects::CSeq_align > m_SeqAlign
void x_ReadAlign(const CTextAlignParams ¶ms)
TIdToRowVec m_NonPresentIDs
void x_ChangeIDsToFarPointers()
void x_FindNotPresentIDs(objects::CSeq_entry_Handle tse)
void x_MapNonPresentIDs(wxWindow *parent)
void x_RemoveIDsFromAlign()
void apply(objects::CSeq_entry_Handle tse, ICommandProccessor *cmdProcessor, wxWindow *parent)
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
static unsigned int line_num
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
bool AtEOF(void) const
Indicates (negatively) whether there is any more input.
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
@ fParse_Default
By default in ParseIDs and IsValid, allow raw parsable non-numeric accessions and plausible local acc...
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
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 bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
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.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
bool IsSetNumseg(void) const
number of segments here Check if a value has been assigned to Numseg data member.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
const TStarts & GetStarts(void) const
Get the Starts member data.
vector< ENa_strand > TStrands
vector< TSignedSeqPos > TStarts
void SetDim(TDim value)
Assign a value to Dim data member.
vector< CRef< CSeq_id > > TIds
TStarts & SetStarts(void)
Assign a value to Starts data member.
TStrands & SetStrands(void)
Assign a value to Strands data member.
bool IsSetStarts(void) const
start OFFSETS in ids order within segs Check if a value has been assigned to Starts data member.
const TIds & GetIds(void) const
Get the Ids member data.
TNumseg GetNumseg(void) const
Get the Numseg member data.
TIds & SetIds(void)
Assign a value to Ids data member.
const TStrands & GetStrands(void) const
Get the Strands member data.
void SetData(TData &value)
Assign a value to Data data member.
Lightweight interface for getting lines of data with minimal memory copying.
const struct ncbi::grid::netcache::search::fields::SIZE size
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
Utility macros and typedefs for exploring NCBI objects from seqset.asn.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static string s_FormatErrors(const CAlnReader::TErrorList &errors)
wxString ToWxString(const string &s)
string ToStdString(const wxString &s)
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