Skip to content
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

Merged
merged 9 commits into from
Jun 24, 2021

Conversation

YulingDai
Copy link
Contributor

No description provided.

Copy link
Member

@rmillikin rmillikin left a 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

Copy link
Contributor

@zrolfs zrolfs left a 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.

@YulingDai YulingDai requested review from zrolfs and rmillikin June 5, 2021 01:26
Copy link
Contributor

@trishorts trishorts left a 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();
Copy link
Contributor

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

@@ -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"))
Copy link
Member

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();
Copy link
Member

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', '/' };
Copy link
Member

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)
Copy link
Member

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

@YulingDai YulingDai merged commit 4944681 into master Jun 24, 2021
@acesnik acesnik deleted the LibraryReaderChangeToReadPdeepAndNeutralLoss branch March 10, 2023 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants