예제 #1
0
        private List <PstTagsDto> JoinInner(int home_peak, int length_tags, List <PstTagsDto> singleLengthPstTagList, int minusonesingleTagsFound, int plusonemaxpstlength, int length) // Here hop_peak will be considered as home_peak
        {
            List <PstTagsDto> wholeDatatemporaryListClasswise = new List <PstTagsDto>();                                                                                                //Full PST data of this Class will be Stored into it

            var subtemporaryList = new PstTagsDto(singleLengthPstTagList[home_peak].startIndex, singleLengthPstTagList[home_peak].endIndex, singleLengthPstTagList[home_peak].startIndexMass, singleLengthPstTagList[home_peak].endIndexMass, singleLengthPstTagList[home_peak].massDifferenceBetweenPeaks, singleLengthPstTagList[home_peak].AminoAcidSymbol, singleLengthPstTagList[home_peak].AminoAcidName, singleLengthPstTagList[home_peak].TagError, singleLengthPstTagList[home_peak].averageIntensity);

            if (length == plusonemaxpstlength)
            {
                wholeDatatemporaryListClasswise.Add(subtemporaryList);
            }
            else
            {
                int hop_peak;
                length = length + 1;

                List <PstTagsDto> temporaryList = new List <PstTagsDto>();
                temporaryList.Add(subtemporaryList);

                wholeDatatemporaryListClasswise.Add(subtemporaryList);

                int subindex = 0;

                for (int start_peak = home_peak; start_peak <= minusonesingleTagsFound - 2; start_peak++)     //
                {
                    hop_peak = start_peak + 1;
                    if (singleLengthPstTagList[home_peak].endIndex == singleLengthPstTagList[hop_peak].startIndex)  // CHECKING "ENDPOSITION" AND "STARTPOSITION" OF SINGLE LENGTH TAGS
                    {
                        wholeDatatemporaryListClasswise.Clear();
                        length_tags = length_tags + 1;
                        var temporaryListClassData = JoinInner(hop_peak, length_tags, singleLengthPstTagList, minusonesingleTagsFound, plusonemaxpstlength, length); //Here Again, JoinInner function is calling (Working as Recursive Function)

                        List <PstTagsDto> intersubwholeDatatemporaryListClasswise = new List <PstTagsDto>();
                        intersubwholeDatatemporaryListClasswise.AddRange(temporaryList);
                        intersubwholeDatatemporaryListClasswise.AddRange(temporaryListClassData);

                        List <PstTagsDto> subwholeDatatemporaryListClasswise = new List <PstTagsDto>();
                        subwholeDatatemporaryListClasswise.AddRange(intersubwholeDatatemporaryListClasswise);
                        //subwholeDatatemporaryListClasswise.Insert(subindex, temporaryList);
                        //subwholeDatatemporaryListClasswise.InsertRange(subindex, temporaryListClassData);
                        wholeDatatemporaryListClasswise.AddRange(subwholeDatatemporaryListClasswise);
                        subindex = subindex + 1;
                    }
                }
            }
            return(wholeDatatemporaryListClasswise);
        }
