Download IDK manual - Integrated Proteomics Pipeline

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
 IP2 Development Kit (IDK) Manual Version 1.06 1 TableofContents
1. Requirements.................................................................................................................................3 2. IDKInstallation..............................................................................................................................4 2.1 2.1 Developers who use existing IP2 data .............................................................................................. 4 Developers who don’t have IP2 license, but want to add plug‐ins ................................................... 4 3. ConfigureIP2inNetBeansIDE.................................................................................................6 4. IDKDirectorystructure............................................................................................................16 5. CreateHelloWorldApplication.............................................................................................17 Create the Model Class MyHello.java ......................................................................................................... 17 6. DatabaseConnection.................................................................................................................22 7. DevelopmentAPIs.......................................................................................................................25 2 1. Requirements
1. Linux OS (Currently Windows OS is not supported. However, windows users can use VirtualBox to run Linux https://www.virtualbox.org) 2. Latest java JDK (http://www.oracle.com/technetwork/java/javase/downloads) 3. Apache tomcat (http://tomcat.apache.org) 4. MySQL database (http://www.mysql.com) 5. Apache Ant (http://ant.apache.org/) 6. Netbeans IDE (https://netbeans.org/). Optional, but recommended 3 2. IDKInstallation
Currently we support IDK only for developers who already licensed the IP2. We will support users who don't have license later. 2.1
DeveloperswhowanttouseexistingIP2data
Warning: In this approach, users do not need to upload data or update mysql tables for testing. Often, developers want to test tools on existing data. But developers should be cautious for deleting or modifying data in production or database tables. Alternatively, users can dump current database to new database, and change ip2 database configuration. The configuration file is $HOME/ip2_tomcat/webapps/ip2/resources/ jdbc.properties 1. Create your account in Github if not.(https://github.com/) 2. Connect to IP2 admin team to get access rights of the code repository. Shortly you can email to [email protected] for access rights. 3. After getting the access rights you can see the IP2Global/IP2 repository in your dashboard. Go to the IP2 github repo and fork the repository. 4. Clone the git repo using command (git clone <SSH CLONE URL>) – SSH CLONE URL : you can find that from right bottom of your github page. e.g (git clone [email protected]:IP2Global/ip2.git) For easiest way go to tomcat base directory and do cloning otherwise you need to copy the contents in webapps directory (git clone [email protected]:IP2Global/ip2.git webapps) just make sure that webapps directory should be deleted before executing the command. 5. Modify $HOME/ip2_tomcat/webapps/ip2/resources/jdbc.properties same as the one in IP2 production server 6. Copy/modify $HOME/ip2_tomcat/webapps/ip2/config/ip2_config.txt based on same file in the IP2 production server 7. Open $HOME/ip2_tomcat/webapps/ip2/config/ip2_config.txt file. Check the line ‘ip2_home /ip2_data/path’ This means all IP2 data are stored in /ip2_data/path folder. Either mount this folder to the new development server, or copy the data to the development server, keeping same path. 8. To make same ip2 environment, you need to copy .bash_profile and .bashrc file from IP2 production server to IP2 development server by running following command. Command: scp .bash_profile .bashrc user_id@development_server_domain:. 9. Open the terminal window and go to directory ip2/ip2/WEB‐INF and execute command (ant clean) followed by (ant compile) 10. Go to tomcat bin directory and start tomcat using (./catalina.sh run) 11. Open the browser and (localhost:8080/ip2) Note: To allow new IP2 server to access existing data from existing IP2 server, you either need to copy the IP2 data from existing server or mount the disk to new IP2 server. The location of the data is defined in $HOME/ip2_tomcat/webapps/ip2/config/ ip2_config.txt (see data_home variable in the file) 4 2.1
Developerswhowanttobuildnewdatabase
1. Create your account in Github if not.(https://github.com/) 2. Go to the IP2 github repo and fork the repository. 3. Clone the git repo using command (git clone <SSH CLONE URL>) – SSH CLONE URL : you can find that from right bottom of your github page. 4. Create ip2 database in mysql using (CREATE DATABASE ip2;) 5. Execute ip2_mysql.sql in your mysql using (mysql –u<USERNAME> ‐p<PASSWORD> ip2 < ip2_mysql.sql). 6. Copy cloned ip2 contents in your tomcat webapps directory. 7. Open ip2/ip2/config/ip2_config.txt and modify the entries basd on your local setting. 8. Open ip2/ip2/resources/jdbc.properties and modify dabase setting based on your local settings. 9. Open the terminal window and go to directory ip2/ip2/WEB‐INF and execute command (ant clean) followed by (ant compile) 10. Go to tomcat bin directory and start tomcat using (./catalina.sh run) 11. Open the browser and (localhost:8080/ip2) 5 3. ConfigureIP2inNetBeansIDE
1. Open the NetBeans IDE and go to File ‐> Open Project 6 2. Go to the directory in which you cloned IP2 from git. 7 3. Click on Open project and you can see the IP2 project in your IDE. 8 4. Compile the project from NetBeans , Right click on the build.xml located at WEB‐INF folder and then click Run Target – compile. 9 5. Configuring Tomcat Server in NetBeans. Open Tools menu and select Servers 10 6. Click Add Server. 11 7. Select Apache Tomcat and click on Next. 12 8. Browse for your tomcat location and click on finish. 13 9. After that right click your project and click “Run”. 14 10. 15 4. IDKDirectorystructure
ip2 is a web application base folder. 1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
images: pictures and icons js: javascripts software: 3rd party software, standalone programs, and scripts styles: css files lib: java libraries pages: jsp pages src: java classes config: ip2 configuration resources: web configuration files (struts.xml, jdbc, property files) WEB‐INF: web configuration files (web.xml, decorators.xml, build.xml, etc.) 16 5. CreateHelloWorldApplication
CreatetheModelClassMyHello.java
IP2 has default model package folder at WEB‐INF/src/com/ipa/ip2/model. To create new package, create subfolder under the model folder. For this example, create ip2/WEB‐
INF/src/com/ipa/ip2/model/myhello. Then, create MyHello.java model class. Be sure to note the package statement below. NOTE : IP2_WEB‐INF = <ip2_tomcat>/webapps/ip2/WEB-INF
 Create HelloWorldModel.java in (IP2_WEB‐INF/com/ipa/ip2/model/dto) com.ipa.ip2.model.dto package (Note: If your model is mapped to the database table then create model in com.ipa.ip2.model package, we will discuss in database example later. Currently we only have POJO so we continue to put in com.ipa.ip2.model.dto package)  Create HelloWorldAction.java in (IP2_ WEB‐INF /com/ipa/ip2/webapp/action) com.ipa.ip2.weapps.action package, which responsible to fetch or generate data and pass to the view.  Create helloWorld.jsp in (IP2_ WEB‐INF /pages) directory. It’s responsible to get the username from the user and pass that to the Action class.  Create helloWorldList.jsp in (IP2_ WEB‐INF /pages) directory. It’s responsible to render the username got from the helloWorld.jsp and render generated list in datatable.  Register the navigation routing in existing struts.xml located at (<ip2_tomcat>/webapps/ip2/resources/struts.xml) 17 HelloWorldAction.java Action default package is com.ipa.ip2.webapp.action. For new plug‐in, please create sub package name. e.g. com.ipa.ip2.webapp.action.myhello. Put the action file to $HOME/ip2_tomcat/webapps/ip2/WEB‐
INF/src/com/ipa/ip2/webapp/action/myhello folder package com.ipa.ip2.webapp.action.myhello; import com.ipa.ip2.model.dto.HelloWorldModel; import java.util.ArrayList; import java.util.List; public class HelloWorldAction extends BaseAction{ String name; List<HelloWorldModel> helloWorldModels; /** * Create dummy helloWorldModels and put into local "helloWorldModels" variable for retrieval in the UI. * @return "success" if no exceptions thrown */ public String list() { helloWorldModels = new ArrayList<HelloWorldModel>(); helloWorldModels.add(new HelloWorldModel("Mike",31)); helloWorldModels.add(new HelloWorldModel("Bibo",35)); helloWorldModels.add(new HelloWorldModel("Chris",35)); helloWorldModels.add(new HelloWorldModel("Denial",35)); return SUCCESS; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<HelloWorldModel> getHelloWorldModels() { return helloWorldModels; } public void setHelloWorldModels(List<HelloWorldModel> helloWorldModels) { this.helloWorldModels = helloWorldModels; } } 18 HelloWorldModel.java package com.ipa.ip2.model.dto; import java.io.Serializable; /** * This class is used to show the sample model structure. * @author Amit */ public class HelloWorldModel implements Serializable { private static final long serialVersionUID = 3832626162173359411L; private Long id; private String name; private int age; /** * Default constructor ‐ creates a new instance with no values set. */ public HelloWorldModel() {} public HelloWorldModel(String name, int age) { this.name = name; this.age = age; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } 19 helloWorld.jsp Put new java class in myhello folder at $HOME/ip2_tomcat/webapps/ip2/WEB‐INF/pages <%@ include file="/common/taglibs.jsp"%> <head> <title>Hello World Title</title> <meta name="heading" content="Hello World Test"/> </head> <s:form name="helloWorldForm" action="helloWorldDetails" method="post"> <table width="200" border="0" cellspacing="0" cellpadding="1"> <tr> <td class="sfont" nowrap>Your name</td> <td> <input type="text" name="name" id="name" value="${name}"> </td> </tr> <tr> <td colspan="2">&nbsp;</td> </tr> <tr> <td>&nbsp;</td> <td> <input class="sgrayfont" type="submit" value="&nbsp;&nbsp;Submit"/> <input class="sgrayfont" type="button" value="Cancel" onclick="history.back()"/> </td> </tr> </table> </s:form> helloWorldList.jsp <%@ include file="/common/taglibs.jsp"%> <head> <title>Hello World Title</title> <meta name="heading" content="Hello World List"/> </head> Your name is ${name} </br> </br> <display:table name="helloWorldModels" id="helloWorldModels" uid="helloWorldModel" cellspacing="0" cellpadding="0" defaultorder="descending" defaultsort="0" class="table" export="true" > <display:column sortable="true" title="Name"> <c:out value="${helloWorldModel.name}" /> </display:column> <display:column sortable="true" title="Age"> <c:out value="${helloWorldModel.age}" /> 20 </display:column> </display:table> Struts.xml <action name="helloWorldDetails" class="com.ipa.ip2.webapp.action.myhello.HelloWorldAction" method="list"> <result name="success">/WEB‐INF/pages/myhello/helloWorldList.jsp</result> <result name="error">/WEB‐INF/pages/myhello/helloWorld.html</result> </action> Looks like on web…. 21 6. DatabaseConnection
HelloWorldModel.java package com.ipa.ip2.model; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import javax.persistence.*; import java.io.Serializable; /** * This class is used to show the sample model structure. * @author Amit */ @Entity @Table(name="hello_world") public class HelloWorldModel extends BaseObject implements Serializable { private static final long serialVersionUID = 3832626162173359411L; private Long id; private String name; private int age; /** * Default constructor ‐ creates a new instance with no values set. */ public HelloWorldModel() {} public HelloWorldModel(String name, int age) { this.name = name; this.age = age; } @Id @GeneratedValue(strategy=GenerationType.AUTO) public Long getId() { return id; } public void setId(Long id) { this.id = id; } @Column(nullable=false) public String getName() { return name; } 22 public void setName(String name) { this.name = name; } @Column(nullable=false) public int getAge() { return age; } public void setAge(int age) { this.age = age; } /** * {@inheritDoc} */ public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof HelloWorldModel)) { return false; } final HelloWorldModel testModel = (HelloWorldModel) o; return !(name != null ? !name.equals(testModel.getName()) : testModel.getName() != null); } /** * {@inheritDoc} */ public int hashCode() { return (name != null ? name.hashCode() : 0); } /** * {@inheritDoc} */ public String toString() { ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE) .append("name", this.name) .append("age", this.age); return sb.toString(); } } 23 HelloWorldAction.java //Modify the HelloWorldModel import with import com.ipa.ip2.model.HelloWorldModel; //Just modify the list method to retrieve the data from the database. /** * Create dummy helloWorldModels and put into local "helloWorldModels" variable for retrieval in the UI. * @return "success" if no exceptions thrown */ public String list() { org.hibernate.Session hibSession = null; try { hibSession = this.getHibSession(); helloWorldModels = hibSession.createCriteria(HelloWorldModel.class).list(); } catch (Exception e) { e.printStackTrace(); } finally { if(null != hibSession) hibSession.close(); } return SUCCESS; } NOTE: There is no need to use transaction while retrieving the data ,but when you do insertion or deletion then use transaction. 24 7. DevelopmentAPIs
IP2 APIs for developers are available at http://www.proteomicswiki.com/ip2_doc However, developers can generate the APIs in WEB‐INF folder: Command: ant javadoc 25