-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library reader change to read pdeep and neutral loss #2056
Library reader change to read pdeep and neutral loss #2056
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignore this comment... meant to comment on zachs PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Still a few places where unit tests would help improve code coverage, though.
…//github.com/smith-chem-wisc/MetaMorpheus into LibraryReaderChangeToReadPdeepAndNeutralLoss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one tiny change
double neutralLoss = 0; | ||
if (split[2].Contains("-")) | ||
{ | ||
String[] NL = split[2].Split(neutralLossSplit, StringSplitOptions.RemoveEmptyEntries).ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NL should be lower case and more informative
…//github.com/smith-chem-wisc/MetaMorpheus into LibraryReaderChangeToReadPdeepAndNeutralLoss
@@ -360,7 +495,15 @@ private void IndexSpectralLibrary(string path) | |||
reader.DiscardBufferedData(); | |||
|
|||
// parse the header | |||
var libraryItem = ReadLibrarySpectrum(reader, onlyReadHeader: true); | |||
LibrarySpectrum libraryItem; | |||
if (path.Contains("pdeep")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems a bit fragile. i can imagine users using a pdeep library but not having "pdeep" in the filename, and then getting a crash. but it would require a larger code rewrite to do it my preferred way (looking for "Spec=pDeep" in the comment field).
double neutralLoss = 0; | ||
if (split[2].Contains("-")) | ||
{ | ||
String[] neutralLossInformation = split[2].Split(neutralLossSplit, StringSplitOptions.RemoveEmptyEntries).ToArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string[] not String[]
char[] mwSplit = new char[] { ':' }; | ||
char[] commentSplit = new char[] { ' ', ':', '=' }; | ||
char[] modSplit = new char[] { '/', '(', ')' }; | ||
char[] fragmentSplit = new char[] { '\t', '/' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these arrays should be static variables for the class. it will save you some time garbage collecting old arrays. same w/ arrays in ReadLibrarySpectrum
return new LibrarySpectrum(sequence, precursorMz, z, matchedFragmentIons, rt); | ||
} | ||
|
||
private LibrarySpectrum ReadLibrarySpectrum_pDeep(StreamReader reader, bool onlyReadHeader = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally you would not have a separate method that's a near duplicate of ReadLibrarySpectrum
but i'll leave that up to you. maybe the pdeep library is too different to adapt ReadLibrarySpectrum. but it's not ideal to have this separate nearly-identical code
No description provided.