Repository navigation
read swath window file with no header try #2 - #6077
Conversation
In response to OpenMS#6055 allow openSwath to be able to read window files with no header.
|
/reformat |
|
hmm there still seems to be wrong with the reformat script. not sure why it e.g. reformated SiriusAdapterAlgorithm at all |
|
sorry can you revert the last commit by the linter? |
|
I will revert |
|
Probably a GitHub bug since it tagged your comment for a completely different commit. Please raise an issue there or with their customer support |
This reverts commit 83875b6.
|
Is this ready to be merged? |
jpfeuffer
left a comment
There was a problem hiding this comment.
Check the logging. Unless there are problems with multithreading, please use OPENMS_LOG_...
| std::getline(data, line); // possible header (or first line) | ||
| if (std::any_of(line.begin(), line.end(), [](char const &c) { return std::isalpha(c); })) | ||
| { // if any of the characters are alphabetical then there is a header | ||
| std::cout << "Read Swath window header: '" << line << "'\n"; |
There was a problem hiding this comment.
| std::cout << "Read Swath window header: '" << line << "'\n"; | |
| OPENMS_LOG_INFO << "Read Swath window header: '" << line << "'\n"; |
previous check would not detect examples like 4e2 as a valid swath window (and would put this as a header instead). Allow "e" characters to be supported. Also revert back to std::cout because OPENMS_LOG_INFO does not seem to be working.
| #include <OpenMS/CONCEPT/Types.h> | ||
| #include <OpenMS/CONCEPT/Exception.h> | ||
| #include <OpenMS/DATASTRUCTURES/String.h> | ||
| #include <OpenMS/SYSTEM/SysInfo.h> |
There was a problem hiding this comment.
minor: we sort headers by name
| // Check for presence of header | ||
| std::getline(data, line); | ||
| try { // If string can be successfully converted to double (excluding initial spaces) then the first line is not a header | ||
| StringUtils::split(line.trim(), ' ', headerSubstrings); |
There was a problem hiding this comment.
in OpenMS we mainly use tab separated files not space separated.
Would it make sense to make this consistent here?
or allow both?
There was a problem hiding this comment.
The test file seems to use space separation (as oppose to tabs) so I think we should keep the space separation. I tried to address this issue here 10064a2
| { // If string can be successfully converted to double (excluding initial spaces) then the first line is not a header | ||
| StringUtils::split(line.trim(), ' ', headerSubstrings); | ||
| StringUtils::toDouble(headerSubstrings[0]); | ||
| std::cout << "Swath Header not found \n"; |
There was a problem hiding this comment.
What happened to OpenMS log? :D
when use std::endl instead of \n the OPENMS LOG statements work
…to feature/noSwathHeader fix ordering of the include statements
allow for headers separated by tab deliminators to also be accepted
|
Thanks. Looks good from my side. |
Reopen #6070 with alternative branch so that code formatting does not fail
In response to #6055 allow
openSwath to be able to read window files with no header.
Description
Please include a summary of the change and which issue is fixed.
Checklist:
How can I get additional information on failed tests during CI:
If your PR is failing you can check out
Note:
Advanced commands (admins / reviewer only):
/reformat(experimental) applies the clang-format style changes as additional commitrebuild jenkinswill retrigger Jenkins-based CI builds