예제 #2
0
        private List <List <PstTagsDto> > GenerateMultipleLenghtPstList(SearchParametersDto parameters, List <PstTagsDto> singleLengthPstTagList)
        { //FIGURE 6: STEP 3:::: OBTAIN AMINO ACIDS CORRESPONDING TO FRAGMENT-PAIR DIFFERENCES
          //Hops having equal starting peak and ending peak values were joined together to form PST ladders

            List <List <PstTagsDto> > wholeDatatemporaryList = new List <List <PstTagsDto> >(); //Full PST data will be Stored into it     //LadderRaw
            int hop_peak;
            int length_tags             = 0;                                                    //Indexing start from 0 so that why its "0"
            int minusonesingleTagsFound = singleLengthPstTagList.Count - 1;

            for (int home_peak = 0; home_peak <= minusonesingleTagsFound - 2; home_peak++)//HERE IS THE  STARTING OF MAKING MORE THAN ON PST TAGS...
            {
                for (int startIndexmultiple = 0; startIndexmultiple <= minusonesingleTagsFound - 2; startIndexmultiple++)
                {
                    hop_peak = startIndexmultiple + 1;

                    if (singleLengthPstTagList[home_peak].endIndex == singleLengthPstTagList[hop_peak].startIndex)  // CHECKING "ENDPOSITION" AND "STARTPOSITION" OF SINGLE LENGTH TAGS
                    {
                        List <PstTagsDto> temporaryList = new List <PstTagsDto>();
                        var subtemporaryList            = new PstTagsDto(singleLengthPstTagList[home_peak].startIndex, singleLengthPstTagList[home_peak].endIndex, singleLengthPstTagList[home_peak].startIndexMass, singleLengthPstTagList[home_peak].endIndexMass, singleLengthPstTagList[home_peak].massDifferenceBetweenPeaks, singleLengthPstTagList[home_peak].AminoAcidSymbol, singleLengthPstTagList[home_peak].AminoAcidName, singleLengthPstTagList[home_peak].TagError, singleLengthPstTagList[home_peak].averageIntensity); //Home Peak will be attached with everyone...

                        temporaryList.Add(subtemporaryList);

                        var temporaryListClassData = Join(hop_peak, length_tags, singleLengthPstTagList, minusonesingleTagsFound, parameters);


                        for (int index = 0; index <= temporaryListClassData.Count - 1; index++)
                        {
                            List <PstTagsDto> subwholeDatatemporaryList = new List <PstTagsDto>();
                            subwholeDatatemporaryList.Add(subtemporaryList);                    // Willl be start here
                            subwholeDatatemporaryList.AddRange(temporaryListClassData[index]);

                            wholeDatatemporaryList.Insert(length_tags, subwholeDatatemporaryList);
                            length_tags = length_tags + 1;
                        }
                    }
                    if (singleLengthPstTagList[home_peak].endIndex < singleLengthPstTagList[hop_peak].startIndex)
                    {
                        break;
                    }
                }
            }
            return(wholeDatatemporaryList);
        }
