Package jgromacs.io
Class IOData
java.lang.Object
jgromacs.io.IOData
This class contains static methods for IO of data objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
howManyModelsInPDB
(String filename) Returns the number of models in the given PDB filestatic Alignment
readAlignmentFromFASTA
(String filename) Reads an alignment from the given FASTA filestatic Trajectory
readDumpedTrajectory
(Structure structure, String filename) Reads a trajectory from the given dumped XTC or TRR filestatic Object
readFromFile
(String filename) Reads a JGromacs object (Structure, IndexSetList, Trajectory or Sequence) from a file automatically identifying the type of the filestatic IndexSet
readIndexSetFromNDX
(String filename) Reads an index set from the given NDX filestatic IndexSetList
readIndexSetListFromNDX
(String filename) Reads an index set list from the given NDX filestatic Sequence
readSequenceFromFASTA
(String filename) Reads a sequence from the given FASTA filestatic Structure
readStructureFromGRO
(String filename) Reads structure from the given GRO filestatic Structure
readStructureFromPDB
(String filename) Reads structure from the given PDB filestatic Structure
readStructureFromPDB
(String filename, int model) Reads the given model from the given PDB filestatic Structure[]
readStructuresFromPDB
(String filename) Reads an ensemble of structures from the given PDB filestatic Structure[]
Reads an ensemble of structures from PDB files in the given directorystatic Trajectory
readTrajectory
(Structure structure, String filename) Reads a trajectory from the given XTC or TRR filestatic Object[]
runGromacsCommand
(String command, String[] filenames) Executes Gromacs commands from within the Java code and reads the listed output files back into JGromacs objects.static void
writeAlignmentToFASTA
(String filename, Alignment alignment) Writes an alignment to the given FASTA filestatic void
writeIndexSetListToNDX
(String filename, IndexSetList indexsetlist) Writes an index set list to the given NDX filestatic void
writeIndexSetToNDX
(String filename, IndexSet set) Writes an index set to the given NDX filestatic void
writeSequenceToFASTA
(String filename, Sequence sequence) Writes a sequence to the given FASTA filestatic void
writeStructureToGRO
(String filename, Structure structure) Writes a structure to the given GRO filestatic void
writeStructureToPDB
(String filename, Structure structure) Writes a structure to the given PDB file
-
Constructor Details
-
IOData
public IOData()
-
-
Method Details
-
readStructureFromGRO
Reads structure from the given GRO file- Parameters:
filename
- Input file name- Returns:
- structure as a Structure object
- Throws:
IOException
-
readStructureFromPDB
Reads structure from the given PDB file- Parameters:
filename
- Input file name- Returns:
- structure as a Structure object
- Throws:
IOException
-
readStructureFromPDB
Reads the given model from the given PDB file- Parameters:
filename
- Input file namemodel
- model to be read- Returns:
- structure as a Structure object
- Throws:
IOException
-
howManyModelsInPDB
Returns the number of models in the given PDB file- Parameters:
filename
- Input file name- Returns:
- number of models
- Throws:
IOException
-
readStructuresFromPDB
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
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
Writes a structure to the given GRO file- Parameters:
filename
- Output file namestructure
- Structure object to be written out- Throws:
IOException
-
writeStructureToPDB
Writes a structure to the given PDB file- Parameters:
filename
- Output file namestructure
- Structure object to be written out- Throws:
IOException
-
readTrajectory
Reads a trajectory from the given XTC or TRR file- Parameters:
structure
- reference structurefilename
- 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 structurefilename
- Input file name- Returns:
- trajectory as a Trajectory object
- Throws:
IOException
-
readSequenceFromFASTA
Reads a sequence from the given FASTA file- Parameters:
filename
- Input file name- Returns:
- sequence as a Sequence object
- Throws:
IOException
-
readAlignmentFromFASTA
Reads an alignment from the given FASTA file- Parameters:
filename
- Input file name- Returns:
- alignment as an Alignment object
- Throws:
IOException
-
writeSequenceToFASTA
Writes a sequence to the given FASTA file- Parameters:
filename
- Output file namesequence
- Sequence object to be written out- Throws:
IOException
-
writeAlignmentToFASTA
Writes an alignment to the given FASTA file- Parameters:
filename
- Output file namealignment
- Alignment object to be written out- Throws:
IOException
-
readIndexSetFromNDX
Reads an index set from the given NDX file- Parameters:
filename
- Input file name- Returns:
- index set as an IndexSet object
- Throws:
IOException
-
readIndexSetListFromNDX
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
Writes an index set to the given NDX file- Parameters:
filename
- Output file nameset
- 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 nameindexsetlist
- IndexSetList object to be written out- Throws:
IOException
-
runGromacsCommand
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 executedfilenames
- array of output file names to be read in- Returns:
- array of JGromacs objects read from the files
- Throws:
IOException
-
readFromFile
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
-