Class MMCIFFileTools
- java.lang.Object
-
- org.biojava.nbio.structure.io.mmcif.MMCIFFileTools
-
public class MMCIFFileTools extends java.lang.ObjectSome tools for mmCIF file writing. See http://www.iucr.org/__data/assets/pdf_file/0019/22618/cifguide.pdf CIF categories are represented as a simple bean, typically extendingAbstractBean. By default, all fields from the bean are taken as the CIF labels. Fields may be omitted by annotating them as@IgnoreField. The CIF label for a field may be changed (for instance, for fields that are not valid Java identifiers) by defining a function static MapgetCIFLabelMap() mapping from the field's name to the correct label.- Author:
- Jose Duarte, Spencer Bliven
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMMCIF_DEFAULT_VALUEThe character to be printed out as a default value in mmCIF files, e.g.static java.lang.StringMMCIF_MISSING_VALUEThe character to be printed out in cases where a value is not assigned in mmCIF files
-
Constructor Summary
Constructors Constructor Description MMCIFFileTools()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static AtomSiteconvertAtomToAtomSite(Atom a, int model, java.lang.String chainId, java.lang.String internalChainId)Converts an Atom object to anAtomSiteobject.static AtomSiteconvertAtomToAtomSite(Atom a, int model, java.lang.String chainId, java.lang.String internalChainId, int atomId)Converts an Atom object to anAtomSiteobject.static java.util.List<AtomSite>convertChainToAtomSites(Chain c, int model, java.lang.String chainId, java.lang.String internalChainId)Converts a Chain into a List ofAtomSiteobjectsstatic CellconvertCrystalCellToCell(CrystalCell c)Converts a CrystalCell object to aCellobject.static SymmetryconvertSpaceGroupToSymmetry(SpaceGroup sg)Converts a SpaceGroup object to aSymmetryobject.static java.util.List<AtomSite>convertStructureToAtomSites(Structure s)Converts a Structure into a List ofAtomSiteobjectsstatic java.lang.String[]getFieldNames(java.lang.reflect.Field[] fields)Gets the mmCIF record name for each field.static java.lang.reflect.Field[]getFields(java.lang.Class<?> c)Gets all fields for a particular class, filtering fields annotated with@IgnoreField.static java.lang.StringtoLoopMmCifHeaderString(java.lang.String categoryName, java.lang.String className)Produces a mmCIF loop header string for the given categoryName and className.static java.lang.StringtoMMCIF(java.lang.String categoryName, java.lang.Object o)Converts a mmCIF bean (seeorg.biojava.nbio.structure.io.mmcif.modelto a String representing it in mmCIF (single-record) format.static <T> java.lang.StringtoMMCIF(java.util.List<T> list)Deprecated.ThetoMMCIF(List, Class)provides compile-time type safetystatic <T> java.lang.StringtoMMCIF(java.util.List<T> list, java.lang.Class<T> klass)Converts a list of mmCIF beans (seeorg.biojava.nbio.structure.io.mmcif.modelto a String representing them in mmCIF loop format with one record per line.
-
-
-
Field Detail
-
MMCIF_MISSING_VALUE
public static final java.lang.String MMCIF_MISSING_VALUE
The character to be printed out in cases where a value is not assigned in mmCIF files- See Also:
- Constant Field Values
-
MMCIF_DEFAULT_VALUE
public static final java.lang.String MMCIF_DEFAULT_VALUE
The character to be printed out as a default value in mmCIF files, e.g. for the default alt_locs- See Also:
- Constant Field Values
-
-
Method Detail
-
toLoopMmCifHeaderString
public static java.lang.String toLoopMmCifHeaderString(java.lang.String categoryName, java.lang.String className) throws java.lang.ClassNotFoundExceptionProduces a mmCIF loop header string for the given categoryName and className. className must be one of the beans in theorg.biojava.nbio.structure.io.mmcif.modelpackage- Parameters:
categoryName-className-- Returns:
- Throws:
java.lang.ClassNotFoundException- if the given className can not be found
-
toMMCIF
public static java.lang.String toMMCIF(java.lang.String categoryName, java.lang.Object o)Converts a mmCIF bean (seeorg.biojava.nbio.structure.io.mmcif.modelto a String representing it in mmCIF (single-record) format.- Parameters:
categoryName-o-- Returns:
-
getFields
public static java.lang.reflect.Field[] getFields(java.lang.Class<?> c)
Gets all fields for a particular class, filtering fields annotated with@IgnoreField. As a side effect, callssetAccessible(true)on all fields.- Parameters:
c-- Returns:
-
getFieldNames
public static java.lang.String[] getFieldNames(java.lang.reflect.Field[] fields)
Gets the mmCIF record name for each field. This is generally just the name of the field or the value specified by the@CIFLabelannotation. As a side effect, callssetAccessible(true)on all fields.- Parameters:
fields-- Returns:
-
toMMCIF
public static <T> java.lang.String toMMCIF(java.util.List<T> list, java.lang.Class<T> klass)Converts a list of mmCIF beans (seeorg.biojava.nbio.structure.io.mmcif.modelto a String representing them in mmCIF loop format with one record per line.- Parameters:
list-- Returns:
-
toMMCIF
@Deprecated public static <T> java.lang.String toMMCIF(java.util.List<T> list)
Deprecated.ThetoMMCIF(List, Class)provides compile-time type safetyConverts a list of mmCIF beans (seeorg.biojava.nbio.structure.io.mmcif.modelto a String representing them in mmCIF loop format with one record per line.- Parameters:
list-- Returns:
- Throws:
java.lang.ClassCastException- if not all list elements have the same type
-
convertSpaceGroupToSymmetry
public static Symmetry convertSpaceGroupToSymmetry(SpaceGroup sg)
Converts a SpaceGroup object to aSymmetryobject.- Parameters:
sg-- Returns:
-
convertCrystalCellToCell
public static Cell convertCrystalCellToCell(CrystalCell c)
Converts a CrystalCell object to aCellobject.- Parameters:
c-- Returns:
-
convertAtomToAtomSite
public static AtomSite convertAtomToAtomSite(Atom a, int model, java.lang.String chainId, java.lang.String internalChainId)
Converts an Atom object to anAtomSiteobject.- Parameters:
a-model-chainId-internalChainId-- Returns:
-
convertAtomToAtomSite
public static AtomSite convertAtomToAtomSite(Atom a, int model, java.lang.String chainId, java.lang.String internalChainId, int atomId)
Converts an Atom object to anAtomSiteobject.- Parameters:
a-model-chainId-internalChainId-atomId- the atom id to be written to AtomSite- Returns:
-
convertChainToAtomSites
public static java.util.List<AtomSite> convertChainToAtomSites(Chain c, int model, java.lang.String chainId, java.lang.String internalChainId)
Converts a Chain into a List ofAtomSiteobjects- Parameters:
c-model-chainId-internalChainId-- Returns:
-
-