All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.poznan.put.protein.Chi2 Maven / Gradle / Ivy

package pl.poznan.put.protein;

import pl.poznan.put.atom.AtomName;
import pl.poznan.put.constant.Unicode;
import pl.poznan.put.pdb.analysis.MoleculeType;
import pl.poznan.put.torsion.ImmutableAtomBasedTorsionAngleType;
import pl.poznan.put.torsion.TorsionAngleType;
import pl.poznan.put.types.ImmutableQuadruple;
import pl.poznan.put.types.Quadruple;

import java.util.Collection;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

final class Chi2 {
  public static final Quadruple ARGININE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD);
  public static final Quadruple ASPARAGINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.OD1);
  public static final Quadruple ASPARTIC_ACID_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.OD1);
  public static final Quadruple GLUTAMIC_ACID_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD);
  public static final Quadruple GLUTAMINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD);
  public static final Quadruple HISTIDINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.ND1);
  public static final Quadruple ISOLEUCINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG1, AtomName.CD1);
  public static final Quadruple LEUCINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD1);
  public static final Quadruple LYSINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD);
  public static final Quadruple METHIONINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.SD);
  public static final Quadruple PHENYLALANINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD1);
  public static final Quadruple PROLINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD);
  public static final Quadruple TRYPTOPHAN_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD1);
  public static final Quadruple TYROSINE_ATOMS =
      ImmutableQuadruple.of(AtomName.CA, AtomName.CB, AtomName.CG, AtomName.CD1);

  private static final Map, TorsionAngleType> ANGLE_MAP =
      Stream.of(
              Chi2.ARGININE_ATOMS,
              Chi2.ASPARAGINE_ATOMS,
              Chi2.ASPARTIC_ACID_ATOMS,
              Chi2.GLUTAMIC_ACID_ATOMS,
              Chi2.GLUTAMINE_ATOMS,
              Chi2.HISTIDINE_ATOMS,
              Chi2.ISOLEUCINE_ATOMS,
              Chi2.LEUCINE_ATOMS,
              Chi2.LYSINE_ATOMS,
              Chi2.METHIONINE_ATOMS,
              Chi2.PHENYLALANINE_ATOMS,
              Chi2.PROLINE_ATOMS,
              Chi2.TRYPTOPHAN_ATOMS)
          .collect(Collectors.toSet())
          .stream()
          .collect(
              Collectors.toMap(
                  Function.identity(),
                  quad ->
                      ImmutableAtomBasedTorsionAngleType.of(
                          MoleculeType.PROTEIN,
                          Unicode.CHI2,
                          "chi2",
                          quad,
                          ImmutableQuadruple.of(0, 0, 0, 0))));

  private Chi2() {
    super();
  }

  public static Collection angleTypes() {
    return Chi2.ANGLE_MAP.values();
  }

  public static TorsionAngleType getInstance(final Quadruple chiAtoms) {
    return Chi2.ANGLE_MAP.get(chiAtoms);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy