UnityMol  0.9.6-875
UnityMol viewer / In developement
AlphaChainSmoother.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using System.Collections.Generic;
4 using Molecule.Model;
5 using UI;
6 using Molecule.Control;
7 
8 public class AlphaChainSmoother {
9  public static List<float[]> backupCaList = MoleculeModel.CatomsLocationlist ;
11 // private ArrayList caChainlist;
12 
13 
14  void Start () {
15 // backupCAlist = (ArrayList)MoleculeModel.bondCAList.Clone();
16  // calist = backupCAlist.Clone();
17  // caChainlist = MoleculeModel.bondCAList.Clone();
18  }
19 
24  public static void ReSpline () {
25  List<float[]> alist = MoleculeModel.atomsLocationlist ;
26  List<AtomModel> typelist = MoleculeModel.atomsTypelist ;
27  List<string> atomsNameList = MoleculeModel.atomsNamelist ;
28  List<float[]> calist = new List<float[]>(MoleculeModel.CatomsLocationlist);
29  List<string> caChainlist = new List<string>(MoleculeModel.backupCaSplineChainList);
30  List<int> residlist = MoleculeModel.residueIds;
31  //List<string> resnamelist = MoleculeModel.atomsResnamelist;
32 
33  // Trace interpolation from C-alpha positions
34  // Only if there are more than 2 C-alpha
35  if(calist.Count > 2) {
36 
37  int j = 0;
38  for(int i=1;i<residlist.Count;i++){
39 
40  if(atomsNameList[i] == "CA"){
41  if((atomsNameList[i-1] == atomsNameList[i]) && (residlist[i-1] == residlist[i])){
42  calist.RemoveAt(j);
43  caChainlist.RemoveAt(j);
44  Debug.Log ("Remove");
45  }
46  j++;
47  }
48  }
49 
50  GenInterpolationArray geninterpolationarray = new GenInterpolationArray();
51  geninterpolationarray.InputKeyNodes = calist ;
52  geninterpolationarray.InputTypeArray = caChainlist ;
53  geninterpolationarray.CalculateSplineArray();
54  calist=null;
55  caChainlist=null;
56  calist=geninterpolationarray.OutputKeyNodes;
57  caChainlist=geninterpolationarray.OutputTypeArray;
58  }
60  MoleculeModel.CaSplineTypeList = new List<AtomModel>();
61  for (int k=0; k<calist.Count; k++)
62  MoleculeModel.CaSplineTypeList.Add(AtomModel.GetModel("chain" + caChainlist[k]));
63  MoleculeModel.CaSplineChainList=caChainlist;
64 
65  if(UIData.ffType == UIData.FFType.HiRERNA)
67  else {
68  //MoleculeModel.bondList=ControlMolecule.CreateBondsEPList(alist,typelist);
71  }
72 
73  MoleculeModel.atomsnumber = alist.Count;
75  MoleculeModel.CaSplineChainList = caChainlist ;
76  }
77 }
static List< int[]> CreateBondsList_HiRERNA(List< string > atomnames)
static List< int[]> bondCAList
The bonds between carbon alpha in the CA-Spline.
static List< int[]> CreateBondsCAList(List< string > caChainlist)
Creates a bond list for the carbon alpha splines.
static AtomModel GetModel(string type)
Definition: AtomModel.cs:257
static List< int[]> CreateBondsEPList(List< float[]> atomsLocationlist, List< AtomModel > atomsTypelist)
static FFType ffType
Definition: UIData.cs:241
static List< string > atomsNamelist
The name of each atom.
static List< AtomModel > atomsTypelist
The type of each atom.
static List< int > residueIds
The residue identifiers.
static List< float[]> CatomsLocationlist
The coordinates of each Carbon alpha.
static List< string > backupCaSplineChainList
Sometimes inside pdbs lists are not sorted, and residues mixed So I had to create this list to sort r...
static List< float[]> CaSplineList
The coordinates of each Carbon alpha in the CA-Spline.
!WiP Includes FLAGS of GUI.
Definition: UIData.cs:78
static List< float[]> backupCaList
static List< string > CaSplineChainList
The chain of each carbon alpha in the CA-Spline.
static List< int[]> bondEPList
The bonds between atoms.
static List< string > backupCaChainList
static void ReSpline()
Trace interpolation points from C-alpha positions.
static List< AtomModel > CaSplineTypeList
Type of each carbon alpha in the CA-Spline.
Definition: GUIDisplay.cs:66
static List< float[]> atomsLocationlist
The coordinates of each atom.