SetDataObject(
newwxFileDataObject);
77wxFileDataObject *dobj = (wxFileDataObject *)m_dataObject;
78wxArrayString
filenames= dobj->GetFilenames();
82 if(def == wxDragMove || def == wxDragLink) {
85}
else if(def == wxDragCopy) {
119wxPanel::Create( parent,
id, pos,
size, style );
124GetSizer()->SetSizeHints(
this);
160wxStaticBox* itemStaticBoxSizer3Static =
newwxStaticBox(itemPanel1,
wxID_ANY,
_(
"BAM/CSRA Files or SRA Run Accessions"));
161wxStaticBoxSizer* itemStaticBoxSizer3 =
newwxStaticBoxSizer(itemStaticBoxSizer3Static, wxVERTICAL);
162 m_MainSizer->Add(itemStaticBoxSizer3, 1, wxGROW|wxALL, 5);
164wxBoxSizer* itemBoxSizer4 =
newwxBoxSizer(wxVERTICAL);
165itemStaticBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
167 m_BamInput=
new CRichTextCtrl( itemStaticBoxSizer3->GetStaticBox(),
ID_BAM_INPUT, wxEmptyString, wxDefaultPosition, wxSize(200, 100), wxTE_MULTILINE|wxTE_RICH2|wxWANTS_CHARS );
168itemBoxSizer4->Add(
m_BamInput, 1, wxGROW|wxALL, 5);
170wxButton* itemButton6 =
newwxButton( itemStaticBoxSizer3->GetStaticBox(),
ID_BUTTON,
_(
"Add BAM/CSRA Files"), wxDefaultPosition, wxDefaultSize, 0 );
171itemBoxSizer4->Add(itemButton6, 0, wxALIGN_RIGHT|wxALL, 5);
173wxStaticText* itemStaticText7 =
newwxStaticText( itemStaticBoxSizer3->GetStaticBox(), wxID_STATIC,
_(
"For viewing a BAM file, an index file is required residing in \nthe same directory as the BAM file. The index file should \nbe named by appending \".bai\" or \".csi\" to the bam file\nname.\n\nIn cases of multiple inputs, the inputs must be separated \nby one of these separators: commas(,), semicolons(;), or \nnew lines."), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
174itemStaticBoxSizer3->Add(itemStaticText7, 0, wxALIGN_LEFT|wxALL, 5);
176itemStaticBoxSizer3->Add(5, 5, 1, wxGROW|wxALL, 5);
183wxStaticText* parsingText =
newwxStaticText(
this,
ID_PARSING_TEXT,
wxT(
"Validating accessions ..."), wxDefaultPosition, wxDefaultSize, 0);
184wxFont bold(wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), wxNORMAL_FONT->GetStyle(), wxFONTWEIGHT_BOLD, wxNORMAL_FONT->GetUnderlined(), wxNORMAL_FONT->GetFaceName());
185parsingText->SetFont(bold);
186parsingText->SetForegroundColour(*wxBLACK);
195 m_ErrStyle.SetBackgroundColour(wxColour(255, 200, 200));
215 #define BAM_LOADER_ERR "Bam - Error in input" 217 #define INVALID_INPUT "Input contains no valid BAM file/SRA Run accession or no corresponding \ 220 #define EMPTY_INPUT "Please specify BAM files or SRA Run accessions to load!" 237wxOK | wxICON_ERROR,
this);
241wxOK | wxICON_ERROR,
this);
244 stringerr_msg =
"Input contains invalid BAM files or SRZ accessions (";
246err_msg +=
"\nWould you like to proceed?";
249wxYES_NO | wxICON_EXCLAMATION,
this);
266 stringheader =
"User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; " 267 "Windows NT 5.0; (R1 1.1))";
272 if(
nullptr== net_info) {
277net_info->max_try = 1;
278net_info->timeout = &Timeout;
297 if(
nullptr!= net_info)
306 constvector<string> index_exts{
".bai",
".csi"};
309 stringpath,
file, ext;
311 for(
const auto& index_ext: index_exts) {
313 stringindex_name =
file+ ext + index_ext;
315iter.second = path + index_name;
318index_name =
file+ index_ext;
320iter.second = path + index_name;
325 if(
CFile(path +
file+ ext + index_ext).Exists()) {
326iter.second = path +
file+ ext + index_ext;
329 if(
CFile(path +
file+ index_ext).Exists()) {
330iter.second = path +
file+ index_ext;
335 if(iter.second.empty())
356objects::CSrzPath srz_path;
357 stringpath = srz_path.FindAccPath(srz_acc);
365objects::CVDBMgr sra_path;
366 stringpath = sra_path.FindAccPath(srz_acc);
382vector<pair<string, string>> bamFiles;
390SParseResults s_ValidateInput(
const string&
input,
ICanceled& canceled)
392 static string sDelim(
",;\n\r");
399vector<string> tokens;
400vector<SIZE_TYPE> token_pos;
402 size_ttoken_num = tokens.size();
404 for(
size_t i= 0;
i< token_num; ++
i) {
407 returnSParseResults();
409 stringinput_str = tokens[
i];
414 if(
file.Exists()) {
418 results.csraFiles.insert(input_str);
421 autoit = find_if(
results.bamFiles.begin(),
results.bamFiles.end(),
422[&input_str](
constpair<string,string>& v) { return v.first == input_str;});
423 if(it ==
results.bamFiles.end())
424 results.bamFiles.emplace_back(input_str,
"");
436 autoit = find_if(
results.bamFiles.begin(),
results.bamFiles.end(),
437[&input_str](
constpair<string, string>& v) { return v.first == input_str; });
438 if(it ==
results.bamFiles.end())
439 results.bamFiles.emplace_back(input_str,
"");
442 results.csraFiles.insert(input_str);
460 results.errPos.push_back((
int)token_pos[
i]);
461 results.errPos.push_back((
int)(token_pos[
i] + tokens[
i].size()));
475wxStaticText* parsingText =
dynamic_cast<wxStaticText*
>(FindWindow(
ID_PARSING_TEXT));
476parsingText->SetLabelText(
"Canceling validation ...");
477parsingText->SetForegroundColour(*wxBLACK);
504wxStaticText* parsingText =
dynamic_cast<wxStaticText*
>(FindWindow(
ID_PARSING_TEXT));
505parsingText->SetLabelText(
"Validating accessions ...");
506parsingText->SetForegroundColour(*wxBLACK);
519 returns_ValidateInput(
text, canceled);
523SParseResults parseResults;
526parseResults = future();
535 if(parseResults.errPos.size() > 1) {
543 for(
size_t i= 0;
i< parseResults.errPos.size() - 1; ++
i)
551 catch(
constexception& e) {
557 if(!errMsg.empty()) {
558wxStaticText* parsingText =
dynamic_cast<wxStaticText*
>(FindWindow(
ID_PARSING_TEXT));
559parsingText->SetLabelText(
"Parse error: "+ errMsg);
560parsingText->SetForegroundColour(*wxRED);
569},
"Validating accessions...")
644 stringold_path(
m_BamInput->GetValue().ToUTF8());
648wxFileDialog dlg(
this,
wxT(
"Select BAM files"), wxString::FromUTF8(def_path.c_str()),
wxT(
""),
649wxString(
wxT(
"BAM files|*.bam|")) + wxALL_FILES,
652 if(dlg.ShowModal() != wxID_OK)
664 if( !
str.IsEmpty() ) {
676 if( !
str.IsEmpty() ) {
static bool x_IsUrlAccessible(const string &url)
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
Class implements different ad-hoc unreliable file format identifications.
EFormat
The formats are checked in the same order as declared here.
@ eSra
INSDC Sequence Read Archive file.
CRichTextCtrl - a wrapper for wxRichTextCtrl that handles additional keyboard events (such as Clipboa...
Interface for testing cancellation request in a long lasting operation.
static const char * str(char *buf, int n)
int GetStatusCode(void) const
Get the last seen HTTP status code, if available.
@ fHTTP_AdjustOnRedirect
Call adjust routine for redirects, too.
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
@ fHTTP_UnsafeRedirects
Any redirect will be honored.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
static void SplitPath(const string &path, string *dir=0, string *base=0, string *ext=0)
Split a path string into its basic components.
void OnTimer(wxTimerEvent &event)
void SetInput(const string &input)
void SetFilenames(const wxArrayString &filenames)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
size_t m_ErrNum
number of token with errors
void OnBamInputTextUpdated(wxCommandEvent &event)
wxEVT_COMMAND_TEXT_UPDATED event handler for ID_BAM_INPUT
const TBamFiles & GetSraAccs() const
CRichTextCtrl * m_BamInput
void OnButtonClick(wxCommandEvent &event)
wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def)
bool Create(wxWindow *parent, wxWindowID id=ID_CBAMLOADOPTIONPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
const TBamWithIndexFiles & GetBamFiles() const
size_t m_InputNum
total number of valid inputs
vector< pair< string, string > > TBamWithIndexFiles
CDropTarget(CBamLoadOptionPanel &panel)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
std::unique_ptr< async_job > m_ValidateJob
TBamWithIndexFiles m_BamFiles
wxBoxSizer * m_ParseProgressSizer
static bool ShowToolTips()
const TBamFiles & GetCSraFiles() const
const TBamFiles & GetSrzAccs() const
void AddFilenames(const wxArrayString &filenames)
string GetBamFilePath() const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
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 bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static string & ToUpper(string &str)
Convert string to upper case â string& version.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eNocase
Case insensitive compare.
SConnNetInfo * ConnNetInfo_Create(const char *service)
void ConnNetInfo_Destroy(SConnNetInfo *net_info)
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
job_function_traits< _Fty >::future job_async(const _Fty &_Fnarg, const string &descr)
static void text(MDB_val *v)
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static string sDelim(" \t\n,;")
FAccType operator()(const string &srz_acc)
wxString ToWxString(const string &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