public class GenomeAnnosDBQueryToPositionListPlugin
extends AbstractPlugin
Reads a PostgreSQL query file and a genomeAnnosDB connection config file, checks that the query is a SELECT query for chr, position, etc.., executes the query, and turns the results into a PositionList with any result fields other that chr & position added as annotations.
PluginParameter -cf = DB connection configuration file PluginParameter -qf = File containing PostgeSQL SELECT query for chr, position, etc.
Assumes DB server is on the (default) host "localhost" and that the port is the (default) PostgreSQL standard port number (5432)
Example config file:
user=postgres password=myTopSecretPassword DB=maizeGenomeAnnos
Checks that the query is safe: must start with SELECT and must not contain any of the bare words ALTER, COPY, CREATE, DELETE, DROP, INSERT, TRUNCATE, or UPDATE.
ProcessData(null) returns an annotated position list (any fields in the query result other than chr & position added as annotations)
public GenomeAnnosDBQueryToPositionListPlugin()
public GenomeAnnosDBQueryToPositionListPlugin(java.awt.Frame parentFrame,
boolean isInteractive)
public DataSet processData(DataSet input)
Reads a PostgreSQL query file and a genomeAnnosDB connection config file, checks that the query is a SELECT query for chr, position, etc.., executes the query and turns the results into a PositionList with any result fields other that chr & position added as annotations.
Assumes DB server is on the (default) host "localhost" and that the port is the (default) PostgreSQL standard port number (5432)
Example config file: user=postgres password=myTopSecretPassword DB=maizeGenomeAnnos
Checks that the query is safe: must start with SELECT and must not contain any of the bare words ALTER, COPY, CREATE, DELETE, DROP, INSERT, TRUNCATE, or UPDATE.
input - A null DataSet (the DB connection config file & query file are PluginParameters -cf and -qf) or String that represent with the SQL query (overrides the -qf setting)public static java.lang.String checkQuery(java.lang.String query)
Checks that the query is safe and that the results will contain fields labeled "chr" & "position".
The query will be deemed safe if it begins with SELECT and does not contain any of the bare words:
ALTER, COPY, CREATE, DELETE, DROP, INSERT, TRUNCATE, or UPDATE.
query - The query to be evaluatedpublic static java.sql.Connection connectToDB(java.lang.String configFile)
public java.lang.String getToolTipText()
public javax.swing.ImageIcon getIcon()
public java.lang.String getButtonName()
public PositionList runPlugin(DataSet input)
Convenience method to run plugin with one return object.
public java.lang.String connConfigFile()
DB connection config file
public GenomeAnnosDBQueryToPositionListPlugin connConfigFile(java.lang.String value)
Set DB config file. DB connection config file
value - DB config filepublic java.lang.String queryFile()
Query file
public GenomeAnnosDBQueryToPositionListPlugin queryFile(java.lang.String value)
Set Query file. Query file
value - Query file