Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

Apple Script
Introduction to Applescript
Applescript and UNIX commands
Reading, Writing and using Lists
Line endings and ChemDraw
Building a substructure searchable database
Rendering the chemical structures
Printing the clipboard
Embedding chemical information in image files

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


Embedding chemical information in image files


Previoushome






Embedding chemical information in image files
A D V E R T I S E M E N T

Rich Apodaca has been discussing embedding molecular information in images of molecules, such as a PNG file depicting a 2D structure. As we move to a more web-centric view of the world it is apparent that much of research information will be only available via the web, whilst images of chemical structures are usually adequate for a human viewer the chemical structure cannot be indexed and subsequently searched. In the previous tutorial. I showed how to use applescript to extract the information from the PNG file and then display the structure in a couple of chemical display packages in an editable form.
 

A couple of people have asked for a tool to embed metadata into images and this script shows how to add SMILES string to a PNG file using ChemBioDraw.

This script again relies on the excellent ExifTool by Phil Harvey. ExifTool is a platform-independent Perl library plus a command-line application for reading, writing and editing meta information in images. To allow the addition of custom tags you need to edit and install the exiftool configuration file.
The file and full instructions can be downloaded from the ExifTool website but you need to download the source not the MacOSX binary. To save you time you can just download the file The part of the file that adds the tags is shown below. This new configuration file will allow you to add metadata for SMILES, molfile and sdf to PNG files.

# The %Image::ExifTool::UserDefined hash defines new tags to be added

# to existing tables.

%Image::ExifTool::UserDefined = (

# new PNG tags are added to the PNG::TextualData table:

'Image::ExifTool::PNG::TextualData' => {

SMILES => { },

molfile => { },

sdf => { },

},

);

The downloaded file needs to be installed in the same folder as exiftool which if you installed it using the binary installer will be usr/bin. You will need to rename the file to .ExifTool_config (note the leading period!). This is easist to do using the Terminal. You will need the admin password.

sudo mv /Users/Chris/Desktop/ExifTool_config /usr/bin/.ExifTool_config

If you have installed ExifTool anywhere else you will need to install the configuration file in the appropriate place. You also need OpenBabel and the easiest way to install is to install the ChemSpotlight.

First draw the structure in Chemdraw and save it as a PNG, ignore the warning that chemical information will be lost, we are going to embed it in the metadata :-). Leave ChemBioDraw open with the structure in place.
We then tall ChemBioDraw to get the SMILES string, with a little checking to make sure a structure is selected. The next part uses OpenBabel to generate a canonical SMILES. The last part creates the shell script telling ExifTool to embed the metadata into the selected image file.

The first part of the script below simply asks the user to select the image file that you want to add chemical metaadata to, it then generates the POSIX path to the file since ExifTool requires UNIX style paths. ExifTool will add the metadata and also create a copy of the original PNG file at the same location.

You can check the metadata has been installed using the ExifTool command.

exiftool -v path to imagefile

If you install the applescript in the folder

Applications:CS ChemOffice 2008:CS ChemDraw:ChemDraw Items:


The next time you start up ChemDraw there will be a 'Scripts" menu in the top menu bar and you will be able to access it from within ChemDraw.
chewdraw

The applescript to embed chemical metadata

set theFile to (choose file with prompt "Select the PNG file to add metadata:") as alias

set the_posix_file to POSIX path of theFile


tell application "CS ChemBioDraw Ultra"
	
	if not (enabled of menu item "copy") then
		do menu item "Select All" of menu "Edit"
		set the_SMILES to SMILES of selection
	else
		
		set the_SMILES to SMILES of selection
	end if
	
end tell

--use openbabel to get canonical SMILES
set the_ob_script to "echo '" & the_SMILES & "' | /usr/local/bin/babel  -ismi -osmi"
try
	
	set ob_smiles to (do shell script the_ob_script)
	
end try



--display dialog ob_smiles
set theScript to "exiftool -SMILES=\"" & ob_smiles & "\" " & the_posix_file

do shell script theScript



We obviously would want to add other file formats to the metadata but unfortunately there is a bug in ChemBioDraw such that you cannot script saving as other file formats.



Be the first one to comment on this page.




  Apple Script eBooks

No eBooks on Apple Script could be found as of now.

 
 Apple Script FAQs
More Links » »
 
 Apple Script Interview Questions
More Links » »
 
 Apple Script Articles

No Apple Script Articles could be found as of now.

 
 Apple Script News

No News on Apple Script could be found as of now.

 
 Apple Script Jobs

No Apple Script Articles could be found as of now.


Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome

Keywords: applescript language,applescript documentation,applescript manual,applescript guide,applescript application

HTML Quizzes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizzes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.