Ejemplo n.º 1
0
 public VectorProteinInterfacePart(VectorProteinInterfacePart vectorProteinInterfacePart)
     : this(
         vectorProteinInterfacePart.FullProteinInterfaceId,
         vectorProteinInterfacePart.InteractionAminoAcids1L,
         vectorProteinInterfacePart.InteractionFlagBools,
         vectorProteinInterfacePart.InteractionNonProteinInterfaceAminoAcids1L,
         vectorProteinInterfacePart.InteractionToNonProteinInterface,
         vectorProteinInterfacePart.ResidueId,
         vectorProteinInterfacePart.SourceAminoAcid1L,
         vectorProteinInterfacePart.SourceAminoAcid3L
         )
 {
     if (vectorProteinInterfacePart == null)
     {
         throw new ArgumentNullException(nameof(vectorProteinInterfacePart));
     }
 }
        /*
         * private static int[] LastPdbChainResidueIndexes(string pdbFilename)
         * {
         *  //var result = new Dictionary<string,int>();
         *  var pdbFile = new ProteinDataBankFile(pdbFilename, new []{ ATOM_Record.ATOM_Field.FieldName });
         *
         *  //var x = ProteinDataBankFileOperations.PdbAtomAcidList();
         *
         *  var atomList = pdbFile.ProteinDataBankFileRecordList.Where(a => a.GetType() == typeof (ATOM_Record)).Select(a=>(ATOM_Record)a).ToList();
         *
         *  var chainIdList = atomList.Select(a=>a.chainID.FieldValue.ToUpperInvariant()).Distinct().ToList();
         *
         *  var result = new int[chainIdList.Count];
         *
         *  for (int index = 0; index < chainIdList.Count; index++)
         *  {
         *      var chainId = chainIdList[index];
         *      var maxResidueIndex = atomList.Where(a => a.chainID.FieldValue.ToUpperInvariant() == chainId).Select(a => int.Parse(a.resSeq.FieldValue)).Max();
         *
         *      result[index] = maxResidueIndex;
         *  }
         *
         *  return result;
         * }
         */

        private static VectorProteinInterfaceWhole MakeVectorProteinInterfaceWhole(string pdbFilename, ProteinInterfaceSequenceAndPositionData proteinInterfaceSequenceAndPositionData, bool reversedSequence, bool reversedInteractions)
        {
            if (pdbFilename == null)
            {
                throw new ArgumentNullException(nameof(pdbFilename));
            }
            if (proteinInterfaceSequenceAndPositionData == null)
            {
                throw new ArgumentNullException(nameof(proteinInterfaceSequenceAndPositionData));
            }

            ProteinInterfaceAminoAcidMetaData[] proteinInterfaceAminoAcidMetaDataArray = proteinInterfaceSequenceAndPositionData.AminoAcidSequenceAllResidueSequenceIndexes;

            var vectorProteinInterfaceWhole = new VectorProteinInterfaceWhole
            {
                FullProteinInterfaceId    = new FullProteinInterfaceId(proteinInterfaceSequenceAndPositionData.FullProteinInterfaceId),
                ProteinInterfaceLength    = proteinInterfaceSequenceAndPositionData.ProteinInterfaceLength,
                FirstResidueSequenceIndex = proteinInterfaceSequenceAndPositionData.StartPosition,
                LastResidueSequenceIndex  = proteinInterfaceSequenceAndPositionData.EndPosition,
                ReversedInteractions      = reversedInteractions,
                ReversedSequence          = reversedSequence,
            };

            //vectorProteinInterfaceWhole.FullSequenceLength = LastPdbChainResidueIndexes(pdbFilename)[vectorProteinInterfaceWhole.FullProteinInterfaceId.ChainId];

            vectorProteinInterfaceWhole.SecondaryStructure = ProteinInterfaceSecondaryStructureLoader.ProteinInterfaceSecondaryStructure(pdbFilename, SpreadsheetFileHandler.AlphabetLetterRollOver(vectorProteinInterfaceWhole.FullProteinInterfaceId.ChainId), vectorProteinInterfaceWhole.FirstResidueSequenceIndex, vectorProteinInterfaceWhole.LastResidueSequenceIndex, vectorProteinInterfaceWhole.ReversedSequence);

            for (int proteinInterfaceAminoAcidMetaDataArrayIndex = 0; proteinInterfaceAminoAcidMetaDataArrayIndex < proteinInterfaceAminoAcidMetaDataArray.Length; proteinInterfaceAminoAcidMetaDataArrayIndex++)
            {
                ProteinInterfaceAminoAcidMetaData proteinInterfaceAminoAcidMetaData = proteinInterfaceAminoAcidMetaDataArray[proteinInterfaceAminoAcidMetaDataArrayIndex];

                var vectorProteinInterfacePart = new VectorProteinInterfacePart(proteinInterfaceAminoAcidMetaData.OppoproteinInterfaceInteractions.Length)
                {
                    FullProteinInterfaceId = new FullProteinInterfaceId(proteinInterfaceSequenceAndPositionData.FullProteinInterfaceId),
                    ResidueId               = proteinInterfaceAminoAcidMetaDataArrayIndex,
                    SourceAminoAcid1L       = proteinInterfaceAminoAcidMetaData.ResidueName1L,
                    SourceAminoAcid3L       = proteinInterfaceAminoAcidMetaData.ResidueName3L,
                    InteractionAminoAcids1L = proteinInterfaceAminoAcidMetaData.ProteinInterfaceInteractionResidueNames1L,
                    InteractionNonProteinInterfaceAminoAcids1L = proteinInterfaceAminoAcidMetaData.NonProteinInterfaceInteractionResidueNames1L,
                    InteractionFlagBools = new bool[proteinInterfaceAminoAcidMetaData.OppoproteinInterfaceInteractions.Length]
                };

                vectorProteinInterfaceWhole.VectorProteinInterfacePartList.Add(vectorProteinInterfacePart);

                Array.Copy(proteinInterfaceAminoAcidMetaData.OppoproteinInterfaceInteractions, vectorProteinInterfacePart.InteractionFlagBools, proteinInterfaceAminoAcidMetaData.OppoproteinInterfaceInteractions.Length);

                if (reversedInteractions)
                {
                    Array.Reverse(vectorProteinInterfacePart.InteractionFlagBools);
                }

                vectorProteinInterfacePart.InteractionToNonProteinInterface = proteinInterfaceAminoAcidMetaData.ProteinInterfaceInteractionType.HasFlag(ProteinInterfaceInteractionType.InteractionWithNonProteinInterface);
            }

            if (vectorProteinInterfaceWhole.ReversedSequence)
            {
                vectorProteinInterfaceWhole.VectorProteinInterfacePartList.Reverse();
            }

            return(vectorProteinInterfaceWhole);
        }