openmolecules.org

 
Home » DataWarrior » Functionality » Defining columntype while appending columns (Defining columntype while appending columns)
Defining columntype while appending columns [message #2131] Thu, 15 February 2024 16:25 Go to next message
helloWorld22 is currently offline  helloWorld22
Messages: 13
Registered: June 2022
Junior Member
Hi,
In DW SDK, while I want to define a columntype after initializing new columns, it is throwing exception.

firstNewColumn = dwInterface.initializeNewColumns(result.get(t).toArray(new String[0]Wink);
dwInterface.setColumnType(firstNewColumn, IPluginHelper.COLUMN_TYPE_STRUCTURE_FROM_SMILES);

The logic is to check if the new column added has a column header "SMILES", if so, then append the column as COLUMN_TYPE_STRUCTURE_FROM_SMILES.

It works fine when setColumnType is not used. But smiles are shown as String and not structure.

The exception occurs in line
dwInterface.setColumnType(firstNewColumn, IPluginHelper.COLUMN_TYPE_STRUCTURE_FROM_SMILES);
as nullpointer exception.

The exception occurs in com.actelion.research.datawarrior.plugin.PluginHelper line:
mCoordinateColumn[column] = mTargetTableModel.addNewColumns(1);

Since mCoordinateColumn is not set in initializeNewColumns, it is throwing nullpointer exception.

Is it possible to set up a column type while appending column?

[Updated on: Thu, 15 February 2024 18:16]

Report message to a moderator

Re: Defining columntype while appending columns [message #2132 is a reply to message #2131] Fri, 16 February 2024 06:33 Go to previous messageGo to next message
nbehrnd is currently offline  nbehrnd
Messages: 221
Registered: June 2019
Senior Member
Hi helloworld22,

because a SMILES string is a sequence of printable characters, why wouldn't a new colum of type `text` defined via the GUI fit your needs here?

Regards,

Norwid

[Updated on: Fri, 16 February 2024 06:49]

Report message to a moderator

Re: Defining columntype while appending columns [message #2133 is a reply to message #2132] Mon, 19 February 2024 10:58 Go to previous messageGo to next message
helloWorld22 is currently offline  helloWorld22
Messages: 13
Registered: June 2022
Junior Member
Hi Norwid,
The requirement is to add columns containing structures and my plugin retrieves the structures(SMILES or Mol File) from our internal database.
I can now append the column as a text as smiles. But I cant convert them as a structure. Unless I convert them as a structure column, I wont be able to do structure search on the existing data.

I tried : dwInterface.setColumnType and added IPluginHelper.COLUMN_TYPE_STRUCTURE_FROM_SMILES. But this doesnot work while appending column.

Is it possible to append column via SDK as structure and not text? I can also retrieve mol files, instead of SMILES, from DB, if that helps.

Thanks

[Updated on: Mon, 19 February 2024 21:51]

Report message to a moderator

Re: Defining columntype while appending columns [message #2134 is a reply to message #2133] Tue, 20 February 2024 06:52 Go to previous messageGo to next message
nbehrnd is currently offline  nbehrnd
Messages: 221
Registered: June 2019
Senior Member
Hello helloWorld22,
I don't know if this is possible.
Norwid
Re: Defining columntype while appending columns [message #2135 is a reply to message #2134] Tue, 20 February 2024 09:54 Go to previous message
helloWorld22 is currently offline  helloWorld22
Messages: 13
Registered: June 2022
Junior Member
Is it possible to make it available in the next release of SDK?
Previous Topic: retreive data from sqlite database?
Next Topic: Export Graph as Image
Goto Forum:
  


Current Time: Sat Oct 12 05:05:16 CEST 2024

Total time taken to generate the page: 0.03168 seconds