From 8305f7ed1eb5b144df0358ad177e68dbebdde483 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Mon, 29 Aug 2016 10:53:06 -0700 Subject: [PATCH 1/9] Updated the reduced Encoder to include inter group bonds for polysaccharides. --- .../org/rcsb/mmtf/encoder/ReducedEncoder.java | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/ReducedEncoder.java b/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/ReducedEncoder.java index f299084..264c099 100644 --- a/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/ReducedEncoder.java +++ b/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/ReducedEncoder.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang.ArrayUtils; import org.rcsb.mmtf.api.StructureDataInterface; import org.rcsb.mmtf.decoder.DecoderUtils; @@ -34,9 +35,12 @@ public static StructureDataInterface getReduced(StructureDataInterface structure DecoderUtils.generateBioAssembly(structureDataInterface, adapterToStructureData); DecoderUtils.addEntityInfo(structureDataInterface, adapterToStructureData); // Loop through the Structure data interface this with the appropriate data - int atomCounter=-1; - int groupCounter=-1; - int chainCounter=-1; + int atomCounter= - 1; + int redAtomCounter = -1; + int groupCounter= - 1; + int chainCounter= - 1; + List interGroupBondsToAdd = new ArrayList<>(); + List interGroupRedIndsToAdd = new ArrayList<>(); for (int i=0; i atomIndicesToAdd = getIndicesToAdd(structureDataInterface, groupType, chainType); - int bondsToAdd = findBondsToAdd(atomIndicesToAdd, structureDataInterface, groupType); + int bondsToAdd = findBondsToAdd(atomIndicesToAdd, structureDataInterface, groupType,atomCounter+1); // If there's an atom to add in this group - add it if(atomIndicesToAdd.size()>0){ adapterToStructureData.setGroupInfo(structureDataInterface.getGroupName(groupType), structureDataInterface.getGroupIds()[groupCounter], @@ -60,9 +64,14 @@ public static StructureDataInterface getReduced(StructureDataInterface structure for(int l=0; l0){ @@ -78,6 +87,17 @@ public static StructureDataInterface getReduced(StructureDataInterface structure structureDataInterface.getChainNames()[chainCounter], numGroups); } } + // Add the inter group bonds + for(int i=0; i indicesToAdd, StructureDataInterface structureDataInterface, int groupType) { + private static int findBondsToAdd(List indicesToAdd, StructureDataInterface structureDataInterface, int groupType, int atomCounter) { // Add the bonds if we've copied all the elements + int interGroupBonds = 0; if(indicesToAdd.size()>1){ + if (structureDataInterface.getGroupChemCompType(groupType).toUpperCase().contains("SACCHARIDE")){ + for(int i=0; i0){ - summaryData.numBonds+=structureDataInterface.getGroupBondOrders(groupType).length; - } + summaryData.numBonds+=findBondsToAdd(indicesToAdd, structureDataInterface, groupType, atomCounter); } } } From 71b52960582588d1b47742729c990959d2251413 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Mon, 29 Aug 2016 11:31:34 -0700 Subject: [PATCH 2/9] Updated changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf19aa..13fecfe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,3 +63,8 @@ All notable changes to this project will be documented in this file, following t ## v1.0.1 - 2016-08-18 ### Changed - Added saccharides to the reduced format + + +## v1.0.2 - 2016-08-29 +### Changed + - Added inter group saccharide bonds to the reduced format From 3bd2dd0e5a5c29a448d19d658dc9d1a4d6716be3 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Mon, 29 Aug 2016 11:37:21 -0700 Subject: [PATCH 3/9] Updated README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 85e373e..7d67c68 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Build Status](https://travis-ci.org/rcsb/mmtf-java.svg?branch=master)](https://travis-ci.org/rcsb/mmtf-java) [![Coverage Status](https://coveralls.io/repos/github/rcsb/mmtf-java/badge.svg?branch=master)](https://coveralls.io/github/rcsb/mmtf-java?branch=master) [![Dependency Status](https://www.versioneye.com/user/projects/56feb8e5fcd19a0039f1553c/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56feb8e5fcd19a0039f1553c) -[![Version](http://img.shields.io/badge/version-1.0.1-blue.svg?style=flat)](https://github.com/rcsb/mmtf-java/) [![License](http://img.shields.io/badge/license-Apache 2.0-blue.svg?style=flat)](https://github.com/rcsb/mmtf-java/blob/master/LICENSE.txt) +[![Version](http://img.shields.io/badge/version-1.0.2-blue.svg?style=flat)](https://github.com/rcsb/mmtf-java/) [![License](http://img.shields.io/badge/license-Apache 2.0-blue.svg?style=flat)](https://github.com/rcsb/mmtf-java/blob/master/LICENSE.txt) [![Changelog](https://img.shields.io/badge/changelog--lightgrey.svg?style=flat)](https://github.com/rcsb/mmtf-java/blob/master/CHANGELOG.md) @@ -16,12 +16,12 @@ The alpha release is available on Maven central. org.rcsb mmtf-codec - 1.0.1 + 1.0.2 org.rcsb mmtf-api - 1.0.1 + 1.0.2 ``` From f452be27703c52a7e0c1ead5e2c01bb624568976 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Mon, 29 Aug 2016 13:48:52 -0700 Subject: [PATCH 4/9] Cleanup of code --- .../main/java/org/rcsb/mmtf/encoder/WriterUtils.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/WriterUtils.java b/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/WriterUtils.java index d2b3d0e..6e9fb81 100644 --- a/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/WriterUtils.java +++ b/mmtf-codec/src/main/java/org/rcsb/mmtf/encoder/WriterUtils.java @@ -39,7 +39,6 @@ public static void writeDataToFile(AdapterToStructureData writerToEncoder, Path */ public static byte[] getDataAsByteArr(AdapterToStructureData writerToEncoder) throws IOException { MessagePackSerialization mmtfBeanSeDerializerInterface = new MessagePackSerialization(); - // Get to bean GenericEncoder genericEncoder = new GenericEncoder(writerToEncoder); ByteArrayOutputStream bos = new ByteArrayOutputStream(); mmtfBeanSeDerializerInterface.serialize(genericEncoder.getMmtfEncodedStructure(), bos); @@ -53,13 +52,10 @@ public static byte[] getDataAsByteArr(AdapterToStructureData writerToEncoder) th * @throws IOException an exception creating the GZIP stream */ public static byte[] gzipCompress(byte[] byteArray) throws IOException { - // Function to gzip compress the data for the hashmaps - ByteArrayOutputStream byteStream = - new ByteArrayOutputStream(byteArray.length); + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(byteArray.length); try { - GZIPOutputStream zipStream = - new GZIPOutputStream(byteStream); + GZIPOutputStream zipStream = new GZIPOutputStream(byteStream); try { zipStream.write(byteArray); @@ -73,7 +69,6 @@ public static byte[] gzipCompress(byte[] byteArray) throws IOException { { byteStream.close(); } - byte[] compressedData = byteStream.toByteArray(); - return compressedData; + return byteStream.toByteArray(); } } From e1f30a576b169a2d42ff7bb7768564ccf194ea12 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Mon, 29 Aug 2016 13:49:17 -0700 Subject: [PATCH 5/9] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13fecfe..3047203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,3 +68,4 @@ All notable changes to this project will be documented in this file, following t ## v1.0.2 - 2016-08-29 ### Changed - Added inter group saccharide bonds to the reduced format + - Cleanup of WriterUtils From c9e6ae10195a1118bfbde7124b26da1b611fb4d7 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Thu, 1 Sep 2016 07:47:26 -0700 Subject: [PATCH 6/9] Update the version string to 1.0.2 --- .../src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java b/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java index f144abb..45bdd53 100644 --- a/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java +++ b/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java @@ -26,7 +26,7 @@ public class MmtfStructure implements Serializable { /** The number of characters in a chain.*/ public static final int CHAIN_LENGTH = 4; /** The version of MMTF */ - public static final String VERSION = "0.2.0"; + public static final String VERSION = "1.0.2"; /** Serial id for this version of the format. */ From c3c31ce5b17b5356d54c0c37bddf89f9fd3e14e1 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Thu, 1 Sep 2016 07:48:35 -0700 Subject: [PATCH 7/9] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3047203..7b41362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,3 +69,4 @@ All notable changes to this project will be documented in this file, following t ### Changed - Added inter group saccharide bonds to the reduced format - Cleanup of WriterUtils + - Updated version string in MmtfStructure From 48b13add709ac953095056802fe78d96e0ec2bfe Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Thu, 1 Sep 2016 07:51:45 -0700 Subject: [PATCH 8/9] Revert to 1.0.0 --- .../src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java b/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java index 45bdd53..1a89953 100644 --- a/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java +++ b/mmtf-serialization/src/main/java/org/rcsb/mmtf/dataholders/MmtfStructure.java @@ -26,7 +26,7 @@ public class MmtfStructure implements Serializable { /** The number of characters in a chain.*/ public static final int CHAIN_LENGTH = 4; /** The version of MMTF */ - public static final String VERSION = "1.0.2"; + public static final String VERSION = "1.0.0"; /** Serial id for this version of the format. */ From 03bed419253f08e8e0f53f8d3ddbeb3b04074e44 Mon Sep 17 00:00:00 2001 From: Anthony Bradley Date: Thu, 1 Sep 2016 07:57:44 -0700 Subject: [PATCH 9/9] Updated test data --- mmtf-codec/src/test/resources/mmtf/4cup.mmtf | Bin 19390 -> 19390 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/mmtf-codec/src/test/resources/mmtf/4cup.mmtf b/mmtf-codec/src/test/resources/mmtf/4cup.mmtf index 174db64c49560d533a092923af1aac45f485563f..17d738f3d33807c0140939c454252140d03382d7 100644 GIT binary patch delta 117 zcmdltopIlEM&Wx5>Z@~eOVYwpi;6Sz^OhRw8Eh0*lh~XtDbBdrQbL?@a;t#&<~peo zO+yAC*aXCmK+FNePEZ<1G4TNjkT@$4gTz5J!(?TbWsIVmPq}0>GKy_BbL(IQ0OyYw AmjD0& delta 125 zcmdltopIlEM&Wx5>Z@~eOVYwpi;6Sz^OhRu8Eq6+lh_;}DbC29m!GFwke^eTn_9G4 zS3;R_bDdO)rlA4@1H&dDb_8M$Aa;V%3JeTPd_XoxoE3;c;viaKva-uEMzPJOT(TJ% LMK_zdb+7^eZR{K^