-
Notifications
You must be signed in to change notification settings - Fork 34
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
Neutral Mass Spectrum #806
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changed `ClassicDeconvolutionAlgorithm`, `DeconvolutionAlgorithm`, and `ExampleNewDeconvolutionAlgorithmTemplate` classes and their members from `public` to `internal` to restrict visibility within the assembly. Added summary comment to `DeconvolutionAlgorithm` class. Refactored `Deconvoluter` class to remove unnecessary `using` directives and simplify the `Deconvolute` method by removing switch-case logic. Updated `IsotopicEnvelope` class by removing `MassIndex` and `StDev` properties, and modified constructor and `ScoreIsotopeEnvelope` method accordingly. Updated `MzSpectrum` class to use `StandardDeviation` extension method from `Easy.Common.Extensions`. Removed various unnecessary `using` directives from multiple files.
- Added `InternalsVisibleTo` entries for "Development" and "Test" in `MassSpectrometry.csproj`. - Changed `MostAbundantObservedIsotopicMass` to `internal` in `IsotopicEnvelope.cs`. - Added a new constructor to `IsotopicEnvelope` with monoisotopic mass, intensity, and charge. - Added XML documentation and changed `GeneratePeak` to `protected virtual` in `MzSpectrum.cs`. - Removed unused `using` directives in `MzSpectrum.cs` and `NeutralMzSpectrum.cs`. - Modified `NeutralMzSpectrum` constructor to validate array lengths. - Added `Charges` property to `NeutralMzSpectrum` and initialized it in the constructor. - Overrode `GeneratePeak` in `NeutralMzSpectrum` to convert to a charged spectrum using `Charges`.
Added necessary using directives in Deconvoluter.cs. Modified Deconvoluter class for short-circuit deconvolution. Removed redundant lines in Deconvoluter.cs. Renamed NeutralMzSpectrum to NeutralMassSpectrum. Updated constructor and references accordingly.
Refactored Deconvoluter.cs to use a foreach loop for yielding IsotopicEnvelopes. Reformatted multiple test methods in TestDeconvolution.cs for better readability. Added new test methods to validate Deconvolute with NeutralMassSpectrum, ensuring correct processing of spectra with various charge states and ranges.
- Changed FirstX and LastX properties in MzSpectrum to virtual. - Included MzLibUtil namespace in NeutralMassSpectrum class. - Updated NeutralMassSpectrum constructor to set FirstX and LastX. - Overrode FirstX and LastX in NeutralMassSpectrum class. - Added test NeutralMassSpectrum_MzRange to validate m/z range.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #806 +/- ##
==========================================
+ Coverage 76.48% 76.55% +0.06%
==========================================
Files 211 212 +1
Lines 31960 32011 +51
Branches 3286 3297 +11
==========================================
+ Hits 24446 24507 +61
+ Misses 6954 6945 -9
+ Partials 560 559 -1
|
@@ -79,7 +58,22 @@ public static IEnumerable<IsotopicEnvelope> Deconvolute(MzSpectrum spectrum, | |||
default: throw new MzLibException("DeconvolutionType not yet supported"); | |||
} | |||
|
|||
return deconAlgorithm.Deconvolute(spectrum, rangeToGetPeaksFrom); | |||
// Short circuit deconvolution if it is called on a neutral mass spectrum | |||
if (spectrum is NeutralMassSpectrum newt) |
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.
good variable name
Alexander-Sol
approved these changes
Oct 16, 2024
zhuoxinshi
approved these changes
Oct 22, 2024
trishorts
approved these changes
Oct 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Maintenance
The user isn't impacted by it, it's purely behind the scenes
New Feature
ready for review
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Created a 'NeutralMassSpectrum' class to represent a spectrum read off of a deconvoluted file by deriving the MzSpectrum. This allows it to be easily swapped into an MsDataScan.
If this scan is deconvoltuted. Deconvolution will short circuit and return the neutral masses.
PR Summary
This pull request refines code visibility, improves readability, and adds new test cases to enhance code maintainability and functionality.
ClassicDeconvolutionAlgorithm
,DeconvolutionAlgorithm
, andExampleNewDeconvolutionAlgorithmTemplate
classes changed frompublic
tointernal
.Deconvoluter
class refactored to streamline deconvolution logic and handleNeutralMassSpectrum
.TestDeconvolution.cs
reformatted and new test cases added forNeutralMassSpectrum.Deconvolute
.TestSpectra.cs
updated with new test methods forNeutralMassSpectrum
constructor and properties.MassSpectrometry.csproj
updated withInternalsVisibleTo
attributes for "Development" and "Test" assemblies.