Show green triangles in Level 1 scan also when no candidate molecule is selected
Closed this issue · 32 comments
Green triangles in Level 1 scans are only displayed after a candidate molecule is selected. It would be useful to show green triangles in Level 1 scans already when a scan is selected, but not a candidate. For some data multiple MS2 spectra are measured for different peaks in the level 1 scan. Currently, all candidates for the different level 1 peaks are shown in the Molecules table. By clicking one of the peaks in the Level 1 scan the user should be able to select only candidates corresponding to that peak.
Can you give me a dataset?
Here is an example:
https://www.emetabolomics.org/magma/results/e1e4951e-30e1-4ce7-b0e1-e8af6b998580
In this case all peaks in the MS1 scan should have triangles. Upon selecting one of those, the metabolite panel should be filtered to the corresponding candidates.
There are several datasets where this is a real issue so I increased the priority.
When scan + molecule have been selected. Then unselecting the lvl 1 peak should do what?
Lars, could you try out the 212-level-1-triangles
branch?
Great progress!
Some small requests:
- Candidate score in molecules should be shown only when one of the level 1 peaks is selected (otherwise scores are shown that are not comparable to each other)
- By clicking a compound, one of the level 1 peaks is selected, in that case the molecules table should also be filtered (and candidate scores should be shown)
- Unselecting a level 1 peak, I think should also unselect any compound from the molecules table.
Does this seem reasonable?
Selecting a peaks causes the molecules to be filtered on mz. I can also show the candidate score column when filtering is enabled.
The mechanism to show a fragment has changed.
- Old way: a molecule and lvl 1 scan selected
- Proposed new way: a molecule and a lvl1 peak selected
The current setup selects a peak when only one peak in the lvl1 scan has fragments,
Unselecting a lvl1 peak will clear the mz filter on the molecules and when the previously selected molecule is still on the first page it should be selected again.
When a peak is selected the molecules will be reloaded causing deselection of the molecule. This made #127 more important.
Implementation complete. Extra loads are happening due scans with single peak forces the peak to be selected and the peak selection forces molecules to be filtered on mz.
Please verify it behaves as expected.
Here is an example incl. chromatogram:
https://www.emetabolomics.org/magma/results/21ca682c-ae19-4c92-bc08-fe811255ec64
(It is a different one than I just showed, because that one is huge (700mb, but it works the same for this one.)
Fragment is shown when no molecule is selected.
Reproduce using 21ca682c-ae19-4c92-bc08-fe811255ec64 dataset:
- Select scan 20977
- Select peak with mz 311
- Select a molecule
- Select peak with mz 465
- Select peak with mz 311
Now fragment of mz 465 is still shown.
Fixed
- Selecting a molecule now select the peak with that mz
- The candidate score is only show when a peak is selected.
- When no molecule is selected the fragment is also not selected
Next problem:
When molecule is selected with multiple scans and a scan is selected. Then selecting another scan will clear the scan selection.
Why is this happening? Do you need input from me on this?
Because a cascade of server loads is happening of which some are happening at the same time, causes the reselecting the molecule/scan problems. I don't need input from you.
I fixed most of losing selection issues. Could you try it again to see if you can get to a state where a molecule/peak/scan should be selected, but isnt?
based on the example provided incl. chromatogram:
- Click on 6-methylthiohexylglucosinolate (row 6) -> gets an extracted ion chromatogram with 2 scans = OK
- Click on one of the scans in the chromatogram, then the other triangle is lost = NOT OK
- Deselect the scan again, then all scan triangles are shown = NOT OK (because the molecule is still selected)
- Fixed deselecting scan. Will now show the scans filtered on the selected molecule.
- The other triangle is lost due to mz filtering. The molecule selection triggers a lvl1 peak selection which in turn filters the molecules on exact mz. There is only one scan with that mz.
The molecules and scans are now filtered on a exact mz.
Should the mz filtering be exact or a range between mz-mz_precision and mz+mz_precision?
If a range is nicer should molecules and scans be filterered on mz range or should only the scans be filtered on range and the molecules on exact mz?
I think filtering is easiest on the basis of the fragment table.
So:
- Filtering molecules should be on the presence of a fragment of that molecule for the selected peak: select distinct(molid) from fragments where scanid == <selected_scanid> and mz == <selected_mz>;
- Similarly the scans could be selected based on the presence of fragments of the selected molid:
select scanid from fragments where molid ==
Ok, I agree with that molecules are filtered on scan and mz, but
which scans should be shown when no molecule is selected and a peak is selected?
(a) When not filtering on mz it shows (how it was):
- Hard to see which scans have similar mz with fragment, when you select a molecule you see the scans which have fragments with that molecule
- Easy to switch to another scan
(b) I feel showing scans which have a fragment with the selected mz (with precision buffer) is better:
- Much easier to find scans with same mz
- To select another scan you have to unselect the peak/scan first
What do you think? Use option (a) or (b)?
How about somethink like:
select distinct(scanid) from fragments where molid in (select molid from fragments where scanid == <selected_peak.scanid> and mz == <selected_peak.mz> )
Implemented with the in
subselect. It no longer requires a ranged mz query.
Almost there, one additional change: when deselecting a level 1 peak also the molecule should be deselected, otherwise the peak is directly selected again (and nothing actually happens).
Currently:
When a scan has a single peak it is selected and when a the molecules are filtered to one it is selected.
So if you have a scan with single peak and molecule the only way to select another peak or molecule is to deselect the scan.
To be able to deselect a peak and molecule at the same time we have to break either the single peak auto select or single molecule auto select. The single peak auto select is not very useful, because a lot of datasets will have a single peak in lvl1 scan and selecting the peak manually is not nice.
Disabling the single molecule auto select is a change, but I think not that bad.
What do you think?
I don't think you need to break any of the auto selects
What you describe under "Currently:" is fine, that shouldn't change. However, have a look at this example for a scan with multiple peaks and multiple molecules:
- Click on 6-methylthiohexylglucosinolate (row 6) -> gets an extracted ion chromatogram with 2 scans = OK
- Click on one of the scans in the chromatogram, then the level 1 scan is shown with one peak selected = OK
- Deselect the peak: then briefly the candidates for the other peak are shown, but since 6-methylthiohexylglucosinolate is still selected the peak is selected again and the candidates are filtered again = NOT OK
If in this case, after deselecting the peak there are multiple molecules in the table and so you could deselect the one that was selected initially.
Fixed, now instead of reselecting the molecule the molecule selection is cleared when a peak is unselected.
Excellent. The only strange thing is now that the extracted ion chromatogram is still visible after the peak and compound are deselected.
The most elegant way would now be to show an extracted ion chromatogram based on the selection of a peak (not a molecule) and when the peak is deselected the extracted ion chromatogram should become invisible. Is this feasible?
I thought deselecting the molecule would trigger event telling the scan panel to hide the extracted ion chromatogram (eic), but this did not happen. So now I trigger an event to hide the eic.
Again better, but when another level 1 peak is selected sometimes the deselection doesn't work:
- Click on 6-methylthiohexylglucosinolate (row 6) -> gets an extracted ion chromatogram with 2 scans = OK
- Select the scan on the right in the chromatogram, then the level 1 scan is shown with one peak selected = OK
- Select the other peak (mz=477) in the level 1 scan (without first deselecting the first one).
- Select the initial peak (mz=448)
- Select the other peak again (mz=477). Then the EIC belonging to 6-methylthiohexylglucosinolate is shown = NOT OK.
I think selecting another level 1 peak (not just deselecting one) should also "deselect the molecule"?
Selecting another peak, befores selecting it first unselects the peak which unselects the molecule. The loading of molecules when the peak is unselected was cancelled, but still handled as a successful load.
Now aborted loads are skipped, so the wrong EIC is no longer shown.
Assigning a molecule to peak doesn't work for me anymore, it gives a "Failed to (un)assign molecule to peak" error.
Fixed assign error in this branch and master branch.
Selecting a new scan with the binoculars icon does not always work properly:
- Click on 6-methylthiohexylglucosinolate (row 6) -> gets an extracted ion chromatogram with 2 scans = OK
- Select the scan on the right in the chromatogram, then the level 1 scan is shown with one peak selected = OK
- Click binoculars icon and type "5159", then the chromatogram panels is does not show the selected scan and the level 1 scan doesn't show peaks = NOT OK
The problem seems to be related to whether or not a peak in the level 1 scan is selected ...
Searching for scan now works.
Closing issue and merging with master via pr #247