void UpdateScores() { if (GameObject.FindObjectsOfType <PlayerControl>().Length > 0) { PlayerControl[] players = GameObject.FindObjectsOfType <PlayerControl>(); if (players.Length > 0) { scores = new List <PScore>(); foreach (var p in players) { PScore n = new PScore(p.name, p.score); scores.Add(n); } scores.Sort((x, y) => y.score.CompareTo(x.score)); foreach (var v in objs) { Destroy(v); } objs = new List <GameObject>(); foreach (var v in scores) { GameObject g = (GameObject)Instantiate(nPrefab); g.transform.SetParent(holder); g.transform.localScale = Vector3.one; bool V = CurrentView.Equals(v.name); g.GetComponent <NameObj>().Init(v.name, v.score, V); objs.Add(g); } } } else { SinglePlayerControl[] players = GameObject.FindObjectsOfType <SinglePlayerControl>(); if (players.Length > 0) { scores = new List <PScore>(); foreach (var p in players) { PScore n = new PScore(p.name, p.score); scores.Add(n); } scores.Sort((x, y) => y.score.CompareTo(x.score)); foreach (var v in objs) { Destroy(v); } objs = new List <GameObject>(); foreach (var v in scores) { GameObject g = (GameObject)Instantiate(nPrefab); g.transform.SetParent(holder); g.transform.localScale = Vector3.one; bool V = CurrentView.Equals(v.name); g.GetComponent <NameObj>().Init(v.name, v.score, V); objs.Add(g); } } } }
public string ToParsimonyProteins(ExperimentGroup exp, bool duplexQuant = false, bool useOnlyCompleteSets = false) { StringBuilder sb = new StringBuilder(512); sb.AppendFormat("{0},{1},{2},{3:G4},{4:G4},{5:G4},{6},{7},{8},{9},", Name, Description, LongestProteinLen, SequenceCoverage, RepresentativeProtein.CalculateSequenceCoverage(Peptides.Where(pep => !pep.IsShared)), SequenceRedundacy, Count, UniquePeptides, Peptides.Count, Peptides.Count(pep => pep.IsShared)); if (exp != null) { int psms; HashSet <Peptide> uniquepeps; UniquePeptidesPerGroup.TryGetValue(exp, out uniquepeps); PsmsPerGroup.TryGetValue(exp, out psms); sb.Append(psms); sb.Append(','); if (uniquepeps != null) { sb.Append(uniquepeps.Count); } sb.Append(','); sb.Append(uniquepeps.Count(pep => pep.IsShared)); sb.Append(','); } sb.Append(PScore.ToString(CultureInfo.InvariantCulture)); if (exp != null && exp.UseQuant) { Quantitation quant; if (Quantitation.TryGetValue(exp.Name, out quant)) { sb.Append(','); sb.Append(quant.PSMs); sb.Append(','); sb.Append(quant.UniquePeptides.Count); sb.Append(','); sb.Append(quant.ToOutput(duplexQuant, exp.MeidanLog2Ratio, useOnlyCompleteSets)); } else { sb.Append(",0,0"); for (int i = 0; i < exp.QuantPlex * 4; i++) { sb.Append(",-"); } if (duplexQuant) { sb.Append(",N/A,N/A"); } } } if (ProteinHoarder.AnnotationType != AnnotationType.None) { sb.Append(','); sb.Append(ProteinIdsString()); sb.Append(','); sb.Append(GeneNamesString()); } return(sb.ToString()); }
void UpdateScores() { if(GameObject.FindObjectsOfType<PlayerControl>().Length > 0) { PlayerControl[] players = GameObject.FindObjectsOfType<PlayerControl>(); if(players.Length > 0) { scores = new List<PScore>(); foreach(var p in players) { PScore n = new PScore(p.name, p.score); scores.Add(n); } scores.Sort((x, y) => y.score.CompareTo(x.score)); foreach(var v in objs) Destroy(v); objs = new List<GameObject>(); foreach(var v in scores) { GameObject g = (GameObject)Instantiate(nPrefab); g.transform.SetParent(holder); g.transform.localScale = Vector3.one; bool V = CurrentView.Equals(v.name); g.GetComponent<NameObj>().Init(v.name, v.score, V); objs.Add(g); } } } else { SinglePlayerControl[] players = GameObject.FindObjectsOfType<SinglePlayerControl>(); if(players.Length > 0) { scores = new List<PScore>(); foreach(var p in players) { PScore n = new PScore(p.name, p.score); scores.Add(n); } scores.Sort((x, y) => y.score.CompareTo(x.score)); foreach(var v in objs) Destroy(v); objs = new List<GameObject>(); foreach(var v in scores) { GameObject g = (GameObject)Instantiate(nPrefab); g.transform.SetParent(holder); g.transform.localScale = Vector3.one; bool V = CurrentView.Equals(v.name); g.GetComponent<NameObj>().Init(v.name, v.score, V); objs.Add(g); } } } }
public string ToOutputLine(OutputFileType type) { StringBuilder sb = new StringBuilder(512); switch (type) { case OutputFileType.Parsimony_Proteins: sb.Append(Name); sb.Append(','); sb.Append(IsDecoy); sb.Append(','); sb.Append("\"" + Description + "\""); sb.Append(','); sb.Append(LongestProteinLen); sb.Append(','); sb.Append(SequenceCoverage.ToString("g4")); sb.Append(','); sb.Append(SequenceRedundacy.ToString("g4")); sb.Append(','); sb.Append(Count); sb.Append(','); sb.Append(Count); // Number of unique proteins... need to figure this one out at some point sb.Append(','); sb.Append(UniquePeptides); sb.Append(','); sb.Append(Peptides.Count); sb.Append(','); sb.AppendLine(PScore.ToString(CultureInfo.InvariantCulture)); sb.Append(','); break; case OutputFileType.Parsimony_Protein_Groups: sb.Append(Name); sb.Append(','); sb.Append("\"" + Description + "\""); sb.Append(','); sb.Append(Count); sb.Append(','); sb.Append(Count); sb.Append(','); sb.Append(UniquePeptides); sb.Append(','); sb.Append(Peptides.Count); sb.Append(','); sb.Append(PScore); sb.AppendLine(); sb.Append(GetProteinStrings()); sb.Append(GetPeptideString()); break; } return(sb.ToString()); }