Esempio n. 1
0
        /// <summary>
        /// Aligns <paramref name="peptide2"/> with <paramref name="peptide1"/>
        /// </summary>
        /// <returns>
        /// Linear transformation that maps <paramref name="peptide2"/> positions
        /// to best alignment with <paramref name="peptide1"/>
        /// </returns>
        public ProteinAlignerResult Align(Peptide peptide1, Peptide peptide2)
        {
            // TODO: Select sequences where missing amino acids are filled in (using sequence numbers)
            var sequence1AminoAcids           = peptide1.AminoAcids.Select(aa => aa.Name).ToList();
            var sequence2AminoAcids           = peptide2.AminoAcids.Select(aa => aa.Name).ToList();
            var logicalAlignment              = SequenceAligner.Align(sequence1AminoAcids, sequence2AminoAcids);
            var sequence1CarbonAlphaPositions = logicalAlignment.AlignedPairs
                                                .Select(alignedPair => alignedPair.Item1Index)
                                                .Select(aminoAcidIdx => peptide1.AminoAcids[aminoAcidIdx].GetAtomFromName("CA"))
                                                .Select(carbonAlpha => carbonAlpha?.Position?.In(SIPrefix.Pico, Unit.Meter))
                                                .ToList();
            var sequence2CarbonAlphaPositions = logicalAlignment.AlignedPairs
                                                .Select(alignedPair => alignedPair.Item2Index)
                                                .Select(aminoAcidIdx => peptide2.AminoAcids[aminoAcidIdx].GetAtomFromName("CA"))
                                                .Select(carbonAlpha => carbonAlpha?.Position?.In(SIPrefix.Pico, Unit.Meter))
                                                .ToList();

            return(AlignUsingPositionPairs(sequence1CarbonAlphaPositions, sequence2CarbonAlphaPositions));
        }
Esempio n. 2
0
        public void Debug()
        {
            var aligner   = new ProteinAligner();
            var sequence1 = new List <AminoAcidName>
            {
                AminoAcidName.Alanine,
                AminoAcidName.Glutamine,
                AminoAcidName.Glycine,
                AminoAcidName.Isoleucine
            };
            var sequence2 = new List <AminoAcidName>
            {
                AminoAcidName.Histidine,
                AminoAcidName.Glycine,
                AminoAcidName.Isoleucine,
                AminoAcidName.Proline,
                AminoAcidName.Methionine
            };
            var alignmentResult = SequenceAligner.Align(sequence1, sequence2);

            Assert.That(alignmentResult, Is.Not.Null);
        }