コード例 #1
0
ファイル: Ribbon.cs プロジェクト: prabuddha1987/NuGenBioChem
 /// <summary>
 /// Gets the backbone of the given residue
 /// </summary>
 /// <param name="residue">Residue</param>
 /// <param name="backbonePoints">Points of the residue backbone</param>
 /// <param name="unitTorsionVectors">Torsion vectors of the backbone curve</param>
 /// <param name="unitNormalVectors">Normal vectors of the backbone curve</param>
 public void GetResidueBackbone(Residue residue,
     out Point3D[] backbonePoints,
     out Vector3D[] unitTorsionVectors,
     out Vector3D[] unitNormalVectors)
 {
     int index;
     if (this.residueIndexTable.TryGetValue(residue.Data, out index))
     {
         int count = 9;
         int first = index * (count - 1);
         backbonePoints = new Point3D[count];
         unitTorsionVectors = new Vector3D[count];
         unitNormalVectors = new Vector3D[count];
         for (int i = 0; i < count - 1; i++)
         {
             backbonePoints[i] = this.controlPoints[first + i];
             CalculateBackboneVectors(backbonePoints[i],
                 this.controlPoints[first + i + 1],
                 this.torsionPoints[first + i],
                 out unitTorsionVectors[i],
                 out unitNormalVectors[i]);
         }
         int last = first + count - 1;
         backbonePoints[count - 1] = this.controlPoints[last];
         if (last == this.controlPoints.Count - 1)
         {
             unitTorsionVectors[count - 1] = unitTorsionVectors[count - 2];
             unitNormalVectors[count - 1] = unitNormalVectors[count - 2];
         }
         else
         {
             CalculateBackboneVectors(this.controlPoints[last],
                 this.controlPoints[last + 1],
                 this.torsionPoints[last],
                 out unitTorsionVectors[count - 1],
                 out unitNormalVectors[count - 1]);
         }
     }
     else
     {
         backbonePoints = null;
         unitTorsionVectors = null;
         unitNormalVectors = null;
     }
 }
コード例 #2
0
ファイル: Ribbon.cs プロジェクト: prabuddha1987/NuGenBioChem
 /// <summary>
 /// Determines whether given residue is the end of a structure
 /// </summary>
 /// <param name="residue">Residue</param>
 /// <returns>true - if the resdiue is start of a helix, a sheet or a turn</returns>
 public bool IsStructureEnd(Residue residue)
 {
     int index;
     if (this.residueIndexTable.TryGetValue(residue.Data, out index))
     {
         if (index == this.residueTypes.Length - 1) return true;
         if (this.residueTypes[index + 1] != this.residueTypes[index]) return true;
         return false;
     }
     else throw new ArgumentException();
 }