Thanks Bob, that works great. I didn't know that the filename could be null
if the reader is supplied.

I doubt anyone cares about the details, but if so see
https://github.com/biojava/biojava/pull/570

-Spencer

On Mon, Aug 29, 2016 at 3:15 PM, Robert Hanson <hans...@stolaf.edu> wrote:

>
> You can now just use
>
> viewer.openReader("filename", reader)
>
> where reader is one of byte[] or BufferedInputStream or Reader
>
> I'm not catching how Jmol is fitting in there in terms of loading an MMTF
> file. How does that reading fit into BioJava's writing?
>
>
> Bob
>
>
>
> On Sun, Aug 28, 2016 at 3:48 PM, Spencer Bliven <spencer.bli...@gmail.com>
> wrote:
>
>> I have a method writeToOutputStream(Structure structure, OutputStream
>> outputStream) that does the mmtf writing. I have flexibility in what
>> type of OutputStream to use. The byte[] is accessible using a
>> ByteArrayOutputStream. If it makes more sense to pass an input stream, I
>> guess this should be possible too using PipedInputStream.
>>
>> Is this the most efficient way to communicate with Jmol given that it's
>> embedded in the same process? For instance, could I just populate some data
>> structure directly? (I might still go with MMTF, since it's fully
>> implemented already)
>>
>> -Spencer
>>
>>
>> On Fri, Aug 26, 2016 at 5:02 PM, Robert Hanson <hans...@stolaf.edu>
>> wrote:
>>
>>> It would be totally inconvenient to treat the byte[] mmtf data as String
>>> data.
>>> You can cache the binary data as a byte array and then pass a cache://
>>> protocol.
>>> Way better would be to pass the data as a buffered stream, but I don't
>>> think that is set up in Jmol.
>>>
>>> You have the data in what form? Full byte array? BufferedInputStream?
>>>
>>> The MMTF reader needs a javajs.api.GenericBinaryDocument.
>>> This it gets from jmol.adapter.smarter.SmarterJm
>>> olAdapter.getAtomSetCollectionFromReader.
>>>
>>> I think I can tweak viewer.loadModelFromFile to allow you to feed it a
>>> BufferedInputStream. Right now it is only set up for a java.io.Reader.
>>>
>>> Will that work for you?
>>>
>>> Bob
>>>
>>>
>>>
>>>
>>>
>>> On Fri, Aug 26, 2016 at 7:46 AM, Spencer Bliven <
>>> spencer.bli...@gmail.com> wrote:
>>>
>>>> I'm trying to update the way BioJava interacts with Jmol. We're
>>>> currently loading structures into Jmol by converting them to PDB format and
>>>> passing that string to JmolViewer.openStringInline(). Now that Jmol 14.6 is
>>>> available in maven, we need to move away from PDB.
>>>>
>>>> My first choice would be to use MMTF as the exchange format. Is there a
>>>> way to pass MMTF to Jmol? Resolver.determineAtomSetCollectionReader
>>>> failed (probably correctly) to recognize an MMTF binary stream when
>>>> converted to a string using the default encoding, so openStringInline()
>>>> doesn't work.
>>>>
>>>> Possibly related, the mmtf demo at http://chemapps.stolaf.edu/
>>>> jmol/jsmol/mmtf.htm gives an unrecognized file format error for me.
>>>>
>>>> -Spencer
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>>
>>>> _______________________________________________
>>>> Jmol-users mailing list
>>>> Jmol-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>>>
>>>>
>>>
>>>
>>> --
>>> Robert M. Hanson
>>> Larson-Anderson Professor of Chemistry
>>> St. Olaf College
>>> Northfield, MN
>>> http://www.stolaf.edu/people/hansonr
>>>
>>>
>>> If nature does not answer first what we want,
>>> it is better to take what answer we get.
>>>
>>> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>>
>>> _______________________________________________
>>> Jmol-users mailing list
>>> Jmol-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>>
>>>
>>
>> ------------------------------------------------------------
>> ------------------
>>
>> _______________________________________________
>> Jmol-users mailing list
>> Jmol-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>>
>>
>
>
> --
> Robert M. Hanson
> Larson-Anderson Professor of Chemistry
> St. Olaf College
> Northfield, MN
> http://www.stolaf.edu/people/hansonr
>
>
> If nature does not answer first what we want,
> it is better to take what answer we get.
>
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>
>
> ------------------------------------------------------------
> ------------------
>
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
------------------------------------------------------------------------------
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to