예제 #3
0
        private List <PstTagsDto> GenerateSingleLengthPstList(SearchParametersDto parameters, List <peakData2Dlist> peakDatalistsort)
        {
            // SINGLE LENGTH PSTs
            var GenerateSingleLengthPstList = new List <PstTagsDto>();

            //m/z(of MS2) value differences for each Fragment-pair

            //startIndex and endIndex are selecting upper triangle(in Matrix) for calculation to avoid Mirror Image Values {Means: startIndex = 1(means peak 1) and endIndex = 2 (means peak 2) is Equal to startIndex = 2(means peak 2) and endIndex = 1 (means peak 1) WHEN GIVING differences}
            for (var home_peakIndexsingle = 0; home_peakIndexsingle <= peakDatalistsort.Count - 2; home_peakIndexsingle++) // startIndex=0 so that's why its "-1" and according to formula "n-1" which gives us peakData.Mass.Count - 2 //Starting from peak 1(startIndex = 0)
            {
                // for each element of peaklist after ith element
                for (var hop_peakIndexsingle = home_peakIndexsingle + 1; hop_peakIndexsingle <= peakDatalistsort.Count - 1; hop_peakIndexsingle++) //endIndex starts from 0 so that's why peakData.Mass.Count - 1 and according to Formula just "n"
                {
                    var massDifferenceBetweenPeaks = peakDatalistsort[hop_peakIndexsingle].Mass - peakDatalistsort[home_peakIndexsingle].Mass;     //Mass difference between two peaks

                    for (int AminoAcidIndex = 0; AminoAcidIndex <= AminoAcidMasses.Length - 1; AminoAcidIndex++)                                   //Taking 21 amino acids
                    {
                        var TagError = Math.Abs(massDifferenceBetweenPeaks - AminoAcidMasses[AminoAcidIndex]);

                        if (TagError <= parameters.HopThreshhold)
                        {
                            var    aminoAcid        = AminoAcidSymbol[AminoAcidIndex];
                            double avgIntensityList = (peakDatalistsort[home_peakIndexsingle].Intensity + peakDatalistsort[hop_peakIndexsingle].Intensity) / 2;

                            var singleLengthPstTag = new PstTagsDto(home_peakIndexsingle, hop_peakIndexsingle, peakDatalistsort[home_peakIndexsingle].Mass, peakDatalistsort[hop_peakIndexsingle].Mass, massDifferenceBetweenPeaks, AminoAcidSymbol[AminoAcidIndex], AminoAcidName[AminoAcidIndex], TagError, avgIntensityList);

                            GenerateSingleLengthPstList.Add(singleLengthPstTag);
                        }
                        else
                        {
                            if (TagError < -parameters.HopThreshhold)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            return(GenerateSingleLengthPstList);
        }
예제 #4
0
        private List <List <PstTagsDto> > Join(int home_peak, int length_tags, List <PstTagsDto> singleLengthPstTagList, int minusonesingleTagsFound, SearchParametersDto parameters) // IN ABOVE METHOD's PARAMETERS, hop_peak now will be USED as home_peak
        {
            int plusonemaxpstlength = parameters.MaximumPstLength + 1;
            int length = 1; //Change my Name
            int hop_peak;
            int subindex = 0;

            List <List <PstTagsDto> > wholeDatatemporaryListClasswise = new List <List <PstTagsDto> >();   //Full PST data of this Class will be Stored into it
            List <List <PstTagsDto> > sub     = new List <List <PstTagsDto> >();
            List <List <PstTagsDto> > subData = new List <List <PstTagsDto> >();

            List <PstTagsDto> temporaryList = new List <PstTagsDto>();

            int checkpoint = 0;// We want to mimic Join.m of lines(17,18 and 24, 25, 26). So, that if for loop iterate and gave AA_Next{iter,1} = Hop_Info{Home_peak} while if statement(line 19) is FALSE then, what can we do in Perceptron....? {Introduced: checkpoint variable}


            for (int start_peak = home_peak; start_peak <= minusonesingleTagsFound - 1; start_peak++)
            {
                hop_peak = start_peak + 1;

                if (start_peak == home_peak)  // New addition not in SPECTRUM. Now just one time value will be assigned...
                {
                    var subtemporaryList = new PstTagsDto(singleLengthPstTagList[home_peak].startIndex, singleLengthPstTagList[home_peak].endIndex, singleLengthPstTagList[home_peak].startIndexMass, singleLengthPstTagList[home_peak].endIndexMass, singleLengthPstTagList[home_peak].massDifferenceBetweenPeaks, singleLengthPstTagList[home_peak].AminoAcidSymbol, singleLengthPstTagList[home_peak].AminoAcidName, singleLengthPstTagList[home_peak].TagError, singleLengthPstTagList[home_peak].averageIntensity);

                    temporaryList.Add(subtemporaryList); //Dear! make it more computationally efficient

                    sub.Add(temporaryList);
                }
                checkpoint = 0;
                if (singleLengthPstTagList[home_peak].endIndex == singleLengthPstTagList[hop_peak].startIndex)  // CHECKING "ENDPOSITION" AND "STARTPOSITION" OF SINGLE LENGTH TAGS
                {
                    List <List <PstTagsDto> > subwholeDatatemporaryListClasswise = new List <List <PstTagsDto> >();
                    length_tags = length_tags + 1;
                    var temporaryListClassData = JoinInner(hop_peak, length_tags, singleLengthPstTagList, minusonesingleTagsFound, plusonemaxpstlength, length);

                    List <PstTagsDto> intersubwholeDatatemporaryListClasswise = new List <PstTagsDto>();
                    intersubwholeDatatemporaryListClasswise.AddRange(temporaryList);
                    intersubwholeDatatemporaryListClasswise.AddRange(temporaryListClassData);

                    subwholeDatatemporaryListClasswise.Insert(0, intersubwholeDatatemporaryListClasswise);

                    subData.InsertRange(subindex, subwholeDatatemporaryListClasswise);
                    subindex   = subindex + 1;
                    checkpoint = 1; // "checkpoint" is used to check after reaching this point at which "subData populated" whether its go back and populate "sub" due to for loop...?
                }
            }

            if (subData.Count != 0 && checkpoint == 0)
            {
                wholeDatatemporaryListClasswise.AddRange(subData);
                wholeDatatemporaryListClasswise.AddRange(sub);
            }
            else if (subData.Count != 0 && checkpoint == 1)
            {
                wholeDatatemporaryListClasswise.AddRange(subData);
            }
            else
            {
                wholeDatatemporaryListClasswise.AddRange(sub);
            }
            return(wholeDatatemporaryListClasswise);
        }