Skip to content

Commit

Permalink
Version 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
etopcu committed Sep 1, 2020
1 parent 589813d commit 70a306e
Show file tree
Hide file tree
Showing 33 changed files with 1,028 additions and 340 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__Version 1.11__
* Save motif to Peptide Array, OPAL and Peptide list forms
* Direct link from analysis forms to the scorer

__Version 1.10__
* Amino acid letter images are saved as resource for better resolution and optimization
* Improve visual color matrix
Expand Down
Binary file modified Executable/PeSA.zip
Binary file not shown.
30 changes: 28 additions & 2 deletions PeSA.Engine/Data Structures/Motif.cs
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,8 @@ public Bitmap GetBarChart(int width)
{
int pepsize = 0;
if (string.IsNullOrEmpty(WildTypePeptide))
pepsize = PosCaptions?.Count() ?? 0;
else
pepsize = PosCaptions?.Count() ?? PeptideLength;
else //if (!string.IsNullOrEmpty(WildTypePeptide))
pepsize = WildTypePeptide.Length;

//Calculate size for each position
Expand Down Expand Up @@ -661,5 +661,31 @@ public Bitmap GetBarChart(int width)
return bmp;
}

/// <summary>
/// returns the key AA based on the key position
/// if WildTYpePeptide is set, it returns the aa of wildtype corresponding to that position
/// Otherwise it brings the most frequenet amino acid in the positive columns or frequencies
/// </summary>
/// <param name="keyPosition"></param>
/// 0-indexed
/// <returns></returns>
public char GetKeyChar(int keyPosition)
{
char keyAA = ' ';
if (keyPosition >= 0)
{
if (string.IsNullOrEmpty(WildTypePeptide))
{
if (PositiveColumns != null && keyPosition < PositiveColumns.Count())//OPAL - wieght based motif with no wildtypepeptide
keyAA = PositiveColumns[keyPosition].
OrderByDescending(kv => kv.Value).Select(kv => kv.Key).FirstOrDefault();
else if (Frequencies != null && keyPosition < Frequencies.Count())//frequency based peptide array, peptide list
keyAA = Frequencies[keyPosition].OrderByDescending(kv => kv.Value).Select(kv => kv.Key).FirstOrDefault();
}
else if (keyPosition < WildTypePeptide.Length)
keyAA = WildTypePeptide[keyPosition];
}
return keyAA;
}
}
}
1 change: 1 addition & 0 deletions PeSA.Engine/Data Structures/OPALArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class OPALArray: BaseArray
/// </summary>
public string WildTypePeptide { get; set; }

public Motif Motif { get; set; }
override protected void Upgrade(string mode)
{
base.Upgrade(mode);
Expand Down
4 changes: 2 additions & 2 deletions PeSA.Engine/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.10.*")]
[assembly: AssemblyFileVersion("1.10.0.0")]
[assembly: AssemblyVersion("1.11.*")]
[assembly: AssemblyFileVersion("1.11.0.0")]
14 changes: 7 additions & 7 deletions PeSA.Engine/Scorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
namespace PeSA.Engine
{
public class Scorer
{
public Motif Motif { get; set; }
{ public Motif Motif { get; set; }
public List<Protein> ProteinList { get; set; }
public List<string> PeptideList { get; set; }
public List<Score> ScoreList { get; set; }
Expand All @@ -24,16 +23,17 @@ public class Scorer
private int keyPosition = -1;
/// <summary>
/// Key position and character used in scoring
/// O-indexed
/// </summary>
public int KeyPosition
{
get { return keyPosition; }
set
{
if (value >= 0 && value < Motif.WildTypePeptide.Length)
if (value >= 0 && value < Motif.PeptideLength)
{
keyPosition = value;
KeyChar = Motif.WildTypePeptide[keyPosition];
KeyChar = Motif.GetKeyChar(keyPosition);
}
else
{
Expand All @@ -54,8 +54,8 @@ private Score GetScore(string peptide, string inputSegment, int startpos = 0)
{
char aa = inputSegment[pos - startpos];
if (aa == 'x' || aa == 'X') continue;
Dictionary<char, double> posWeights = Motif.PositiveColumns[pos];
Dictionary<char, double> negWeights = Motif.NegativeColumns[pos];
Dictionary<char, double> posWeights = Motif.PositiveColumns?[pos]?? Motif.Frequencies[pos];
Dictionary<char, double> negWeights = Motif.NegativeColumns?[pos];
if (posWeights.ContainsKey(aa))
{
if (UserEnteredPosThreshold != null && posWeights[aa] < UserEnteredPosThreshold)
Expand All @@ -64,7 +64,7 @@ private Score GetScore(string peptide, string inputSegment, int startpos = 0)
s.weightedMatch += posWeights[aa];
s.priorityMatch += posWeights[aa] / posWeights.Count;
}
else if (negWeights.ContainsKey(aa))
else if (negWeights!=null && negWeights.ContainsKey(aa))
{
if (UserEnteredNegThreshold != null && negWeights[aa] < UserEnteredNegThreshold)
continue;
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed PeSA.Windows/Images/BtnMotifBasedScorer.png
Binary file not shown.
Binary file modified PeSA.Windows/Images/BtnMotifValidationDesigner.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified PeSA.Windows/Images/BtnPTMA.psd
Binary file not shown.

0 comments on commit 70a306e

Please sign in to comment.