protected override void GenericGenerator <T> (int[] table) { Queue <ITableNGlycan> queue = new Queue <ITableNGlycan>(); HashSet <string> visited = new HashSet <string>(); T complex = (T)Activator.CreateInstance(typeof(T), table); queue.Enqueue(complex); while (queue.Count > 0) { ITableNGlycan node = queue.Dequeue(); foreach (MonosaccharideType suger in GetSurgerTypes()) { List <ITableNGlycan> neighbors = node.Growth(suger); foreach (ITableNGlycan n in neighbors) { string id = n.GetName(); //Console.WriteLine(id); if (Criteria(n) && !visited.Contains(id)) { queue.Enqueue(n); visited.Add(id); glycans.Add(n); } } } } }
public bool Criteria(ITableNGlycan glycan) { int[] composition = glycan.GetStructure(); return(composition[0] <= HexNAcBound && composition[1] <= HexBound && composition[2] <= FucBound && composition[3] <= NeuAcBound && composition[4] <= NeuGcBound); }
protected ITableNGlycan CreateByAddFucCore() { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(2, 1); return(complex); }
public void ProduceResult(IDataPoints data, ISpectrum spectrum, IGlycoPeptide glycoPeptide) { ITableNGlycan glycan = glycoPeptide.GetGlycan() as ITableNGlycan; Dictionary <string, IPeak> peaks = new Dictionary <string, IPeak>(); List <IAnnotatedPeak> annotatedPeaks = new List <IAnnotatedPeak>(); foreach (PeakPoint pt in data.GetPoints()) { if (!peaks.ContainsKey(pt.GetID())) { double mass = Double.Parse(pt.GetID()); peaks[pt.GetID()] = new GeneralPeak(mass, pt.GetIntensity()); } List <IGlycoPeptide> glycoPeptides = new List <IGlycoPeptide>(); foreach (NGlycoPeptideNode node in pt.GetMaxNode()) { if (IsGlycanMatch(node.GetNGlycan(), glycan)) { glycoPeptides.Add(new GeneralGlycoPeptide(node.GetPeptide(), node.GetNGlycan(), -1)); } } if (glycoPeptides.Count > 0) { IAnnotatedPeak p = new GeneralAnnotatedSpectrumPeak(peaks[pt.GetID()], glycoPeptides); annotatedPeaks.Add(p); } } result = new GeneralAnnotatedSpectrumPeakResultProduct(spectrum, annotatedPeaks.OrderBy(x => x.GetMZ()).ToList()); }
protected ITableNGlycan CreateByAddGlcNAcCore() { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(0, table[0] + 1); return(complex); }
protected void ProduceResult(IDataPoints data, ISpectrum spectrum, List <IGlycoPeptide> precursor) { List <IGlycoPeptideScore> glycoPeptideScores = new List <IGlycoPeptideScore>(); List <NGlycoPeptideNode> nodes = GetMaxNodes(data); //score precursor foreach (IGlycoPeptide glycoPeptide in precursor) { string seq = glycoPeptide.GetPeptide().GetSequence(); ITableNGlycan glycan = glycoPeptide.GetGlycan() as ITableNGlycan; PeakScore score = new PeakScore(); foreach (NGlycoPeptideNode node in nodes) { if (node.GetPeptide().GetSequence() == seq && IsGlycanMatch(node.GetNGlycan(), glycan)) { score.Merge(node); } } if (score.GetScore() > 0) { glycoPeptideScores.Add(new GeneralGlycoPeptideScore(glycoPeptide, score.GetScore())); } } result = new GeneralGlycoPeptideScoreResultProduct(spectrum, glycoPeptideScores); }
public void AddGlycan(ITableNGlycan glycan) { if (!glycanTable.ContainsKey(glycan.GetName())) { glycanTable.Add(glycan.GetName(), glycan); } }
protected ITableNGlycan CreateByAddMan() { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(1, table[1] + 1); return(complex); }
protected ITableNGlycan CreateByAddGlcNAcBisect() { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(3, 1); return(complex); }
public TableNGlycanAccumulatedGlycanMassProxy(ITableNGlycan glycan) { this.glycan = glycan; calculator = UtilMass.Instance; option = UtilMassOption.Instance; massTable = new HashSet <double>(); massTable.Add(calculator.CalcGlycanMass(glycan, option)); }
public NGlycoPeptideNode(ITableNGlycan nGlycan, IPeptide peptide, IScore score) { glycan = nGlycan.TableClone(); this.peptide = peptide.Clone(); this.score = score.Clone(); calculator = UtilMass.Instance; option = UtilMassOption.Instance; mass = calculator.CalcGlycanMass(glycan, option) + calculator.CalcPeptideMass(peptide, option); }
public GeneralTableNGlycanMassProxy(ITableNGlycan glycan) : base(glycan) { massTable = new HashSet <double>(); coreMassTable = new HashSet <double>(); if (NotCore()) { massTable.Add(GlycanCalcMass.Instance.Compute(glycan)); } else { coreMassTable.Add(GlycanCalcMass.Instance.Compute(glycan)); } }
protected List <ITableNGlycan> CreateByAddManBranch() { List <ITableNGlycan> complexList = new List <ITableNGlycan>(); for (int i = 0; i < manBranch; i++) { if (i == 0 || table[i + 4] < table[i + 3]) // make it order { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(i + 4, table[i + 4] + 1); complexList.Add(complex); } } return(complexList); }
public List <double> ComputeComplex(IGlycan glycan) { List <double> massList = new List <double>(); ITableNGlycan nglycan = glycan as ITableNGlycan; int[] table = nglycan.GetNGlycanTable(); double mass = table[4] * HexNAc + table[8] * Hex + table[12] * Fuc + table[16] * NeuAc + table[20] * NeuGc; massList.Add(mass); massList.Add(mass + Hex); massList.Add(mass + Hex * 2); massList.Add(mass + Hex * 2 + HexNAc); massList.Add(mass + Hex * 2 + HexNAc * 2); return(massList); }
protected bool IsGlycanMatch(ITableNGlycan glycan, ITableNGlycan parent) { if (glycan.GetNGlycanType() != parent.GetNGlycanType()) { return(false); } int[] s1 = glycan.GetNGlycanTable(); int[] s2 = parent.GetNGlycanTable(); for (int i = 0; i < s1.Length; i++) { if (s1[i] > s2[i]) { return(false); } } return(true); }
protected List <ITableNGlycan> CreateByAddNeuGc() { List <ITableNGlycan> complexList = new List <ITableNGlycan>(); for (int i = 0; i < branch; i++) { if (i == 0 || table[i + 20] < table[i + 19]) // make it order { if (table[i + 4] > 0 && table[i + 4] == table[i + 8] && table[i + 16] == 0 && table[i + 20] == 0) { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(i + 20, 1); complexList.Add(complex); } } } return(complexList); }
protected List <ITableNGlycan> CreateByAddFucTerminal() { List <ITableNGlycan> complexList = new List <ITableNGlycan>(); for (int i = 0; i < branch; i++) { if (i == 0 || table[i + 12] < table[i + 11]) // make it order { if (table[i + 12] == 0 && table[i + 4] > 0) { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(i + 12, 1); complexList.Add(complex); } } } return(complexList); }
protected List <ITableNGlycan> CreateByAddGal() { List <ITableNGlycan> complexList = new List <ITableNGlycan>(); for (int i = 0; i < branch; i++) { if (i == 0 || table[i + 8] < table[i + 7]) // make it order { if (table[i + 4] == table[i + 8] + 1) { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(i + 8, table[i + 8] + 1); complexList.Add(complex); } } } return(complexList); }
protected List <ITableNGlycan> CreateByAddGlcNAcBranch() { List <ITableNGlycan> complexList = new List <ITableNGlycan>(); for (int i = 0; i < branch; i++) { if (i == 0 || table[i + 6] < table[i + 5]) // make it order { if (table[i + 6] == table[i + 8] && table[i + 10] == 0 && table[i + 12] == 0 && table[i + 14] == 0) { ITableNGlycan complex = this.TableClone(); complex.SetNGlycanTable(i + 6, table[i + 6] + 1); complexList.Add(complex); } } } return(complexList); }
public TableNGlycanProxyTemplate(ITableNGlycan glycan) { this.glycan = glycan; }
public TableNGlycanAccumulatedGlycanStructureProxy(ITableNGlycan glycan) { this.glycan = glycan; glycanTable = new Dictionary <string, ITableNGlycan>(); glycanTable.Add(glycan.GetName(), glycan); }
public ITableNGlycanProxy Generate(ITableNGlycan glycan) { return(new GeneralTableNGlycanMassProxy(glycan)); }