diff --git a/CHANGELOG.md b/CHANGELOG.md index eaf19aa..7b41362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,3 +63,10 @@ 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 + - Cleanup of WriterUtils + - Updated version string in MmtfStructure 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 ``` 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); } } } 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(); } } diff --git a/mmtf-codec/src/test/resources/mmtf/4cup.mmtf b/mmtf-codec/src/test/resources/mmtf/4cup.mmtf index 174db64..17d738f 100644 Binary files a/mmtf-codec/src/test/resources/mmtf/4cup.mmtf and b/mmtf-codec/src/test/resources/mmtf/4cup.mmtf differ 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..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 = "0.2.0"; + public static final String VERSION = "1.0.0"; /** Serial id for this version of the format. */