openmolecules.org

 
Home » DataWarrior » Functionality » FlyingObjects.dwar's picture and description fields (How to create a visualization like flyingobjects.dwar?)
FlyingObjects.dwar's picture and description fields [message #304] Fri, 02 February 2018 03:45 Go to next message
etcdata is currently offline  etcdata
Messages: 2
Registered: February 2018
Junior Member
Hello,

The flyingobjects.dwar file which comes with DW has a picture and description associated with each row in the data table.

Can you point me to some documentation describing how such a visualization file is created?


Thank you.
Re: FlyingObjects.dwar's picture and description fields [message #306 is a reply to message #304] Sun, 04 February 2018 19:54 Go to previous messageGo to next message
thomas is currently offline  thomas
Messages: 646
Registered: June 2014
Senior Member
There is not official explanation and there is no direct way from DataWarrior to import images or html content.

But you can do that with a little editing of the dwar file in a text editor.

Lets assume you intend to add html and jpeg files to a column named 'Name'. You start with:
-a dwar file without any associated html or jpeg content.
-a folder with html files and one with jpeg files, both to be associated with the rows of the dwar file.

First you need to define one of the dwar's columns to carry the detail information.
This is done by defining column properties. Lets assume you want to add the detail links to
a column called 'Name'. For that you need to extend the column properties section, if there is one.
Otherwise you create a new one just after the </datawarrior-fileinfo> line. For that you add these lines:
<column properties>
<columnName="Name">
<columnProperty="detailCount 2">
<columnProperty="detailType0 image/jpeg">
<columnProperty="detailName0 Picture">
<columnProperty="detailSource0 relPath:images/">
<columnProperty="detailName1 Description">
<columnProperty="detailType1 text/html">
<columnProperty="detailSource1 relPath:html/">
</column properties>

These lines define for the column 'Name' two detail types (indicated by '0' and '1'):
- mime type 'image/jpeg' with the name 'Picture' to be found in a directory 'images'
- mime type 'text/html' with the name 'Description' to be found in a directory 'html'
Likewise you might use 'absPath' to define a complate detail directory path rather than a relative path from the dwar file.

Now you may concatenate detail file references to the respective cell content of the 'Name' column.
For instance you may add to a cell containing the name 'Aermacchi' the following: '|#|0:aermacchi.jpg|#|1:aermacchi.html'.
'|#|' serves as separator. Then comes a number (here 0 or 1) referring to the detail number in the properties section.
After the columns comes the detail file name. It must reflect the defined mime type.

If you open the updated dwar file in DataWarrior, if will show you the detail information. You may
the save the file under a different name and DataWarrior will ask you, whether the detail shall
be imported directly into the dwar file. If you do so, the directories with the individual files are not needed anymore.

I hope, I was clear and this solves your question...

Thomas

[Updated on: Sun, 04 February 2018 19:55]

Report message to a moderator

Re: FlyingObjects.dwar's picture and description fields [message #312 is a reply to message #306] Tue, 06 February 2018 11:34 Go to previous messageGo to next message
etcdata is currently offline  etcdata
Messages: 2
Registered: February 2018
Junior Member
Yes you have solved my question, thank you.

Inspection of the flyingobjects.dwar file shows that pictures are encoded to text for embedding and digging around in the source code revealed that the BinaryEncoder class is responsible for doing the encoding. I'll be able to generate dwar with embedded content now.


Re: FlyingObjects.dwar's picture and description fields [message #2031 is a reply to message #306] Wed, 22 November 2023 13:19 Go to previous messageGo to next message
helloWorld22 is currently offline  helloWorld22
Messages: 13
Registered: June 2022
Junior Member
Hi,
Where can i find flyingobjects.dwar file please?
And is it possible to show embedded image from a link instead of referring to images from a file location?

Thanks,

[Updated on: Wed, 22 November 2023 13:20]

Report message to a moderator

Re: FlyingObjects.dwar's picture and description fields [message #2033 is a reply to message #2031] Wed, 22 November 2023 20:24 Go to previous messageGo to next message
nbehrnd is currently offline  nbehrnd
Messages: 204
Registered: June 2019
Senior Member
Hello helloWorld22,

to get familiar with the program's working, the default installation of DW in Linux in path /opt/datawarrior/ provides the wanted file in the folder /opt/datawarrior/example. The same folder provides eight additional demo files, too.* For an installation in OS/X and Windows I assume the pattern to be a similar, if not identical.

Norwid


* boxplots.dwar, costOfLiving2018.dwar, healthAndWealth1950+.dwar, macroWithActivityCliffsAndScaffolds.dwar, polyeder.dwar, processorsAndTransistors.dwar, winterScenery.dwar, and worldfactbook.dwar

[Updated on: Thu, 23 November 2023 08:38]

Report message to a moderator

Re: FlyingObjects.dwar's picture and description fields [message #2034 is a reply to message #2033] Thu, 23 November 2023 11:24 Go to previous message
helloWorld22 is currently offline  helloWorld22
Messages: 13
Registered: June 2022
Junior Member
Hi Norwid,
Thanks for pointing out the file in examples folder.
I can find the image in embedded in the flyingObjects.dwar file.

I can now render images from a link inside datawarrior without embedding it.
For anyone who wants to render images dynamically inside datawarrior:

And if your row has a variable, based on which you want to render the image, mention %s
So, for example, the row shows a link and the image in the link needs to be rendered inside datawarrior and also want to show an html page, following changes need to be done in the dwar file:

<columnName="Image URL">
<columnProperty="lookupName0 IC50 IMAGE">
<columnProperty="lookupURL0 <BASE_URL=?>%s">
<columnProperty="lookupCount 1">
<columnProperty="detailType0 image/jpeg">
<columnProperty="detailName0 Picture">
<columnProperty="detailType1 text/html">
<columnProperty="detailName1 Description">
<columnProperty="detailSource1 url/response:%s">
<columnProperty="detailSource0 url/response:<BASE_URL=?>%s">
<columnProperty="detailCount 2">

And the image url column will look like
70199_2_1|#|0:70199_2_1|#|1:<HTML_URL>

<BASE_URL=?> will have the base path and is the end point URI and final url after rendering will be
<BASE_URL=?>70199_2_1

<HTML_URL> is an html page that can be rendered inside DW(remember, javascript will not be rendered and only static html file will be rendered

inside SDK,
you can achieve this by mentioning like this
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyLookupCount, "1");
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyLookupName+"0", "IC50 Image");
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyLookupURL+"0", BASE_IMAGE_URL+"%s");
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyDetailCount, "2");

dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyDetailType+"0", "image/jpeg");
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyDetailName+"0", "Picture");
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyDetailSource+"0", "url/response:"+BASE_IMAGE_URL+"%s");

dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyDetailType+"1", "text/html");
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyDetailName+"1", "Description");
dwInterface.setColumnProperty(colImage, CompoundTableConstants.cColumnPropertyDetailSource+"1", "url/response:%s");

FYI for others who want to render image inside datawarrior dynamically.

Awesome cheminformatics tool.
Cheers.

[Updated on: Thu, 23 November 2023 17:54]

Report message to a moderator

Previous Topic: feature suggest: array cleaning by delete button
Next Topic: Generate Explanation view based on the data from table
Goto Forum:
  


Current Time: Thu Mar 28 21:06:09 CET 2024

Total time taken to generate the page: 0.08470 seconds