Package jgromacs.io

Class IOData

java.lang.Object
jgromacs.io.IOData

public class IOData extends Object
This class contains static methods for IO of data objects
  • Constructor Details

    • IOData

      public IOData()
  • Method Details

    • readStructureFromGRO

      public static Structure readStructureFromGRO(String filename) throws IOException
      Reads structure from the given GRO file
      Parameters:
      filename - Input file name
      Returns:
      structure as a Structure object
      Throws:
      IOException
    • readStructureFromPDB

      public static Structure readStructureFromPDB(String filename) throws IOException
      Reads structure from the given PDB file
      Parameters:
      filename - Input file name
      Returns:
      structure as a Structure object
      Throws:
      IOException
    • readStructureFromPDB

      public static Structure readStructureFromPDB(String filename, int model) throws IOException
      Reads the given model from the given PDB file
      Parameters:
      filename - Input file name
      model - model to be read
      Returns:
      structure as a Structure object
      Throws:
      IOException
    • howManyModelsInPDB

      public static int howManyModelsInPDB(String filename) throws IOException
      Returns the number of models in the given PDB file
      Parameters:
      filename - Input file name
      Returns:
      number of models
      Throws:
      IOException
    • readStructuresFromPDB

      public static Structure[] readStructuresFromPDB(String filename) throws IOException
      Reads an ensemble of structures from the given PDB file
      Parameters:
      filename - Input file name
      Returns:
      ensemble of structures as a Structure[] object
      Throws:
      IOException
    • readStructuresFromPDBsInDirectory

      public static Structure[] readStructuresFromPDBsInDirectory(String path) throws IOException
      Reads an ensemble of structures from PDB files in the given directory
      Parameters:
      path - path of directory
      Returns:
      ensemble of structures as a Structure[] object
      Throws:
      IOException
    • writeStructureToGRO

      public static void writeStructureToGRO(String filename, Structure structure) throws IOException
      Writes a structure to the given GRO file
      Parameters:
      filename - Output file name
      structure - Structure object to be written out
      Throws:
      IOException
    • writeStructureToPDB

      public static void writeStructureToPDB(String filename, Structure structure) throws IOException
      Writes a structure to the given PDB file
      Parameters:
      filename - Output file name
      structure - Structure object to be written out
      Throws:
      IOException
    • readTrajectory

      public static Trajectory readTrajectory(Structure structure, String filename) throws IOException
      Reads a trajectory from the given XTC or TRR file
      Parameters:
      structure - reference structure
      filename - Input file name
      Returns:
      trajectory as a Trajectory object
      Throws:
      IOException
    • readDumpedTrajectory

      public static Trajectory readDumpedTrajectory(Structure structure, String filename) throws IOException
      Reads a trajectory from the given dumped XTC or TRR file
      Parameters:
      structure - reference structure
      filename - Input file name
      Returns:
      trajectory as a Trajectory object
      Throws:
      IOException
    • readSequenceFromFASTA

      public static Sequence readSequenceFromFASTA(String filename) throws IOException
      Reads a sequence from the given FASTA file
      Parameters:
      filename - Input file name
      Returns:
      sequence as a Sequence object
      Throws:
      IOException
    • readAlignmentFromFASTA

      public static Alignment readAlignmentFromFASTA(String filename) throws IOException
      Reads an alignment from the given FASTA file
      Parameters:
      filename - Input file name
      Returns:
      alignment as an Alignment object
      Throws:
      IOException
    • writeSequenceToFASTA

      public static void writeSequenceToFASTA(String filename, Sequence sequence) throws IOException
      Writes a sequence to the given FASTA file
      Parameters:
      filename - Output file name
      sequence - Sequence object to be written out
      Throws:
      IOException
    • writeAlignmentToFASTA

      public static void writeAlignmentToFASTA(String filename, Alignment alignment) throws IOException
      Writes an alignment to the given FASTA file
      Parameters:
      filename - Output file name
      alignment - Alignment object to be written out
      Throws:
      IOException
    • readIndexSetFromNDX

      public static IndexSet readIndexSetFromNDX(String filename) throws IOException
      Reads an index set from the given NDX file
      Parameters:
      filename - Input file name
      Returns:
      index set as an IndexSet object
      Throws:
      IOException
    • readIndexSetListFromNDX

      public static IndexSetList readIndexSetListFromNDX(String filename) throws IOException
      Reads an index set list from the given NDX file
      Parameters:
      filename - Input file name
      Returns:
      index set list as an IndexSetList object
      Throws:
      IOException
    • writeIndexSetToNDX

      public static void writeIndexSetToNDX(String filename, IndexSet set) throws IOException
      Writes an index set to the given NDX file
      Parameters:
      filename - Output file name
      set - IndexSet object to be written out
      Throws:
      IOException
    • writeIndexSetListToNDX

      public static void writeIndexSetListToNDX(String filename, IndexSetList indexsetlist) throws IOException
      Writes an index set list to the given NDX file
      Parameters:
      filename - Output file name
      indexsetlist - IndexSetList object to be written out
      Throws:
      IOException
    • runGromacsCommand

      public static Object[] runGromacsCommand(String command, String[] filenames) throws IOException
      Executes Gromacs commands from within the Java code and reads the listed output files back into JGromacs objects. (Note that the method can be used to execute not only Gromacs commands.) The commands are run in the Unix shell (sh), so for example shell pipes (>,>>,invalid input: '<',|) can also be used in the command line. The first element of the returned array is the standard output and next elements are the JGromacs objects read in.
      Parameters:
      command - Gromacs command to be executed
      filenames - array of output file names to be read in
      Returns:
      array of JGromacs objects read from the files
      Throws:
      IOException
    • readFromFile

      public static Object readFromFile(String filename) throws IOException
      Reads a JGromacs object (Structure, IndexSetList, Trajectory or Sequence) from a file automatically identifying the type of the file
      Parameters:
      filename - Input file name with correct extension
      Returns:
      JGromacs object
      Throws:
      IOException