public Atom(AtomDefinition definition) { _definition = definition; _xyz.X = definition.X; _xyz.Y = definition.Y; _xyz.Z = definition.Z; }
static void Initialize() { #if DEBUG if (IsInitialized) { return; } IsInitialized = true; #endif string json = File.ReadAllText(Database.Paths.Json.ResiduesPath); JArray residues = JArray.Parse(json); aaDefinitions_ = new AaDefinition[residues.Count, 2, 2]; atomDefinitions_ = new AtomDefinition[residues.Count, 2, 2][]; residueClassNumberToLetter_ = new char[residues.Count]; AaCount = residues.Count; // index 1 for (int residueIndex = 0; residueIndex < residues.Count; residueIndex++) { // keep array calling convention reference: AtomQuickDefinition[] allPossibleResidueAtoms = JsonConvert.DeserializeObject<AtomQuickDefinition[]>((residues.ElementAt(i)["atoms"].ToString())); AaDefinition residue = JsonConvert.DeserializeObject <AaDefinition>((residues.ElementAt(residueIndex).ToString())); if (!residueCharToIndex_.ContainsKey(residue.Letter)) { residueCharToIndex_[residue.Letter] = residueIndex; } residueClassNumberToLetter_[residueIndex] = residue.Letter; // index 2 for (int nTerminus = 0; nTerminus <= 1; nTerminus++) { //index 3 Terminus nTerminusCase = nTerminus == 0 ? Terminus.NotNTerminus : Terminus.NTerminus; for (int cTerminus = 0; cTerminus <= 1; cTerminus++) { // TODO: create json files for each residue class (centroid, heavy-atom, etc). will require minor changes like jagged arrays. Terminus cTerminusCase = cTerminus == 0 ? Terminus.NotCTerminus : Terminus.CTerminus; AtomDefinition[] subsetAtoms = residue.Atoms.Where(definition => definition.TerminusCase == Terminus.Always || definition.TerminusCase == nTerminusCase || definition.TerminusCase == cTerminusCase).ToArray(); atomDefinitions_[residueIndex, nTerminus, cTerminus] = subsetAtoms; aaDefinitions_[residueIndex, nTerminus, cTerminus] = new AaDefinition(residue.Name, residue.Letter, subsetAtoms); for (int i = 0; subsetAtoms != null && i < subsetAtoms.Length; i++) { AtomDefinition atom = subsetAtoms[i]; switch (atom.Name) { case "N": Debug.Assert(i == AaDefinition.IndexN); break; case "CA": Debug.Assert(i == AaDefinition.IndexCA); break; case "C": Debug.Assert(i == AaDefinition.IndexC); break; case "O": Debug.Assert(i == AaDefinition.IndexO); break; //case "H": Debug.Assert(i == ResidueQuickDefinition.IndexH); break; } } } } residueNameToIndex_[residue.Name] = residueIndex; } }
public Atom(Atom other) { _xyz = other._xyz; _definition = other._definition; }
public Atom(AtomDefinition definition, Vector3 xyz) { _definition = definition; Xyz = xyz; }