Skip to content

Commit 9866143

Browse files
committed
Adding Structure.toMMCIF, biojava#188
1 parent 4241fba commit 9866143

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

biojava-structure/src/main/java/org/biojava/nbio/structure/Structure.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,19 @@ public Chain getChainByPDB(String chainId, int modelnr)
486486

487487

488488
/**
489-
* Create a String that contains the contents of a PDB file .
489+
* Create a String that contains this Structure's contents in PDB file format.
490490
*
491491
* @return a String that looks like a PDB file
492492
* @see FileConvert
493493
*/
494494
public String toPDB();
495495

496+
/**
497+
* Create a String that contains this Structure's contents in MMCIF file format.
498+
* @return
499+
*/
500+
public String toMMCIF();
501+
496502
/**
497503
* Set the Compounds
498504
*

biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,16 +599,17 @@ public Chain getChainByPDB(String chainId)
599599
}
600600

601601

602-
/** create a String that contains the contents of a PDB file.
603-
*
604-
* @return a String that represents the structure as a PDB file.
605-
*/
606602
@Override
607603
public String toPDB() {
608604
FileConvert f = new FileConvert(this) ;
609605
return f.toPDB();
610606
}
611607

608+
@Override
609+
public String toMMCIF() {
610+
FileConvert f = new FileConvert(this);
611+
return f.toMMCIF();
612+
}
612613

613614
@Override
614615
public boolean hasChain(String chainId) {

biojava-structure/src/test/java/org/biojava/nbio/structure/io/TestMMCIFWriting.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ public void test1SMT() throws IOException, StructureException {
3737
File outputFile = File.createTempFile("biojava_testing_", ".cif");
3838

3939

40-
FileConvert fc = new FileConvert(originalStruct);
41-
4240
FileWriter fw = new FileWriter(outputFile);
43-
fw.write(fc.toMMCIF());
41+
fw.write(originalStruct.toMMCIF());
4442
fw.close();
4543

4644

0 commit comments

Comments
 (0)