コード例 #1
0
ファイル: People.cs プロジェクト: KaiZhou-SG/CSharp
 public People()
 {
     firstName = String.Empty;
     lastName = String.Empty;
     id = 0;
     title = Title.Unknown;
     work = null;
     earnMoney = null;
     report = null;
 }
コード例 #2
0
ファイル: People.cs プロジェクト: KaiZhou-SG/CSharp
 public People(string fName, string lName, int id,
     Title title, iWork work, 
     iEarnMoney earnMoney,
     iFinanceReport report)
 {
     this.firstName = fName;
     this.lastName = lName;
     this.id = id;
     this.title = title;
     this.work = work;
     this.earnMoney = earnMoney;
     this.report = report;
 }
コード例 #3
0
            public static int CompareDescendingScore(iWork left, iWork right)
            {
                int compare = -left.score.CompareTo(right.score);

                if (compare == 0)
                {
                    return(left.match.Target.CompareTo(right.match.Target));//Decoy first, target after
                }
                else
                {
                    return(compare);
                }
            }
コード例 #4
0
        public List <T> BuildMashUpList(List <List <T> > Lists)
        {
            //Compute Scores
            Dictionary <T, iWork> scores = new Dictionary <T, iWork>();

            foreach (T match in Lists[0])
            {
                if (!scores.ContainsKey(match))
                {
                    scores.Add(match, new iWork(match));
                }
            }

            for (int indexList = 0; indexList < Lists.Count; indexList++)
            {
                int cumulDecoy = 0;
                for (int i = 0; i < Lists[indexList].Count; i++)
                {
                    if (scores[Lists[indexList][i]].match.Decoy)
                    {
                        cumulDecoy++;
                    }
                }
                double totalDecoy = cumulDecoy;

                cumulDecoy = 0;
                for (int i = 0; i < Lists[indexList].Count; i++)
                {
                    iWork item = scores[Lists[indexList][i]];
                    if (item.match.Decoy)
                    {
                        cumulDecoy++;
                    }
                    item.score += 1.0 - cumulDecoy / totalDecoy;
                }
            }

            //Sort based on score
            List <iWork> listScores = new List <iWork>(scores.Values);

            listScores.Sort(iWork.CompareDescendingScore);

            List <T> sortedList = new List <T>();

            foreach (iWork item in listScores)
            {
                sortedList.Add(item.match);
            }
            return(sortedList);
        }
コード例 #5
0
        private List <T> ComputeFDRedList(List <iWork> orderedList, double desired_fdr)
        {
            int cumulDecoy  = 0;
            int cumulTarget = 0;

            List <T> results        = new List <T>();
            List <T> missingResults = new List <T>();

            for (int index = 0; index < orderedList.Count; index++)
            {
                iWork item = orderedList[index];

                if (item.match.Target)
                {
                    cumulTarget++;
                }
                else
                {
                    cumulDecoy++;
                }

                if (item.match.Target && cumulDecoy / (double)cumulTarget <= desired_fdr)
                {
                    if (missingResults.Count > 0)
                    {
                        results.AddRange(missingResults);
                        missingResults.Clear();
                    }
                    results.Add(item.match);
                }
                else
                {
                    missingResults.Add(item.match);
                }
            }
            return(results);
        }
コード例 #6
0
ファイル: People.cs プロジェクト: KaiZhou-SG/CSharp
 public void SetWorkBehavior(iWork workBehavior)
 {
     this.work = workBehavior;
 }