Skip to content

Commit

Permalink
Added null checks to enable display of XL results (#2290)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Sol authored Jul 3, 2023
1 parent b0e6988 commit 7dfe22b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion MetaMorpheus/GUI/MetaDraw/MetaDraw.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Easy.Common.Extensions;
using EngineLayer;
using GuiFunctions;
using Nett;
Expand Down Expand Up @@ -261,7 +262,10 @@ private void dataGridScanNums_SelectedCellsChanged(object sender, SelectedCellsC
{

int descriptionLineCount = MetaDrawSettings.SpectrumDescription.Count(p => p.Value);
descriptionLineCount += (int)Math.Floor((psm.ProteinName.Length - 20) / 26.0);
if (psm.ProteinName.IsNotNullOrEmptyOrWhiteSpace())
{
descriptionLineCount += (int)Math.Floor((psm.ProteinName.Length - 20) / 26.0);
}
if (psm.ProteinAccession.Length > 10)
descriptionLineCount++;
double verticalOffset = descriptionLineCount * 14;
Expand Down
5 changes: 3 additions & 2 deletions MetaMorpheus/GuiFunctions/MetaDraw/DrawnSequence.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ public void AnnotateBaseSequence(string baseSequence, string fullSequence, int y
}
double canvasWidth = SequenceDrawingCanvas.Width;
int spacing = 12;
int psmStartResidue = psm.StartAndEndResiduesInProtein != null
? int.Parse(psm.StartAndEndResiduesInProtein.Split("to")[0].Replace("[", ""))
: 0;

// draw initial amino acid number
if (stationary && MetaDrawSettings.DrawNumbersUnderStationary)
{
int psmStartResidue = int.Parse(psm.StartAndEndResiduesInProtein.Split("to")[0].Replace("[", ""));
var startAA = (MetaDrawSettings.FirstAAonScreenIndex + psmStartResidue).ToString().ToCharArray().Reverse().ToArray();
double x = 22;

Expand Down Expand Up @@ -108,7 +110,6 @@ public void AnnotateBaseSequence(string baseSequence, string fullSequence, int y
// draw final amino acid number
if (stationary && MetaDrawSettings.DrawNumbersUnderStationary)
{
int psmStartResidue = int.Parse(psm.StartAndEndResiduesInProtein.Split("to")[0].Replace("[", ""));
var endAA = (MetaDrawSettings.FirstAAonScreenIndex + MetaDrawSettings.NumberOfAAOnScreen + psmStartResidue - 1).ToString();
canvasWidth += spacing;
double x = canvasWidth;
Expand Down

0 comments on commit 7dfe22b

Please sign in to comment.