public static string FindProteinInterfaceAminoAcidCommonPropertiesMotif(List <string> proteinInterfaceSequenceList, AminoAcidPropertyMatchType aminoAcidPropertyMatchType, double matchValue = 0) { if (proteinInterfaceSequenceList == null) { throw new ArgumentNullException(nameof(proteinInterfaceSequenceList)); } var totalProteinInterfaces = proteinInterfaceSequenceList.Count; var proteinInterfaceLength = proteinInterfaceSequenceList.Select(a => a.Length).Max(); var aminoAcidObjects = new AminoAcidProperties <bool> [TotalAminoAcids]; for (var aaIndex = 0; aaIndex < aminoAcidObjects.Length; aaIndex++) { aminoAcidObjects[aaIndex] = AminoAcidConversions.AminoAcidNumberToAminoAcidObject(aaIndex + 1); } var aminoAcidPositionCount = new AminoAcidProperties <int> [proteinInterfaceLength]; for (var position = 0; position < aminoAcidPositionCount.Length; position++) { aminoAcidPositionCount[position] = new AminoAcidProperties <int>(); } var motifs = new List <string>(); for (int positionIndex = 0; positionIndex < proteinInterfaceLength; positionIndex++) { string positionMotif = ""; foreach (var aaCode in proteinInterfaceSequenceList.Where(a => a.Length > positionIndex).Select(a => a[positionIndex]).Distinct().ToArray()) { if (!char.IsLetterOrDigit(aaCode) || NonStandardAminoAcids.Contains(aaCode)) { continue; } var aminoAcid = aminoAcidObjects[AminoAcidConversions.AminoAcidNameToNumber(aaCode) - 1]; var matches = AminoAcidConversions.ListAminoAcidsByProperty(aminoAcid, aminoAcidPropertyMatchType, matchValue); positionMotif += string.Join("", matches.Where(a => !positionMotif.Contains(a) && !NonStandardAminoAcids.Contains(a)).ToArray()); } motifs.Add(positionMotif); } return(MotifFormatter(motifs)); }
public void TestAminoAcids() { //int intAcidic = 0; int intAliphatic = 0; int intAromatic = 0; int intCharged = 0; int intHydrophobic = 0; int intHydroxylic = 0; int intNegative = 0; int intPolar = 0; int intPositive = 0; int intSmall = 0; int intSulphur = 0; int intTiny = 0; //string strAcidic = ""; string strAliphatic = ""; string strAromatic = ""; string strCharged = ""; string strHydrophobic = ""; string strHydroxylic = ""; string strNegative = ""; string strPolar = ""; string strPositive = ""; string strSmall = ""; string strSulphur = ""; string strTiny = ""; for (var i = 1; i <= 26; i++) { var x = AminoAcidConversions.AminoAcidNumberToAminoAcidObject(i); //if (x.Acidic) //{ //intAcidic++; //strAcidic += x.Code1L; //} if (x.Aliphatic) { intAliphatic++; strAliphatic += x.Code1L; } if (x.Aromatic) { intAromatic++; strAromatic += x.Code1L; } if (x.Charged) { intCharged++; strCharged += x.Code1L; } if (x.Hydrophobic) { intHydrophobic++; strHydrophobic += x.Code1L; } if (x.Hydroxylic) { intHydroxylic++; strHydroxylic += x.Code1L; } if (x.Negative) { intNegative++; strNegative += x.Code1L; } if (x.Polar) { intPolar++; strPolar += x.Code1L; } if (x.Positive) { intPositive++; strPositive += x.Code1L; } if (x.Small) { intSmall++; strSmall += x.Code1L; } if (x.Sulphur) { intSulphur++; strSulphur += x.Code1L; } if (x.Tiny) { intTiny++; strTiny += x.Code1L; } } //Console.WriteLine("Acidic: " + intAcidic + " " + strAcidic); Console.WriteLine("Aliphatic: " + intAliphatic + " " + strAliphatic); Console.WriteLine("Aromatic: " + intAromatic + " " + strAromatic); Console.WriteLine("Charged: " + intCharged + " " + strCharged); Console.WriteLine("Hydrophobic: " + intHydrophobic + " " + strHydrophobic); Console.WriteLine("Hydroxylic: " + intHydroxylic + " " + strHydroxylic); Console.WriteLine("Negative: " + intNegative + " " + strNegative); Console.WriteLine("Polar: " + intPolar + " " + strPolar); Console.WriteLine("Positive: " + intPositive + " " + strPositive); Console.WriteLine("Small: " + intSmall + " " + strSmall); Console.WriteLine("Sulphur: " + intSulphur + " " + strSulphur); Console.WriteLine("Tiny: " + intTiny + " " + strTiny); }
public void TestListAminoAcidsByProperty() { var x = new AminoAcidProperties<string>() { //Acidic = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Acidic = true}), Aliphatic = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Aliphatic = true}), Aromatic = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Aromatic = true}), Charged = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Charged = true}), Hydrophobic = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Hydrophobic = true}), Hydroxylic = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Hydroxylic = true}), Negative = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Negative = true}), Polar = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Polar = true}), Positive = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Positive = true}), Small = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Small = true}), Sulphur = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {Sulphur = true}), Tiny = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() { Tiny = true }), }; var uncommon = AminoAcidConversions.ListAminoAcidsByProperty(new AminoAcidProperties<bool>() {}, AminoAcidPropertyMatchType.AllMatch); var y = new AminoAcidProperties<string>() { }; for (var i = 0; i < AminoAcidTotals.TotalAminoAcids(); i++) { var aa = AminoAcidConversions.AminoAcidNumberToAminoAcidObject(i + 1); //if (aa.Acidic) y.Acidic += aa.Code1L; if (aa.Aliphatic) y.Aliphatic += aa.Code1L; if (aa.Aromatic) y.Aromatic += aa.Code1L; if (aa.Charged) y.Charged += aa.Code1L; if (aa.Hydrophobic) y.Hydrophobic += aa.Code1L; if (aa.Hydroxylic) y.Hydroxylic += aa.Code1L; if (aa.Negative) y.Negative += aa.Code1L; if (aa.Polar) y.Polar += aa.Code1L; if (aa.Positive) y.Positive += aa.Code1L; if (aa.Small) y.Small += aa.Code1L; if (aa.Sulphur) y.Sulphur += aa.Code1L; if (aa.Tiny) y.Tiny += aa.Code1L; } //Console.WriteLine("Acidic: " + x.Acidic); Console.WriteLine("Aliphatic: " + x.Aliphatic); Console.WriteLine("Aromatic: " + x.Aromatic); Console.WriteLine("Charged: " + x.Charged); Console.WriteLine("Hydrophobic: " + x.Hydrophobic); Console.WriteLine("Hydroxylic: " + x.Hydroxylic); Console.WriteLine("Negative: " + x.Negative); Console.WriteLine("Polar: " + x.Polar); Console.WriteLine("Positive: " + x.Positive); Console.WriteLine("Small: " + x.Small); Console.WriteLine("Sulphur: " + x.Sulphur); Console.WriteLine("Tiny: " + x.Tiny); Console.WriteLine("Others: " + uncommon); //Assert.AreEqual(string.Join(" ", y.Acidic.OrderBy(a=>a).ToArray()), string.Join(" ", x.Acidic.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Aliphatic.OrderBy(a=>a).ToArray()), string.Join(" ", x.Aliphatic.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Aromatic.OrderBy(a=>a).ToArray()), string.Join(" ", x.Aromatic.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Charged.OrderBy(a=>a).ToArray()), string.Join(" ", x.Charged.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Hydrophobic.OrderBy(a=>a).ToArray()), string.Join(" ", x.Hydrophobic.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Hydroxylic.OrderBy(a=>a).ToArray()), string.Join(" ", x.Hydroxylic.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Negative.OrderBy(a=>a).ToArray()), string.Join(" ", x.Negative.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Polar.OrderBy(a=>a).ToArray()), string.Join(" ", x.Polar.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Positive.OrderBy(a=>a).ToArray()), string.Join(" ", x.Positive.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Small.OrderBy(a=>a).ToArray()), string.Join(" ", x.Small.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Sulphur.OrderBy(a=>a).ToArray()), string.Join(" ", x.Sulphur.OrderBy(a=>a).ToArray())); Assert.AreEqual(string.Join(" ", y.Tiny.OrderBy(a=>a).ToArray()), string.Join(" ", x.Tiny.OrderBy(a=>a).ToArray())); }