Skip to content

Commit 41c36ae

Browse files
committed
Now biojava can parse mmcif files with carbohydrates, though it ignores the carbohydrate chains
1 parent 18f57de commit 41c36ae

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ public enum EntityType {
4444
*/
4545
POLYMER("polymer"),
4646

47+
/**
48+
* The 'branched' type use mainly to represent carbohydrates.
49+
* The type was introduced in these versions of the mmcif dictionary:
50+
* 5.101 2012-08-22
51+
* 5.291 2017-09-10
52+
* 5.304 2018-08-01
53+
* The type will only be used for PDB-deposited files from July 2020, as part of
54+
* the carbohydrate remediation project.
55+
* @since 5.4.0
56+
*/
57+
BRANCHED("branched"),
58+
4759
/**
4860
* Non-polymeric entities: ligands, metal ions, buffer molecules, etc
4961
*/

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.IOException;
2828
import java.io.InputStream;
2929
import java.io.InputStreamReader;
30+
import java.net.URL;
3031
import java.util.List;
3132
import java.util.zip.GZIPInputStream;
3233

@@ -443,4 +444,28 @@ private static int[] countEntityTypes(List<EntityInfo> entities) {
443444
return counts;
444445

445446
}
447+
448+
@Test
449+
public void testCarbohydrates() throws IOException {
450+
// Example carbohydrate remediation file to be released in July 2020
451+
URL url = new URL("https://raw.githubusercontent.com/pdbxmmcifwg/carbohydrate-extension/master/examples/models/1B5F-carb.cif");
452+
InputStream inStream = url.openStream();
453+
454+
MMcifParser parser = new SimpleMMcifParser();
455+
456+
SimpleMMcifConsumer consumer = new SimpleMMcifConsumer();
457+
parser.addMMcifConsumer(consumer);
458+
parser.parse(new BufferedReader(new InputStreamReader(inStream)));
459+
460+
Structure structure = consumer.getStructure();
461+
462+
assertEquals(7, structure.getEntityInfos().size());
463+
464+
assertEquals(2, structure.getEntityById(1).getChains().size());
465+
assertEquals(2, structure.getEntityById(2).getChains().size());
466+
467+
assertEquals(0, structure.getNonPolyChains().size());
468+
assertEquals(4, structure.getPolyChains().size());
469+
470+
}
446471
}

0 commit comments

Comments
 (0)