Team:UESTC-Software/API.html

From 2014.igem.org

(Difference between revisions)
 
Line 33: Line 33:
<div class="parts" style="padding: 20px 50px 20px 100px;">
<div class="parts" style="padding: 20px 50px 20px 100px;">
<div class="question" id="p2">Service API Documentation</div>
<div class="question" id="p2">Service API Documentation</div>
-
<h2>1Main functions</h2>
+
<h2>1 Main functions</h2>
-
<h3>1.1Submit a Crisper-X</h3><p>requestURL: getMain.php</p>
+
<h3>1.1 Submit a Crisper-X request</h3><p>URL: getMain.php</p>
-
<h3>1.2Get result</h3><p>Get the result given the request id.</p>
+
<h3>1.2 Get result</h3><p>Get the result given the request id.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
color: #999;max-width:400px;position: relative;margin: 20px auto;"><tbody>
color: #999;max-width:400px;position: relative;margin: 20px auto;"><tbody>
Line 43: Line 43:
<tr><td class="ti">Example</td><td>POST: id=355Return: {“status”:2,“message”:“not finished yet”}</td></tr>
<tr><td class="ti">Example</td><td>POST: id=355Return: {“status”:2,“message”:“not finished yet”}</td></tr>
</tbody></table>
</tbody></table>
-
<h3>1.3Get requests History</h3>
+
<h3>1.3 Get requests History</h3>
<p>Get requests history. Unregistered users will get the global history.</p>
<p>Get requests history. Unregistered users will get the global history.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 50: Line 50:
<tr><td class="ti">POST</td><td>token</td></tr>
<tr><td class="ti">POST</td><td>token</td></tr>
<tr><td class="ti">Return</td><td>Top ten records, ordered by time, in Json array style</td></tr>
<tr><td class="ti">Return</td><td>Top ten records, ordered by time, in Json array style</td></tr>
-
<tr><td class="ti">Example</td><td>POST: token=005536bf21179e54370c75b6fb136f2aReturn: [{“request id”:“351”,“status”:“0”},{“request id”:“355”,“status”:“2”}]</td></tr>
+
<tr><td class="ti">Example</td><td>POST: token=005536bf21179e54370c75b6fb136f2a<br/>Return: [{“request id”:“351”,“status”:“0”},{“request id”:“355”,“status”:“2”}]</td></tr>
<tr><td>See also</td><td>Login [ section 2.1 ]</td></tr>
<tr><td>See also</td><td>Login [ section 2.1 ]</td></tr>
</tbody></table>
</tbody></table>
-
<h2>2User Management</h2>
+
<h2>2 User Management</h2>
-
<h3>2.1Login</h3>
+
<h3>2.1 Login</h3>
-
<p>Login(Sign in) using Username and Password. A token will be returned forfuture authentication.</p>
+
<p>Login(Sign in) using Username and Password. A token will be returned for future authentication.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
color: #999;max-width:400px;position: relative;margin: 20px auto;"><tbody>
color: #999;max-width:400px;position: relative;margin: 20px auto;"><tbody>
Line 61: Line 61:
<tr><td class="ti">POST</td><td>name(username), pswd(password)</td></tr>
<tr><td class="ti">POST</td><td>name(username), pswd(password)</td></tr>
<tr><td class="ti">Return</td><td>32 byte token when login succeed, or ’-’ otherwise.</td></tr>
<tr><td class="ti">Return</td><td>32 byte token when login succeed, or ’-’ otherwise.</td></tr>
-
<tr><td class="ti">Example</td><td>POST: name=guest&pswd=1234Return: 005536bf21179e54370c75b6fb136f2a</td></tr>
+
<tr><td class="ti">Example</td><td>POST: name=guest&pswd=1234<br/>Return: 005536bf21179e54370c75b6fb136f2a</td></tr>
</tbody></table>
</tbody></table>
-
<h3>2.2Log out</h3>
+
<h3>2.2 Log out</h3>
<p>Delete user log information and Log out.</p>
<p>Delete user log information and Log out.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 72: Line 72:
<tr><td class="ti">See also</td><td>Login [ section 2.1 ]</td></tr>
<tr><td class="ti">See also</td><td>Login [ section 2.1 ]</td></tr>
</tbody></table>
</tbody></table>
-
<h3>2.3Sign Up</h3>
+
<h3>2.3 Sign Up</h3>
<p>Create a new account with username, password and email.</p>
<p>Create a new account with username, password and email.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 80: Line 80:
<tr><td class="ti">Return</td><td>”Sign In Succeed” or error information.</td></tr>
<tr><td class="ti">Return</td><td>”Sign In Succeed” or error information.</td></tr>
</tbody></table>
</tbody></table>
-
<h3>2.4Update user’s Information</h3>
+
<h3>2.4 Update user’s Information</h3>
<p>Update your password and/or email address.</p>
<p>Update your password and/or email address.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 88: Line 88:
<tr><td class="ti">Return</td><td>’+’: ok, ’-’: failed.</td></tr>
<tr><td class="ti">Return</td><td>’+’: ok, ’-’: failed.</td></tr>
</tbody></table>
</tbody></table>
-
<h2>3File/Specie Upload</h2>
+
<h2>3 File/Specie Upload</h2>
-
<h3>3.1Check upload</h3>
+
<h3>3.1 Check upload</h3>
<p>Check if this token can upload files</p>
<p>Check if this token can upload files</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 98: Line 98:
<tr><td class="ti">Example</td><td>{”status”:1, ”message”:”Authentication failed”}</td></tr>
<tr><td class="ti">Example</td><td>{”status”:1, ”message”:”Authentication failed”}</td></tr>
</tbody></table>
</tbody></table>
-
<h3>3.2Upload file</h3>
+
<h3>3.2 Upload file</h3>
<p>Upload your file.</p>
<p>Upload your file.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 106: Line 106:
<tr><td class="ti">Return</td><td>A(Upload succeed) or N(Something goes wrong)</td></tr>
<tr><td class="ti">Return</td><td>A(Upload succeed) or N(Something goes wrong)</td></tr>
</tbody></table>
</tbody></table>
-
<h3>3.3Import</h3>
+
<h3>3.3 Import</h3>
<p>Import data from file(s).</p>
<p>Import data from file(s).</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 114: Line 114:
<tr><td class="ti">Return</td><td>New specie Name(start with number), or ’N’ for ’Something goes wrong’</td></tr>
<tr><td class="ti">Return</td><td>New specie Name(start with number), or ’N’ for ’Something goes wrong’</td></tr>
</tbody></table>
</tbody></table>
-
<h3>3.4Viewmyfiles</h3>
+
<h3>3.4 Viewmyfiles</h3>
<p>View all my files.</p>
<p>View all my files.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 123: Line 123:
<tr><td class="ti">Example</td><td>[{”fileName”:”NC 001133-chromosome1”,”note”:”Saccharomycetes’s chromosome”}]</td></tr>
<tr><td class="ti">Example</td><td>[{”fileName”:”NC 001133-chromosome1”,”note”:”Saccharomycetes’s chromosome”}]</td></tr>
</tbody></table>
</tbody></table>
-
<h3>3.5Viewmyspecies</h3>
+
<h3>3.5 Viewmyspecies</h3>
<p>View all my species.</p>
<p>View all my species.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 132: Line 132:
<tr><td class="ti">Example</td><td>[ {”specie”:”Saccharomyces-cerevisiae”, ”PAMs”:[{”PAM”:”NGG”},{”PAM”:”NRG”}], ”chromosomes”:[{”chromosome”:”NC 001147-chromosome1”}, {”chromosome”:”NC 001147-chromosome16”} ]</td></tr>
<tr><td class="ti">Example</td><td>[ {”specie”:”Saccharomyces-cerevisiae”, ”PAMs”:[{”PAM”:”NGG”},{”PAM”:”NRG”}], ”chromosomes”:[{”chromosome”:”NC 001147-chromosome1”}, {”chromosome”:”NC 001147-chromosome16”} ]</td></tr>
</tbody></table>
</tbody></table>
-
<h3>3.6Deletemyfiles</h3>
+
<h3>3.6 Deletemyfiles</h3>
<p>Delete your file.</p>
<p>Delete your file.</p>
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
<table border="1px" cellspacing="0px" style="border-collapse:collapse;word-break:break-word;border-color: #c7d3af;
Line 140: Line 140:
<tr><td class="ti">Return</td><td>A(Delete succeed) or N(Something goes wrong)</td></tr>
<tr><td class="ti">Return</td><td>A(Delete succeed) or N(Something goes wrong)</td></tr>
</tbody></table>
</tbody></table>
-
<h3>3.7json.command.txt</h3>
+
<h3>3.7 json.command.txt</h3>
<p>How to write commands in Import(section 3.3) method.</p>
<p>How to write commands in Import(section 3.3) method.</p>
<p>The structure of a command:</p>
<p>The structure of a command:</p>
Line 153: Line 153:
<p>Example:</p>
<p>Example:</p>
<p style="font-size: xx-small;text-indent: 4em;">{”specie”:”testSpecie”,”files”:[{”fileName”:”NC 012971”}],”PAM”:”NGG”}</p>
<p style="font-size: xx-small;text-indent: 4em;">{”specie”:”testSpecie”,”files”:[{”fileName”:”NC 012971”}],”PAM”:”NGG”}</p>
-
<h2>4josn.txt</h2>
+
<h2>4 josn.txt</h2>
-
<h3>4.1Input</h3>
+
<h3>4.1 Input</h3>
<pre style="font-size: xx-small;"> type 1 1=Knockout
<pre style="font-size: xx-small;"> type 1 1=Knockout
specie E.coil Specie
specie E.coil Specie
Line 166: Line 166:
rfc ”000000” 1 for use and 0 for not.
rfc ”000000” 1 for use and 0 for not.
RFC: 10, 12, 12a, 21, 23, 25</pre>
RFC: 10, 12, 12a, 21, 23, 25</pre>
-
<h3>4.2Input Example</h3>
+
<h3>4.2 Input Example</h3>
<pre style="font-size: xx-small;"> {
<pre style="font-size: xx-small;"> {
“specie” : “Saccharomyces-cerevisiae”,
“specie” : “Saccharomyces-cerevisiae”,
Line 173: Line 173:
“rfc” : “100101”
“rfc” : “100101”
}</pre>
}</pre>
-
<h3>4.3Output</h3>
+
<h3>4.3 Output</h3>
<pre style="font-size: xx-small;">
<pre style="font-size: xx-small;">
status 0 Request Status. (0: ok, 1: failed, 2: still running)
status 0 Request Status. (0: ok, 1: failed, 2: still running)
Line 206: Line 206:
}
}
</pre>
</pre>
-
<h3>4.4Output example when ok:</h3>
+
<h3>4.4 Output example when ok:</h3>
<pre style="font-size: xx-small;"> {
<pre style="font-size: xx-small;"> {
”status”: 0,
”status”: 0,

Latest revision as of 18:11, 17 October 2014

UESTC-Software

API Documentation

Documentation & Download

Program API Doc

Service API Documentation

1 Main functions

1.1 Submit a Crisper-X request

URL: getMain.php

1.2 Get result

Get the result given the request id.

URLgetResult.php
POSTid
ReturnResult in json style,with status=0, 1, 2 means ok, error and not finished respectively.
ExamplePOST: id=355Return: {“status”:2,“message”:“not finished yet”}

1.3 Get requests History

Get requests history. Unregistered users will get the global history.

URLgetHistory.php
POSTtoken
ReturnTop ten records, ordered by time, in Json array style
ExamplePOST: token=005536bf21179e54370c75b6fb136f2a
Return: [{“request id”:“351”,“status”:“0”},{“request id”:“355”,“status”:“2”}]
See alsoLogin [ section 2.1 ]

2 User Management

2.1 Login

Login(Sign in) using Username and Password. A token will be returned for future authentication.

URLlogin/
POSTname(username), pswd(password)
Return32 byte token when login succeed, or ’-’ otherwise.
ExamplePOST: name=guest&pswd=1234
Return: 005536bf21179e54370c75b6fb136f2a

2.2 Log out

Delete user log information and Log out.

URLlogin/logout.php
POSTtoken
ReturnNothing.
See alsoLogin [ section 2.1 ]

2.3 Sign Up

Create a new account with username, password and email.

URLlogin/signup.php
POSTname(username, unique),pswd(password, encrypt using md5),email(unique).
Return”Sign In Succeed” or error information.

2.4 Update user’s Information

Update your password and/or email address.

URLlogin/signup.php
POSTname(username),pswd(old password),newpswd(new password *),newemail(new email *),* Not necessary
Return’+’: ok, ’-’: failed.

3 File/Specie Upload

3.1 Check upload

Check if this token can upload files

URLupload/check.php
POSTstatus=0(Yes)/1(No) and message if status=1 in JSON.
Return’+’: ok, ’-’: failed.
Example{”status”:1, ”message”:”Authentication failed”}

3.2 Upload file

Upload your file.

URLupload/
POSTtoken, filename(no longer than 255),note(no longer than 1000), file
ReturnA(Upload succeed) or N(Something goes wrong)

3.3 Import

Import data from file(s).

URLupload/import.php
POSTtoken, command(in json, see section3.7)
ReturnNew specie Name(start with number), or ’N’ for ’Something goes wrong’

3.4 Viewmyfiles

View all my files.

URLupload/viewmyfiles.php
POSTtoken
ReturnAll my files in JSON Array Style
Example[{”fileName”:”NC 001133-chromosome1”,”note”:”Saccharomycetes’s chromosome”}]

3.5 Viewmyspecies

View all my species.

URLupload/viewmyspecies.php
POSTtoken
ReturnAll my species in JSON Array Style
Example[ {”specie”:”Saccharomyces-cerevisiae”, ”PAMs”:[{”PAM”:”NGG”},{”PAM”:”NRG”}], ”chromosomes”:[{”chromosome”:”NC 001147-chromosome1”}, {”chromosome”:”NC 001147-chromosome16”} ]

3.6 Deletemyfiles

Delete your file.

URLupload/deletemyfiles.php
POSTtoken, filename
ReturnA(Delete succeed) or N(Something goes wrong)

3.7 json.command.txt

How to write commands in Import(section 3.3) method.

The structure of a command:

		{
		specie 			varchar(96) 		Name of the new Specie.
		files 				array 			All correlative chromosome files(.fna).
		[
			fileName varchar(255) File name
		]
		PAM 			varchar(20)			PAM
		}

Example:

{”specie”:”testSpecie”,”files”:[{”fileName”:”NC 012971”}],”PAM”:”NGG”}

4 josn.txt

4.1 Input

		type 1 1=Knockout
		specie E.coil Specie
		gene thrA Gene Name
		location Chr2:336..2798 Location
		pam NGG PAM Sequence [1]
		r1 0.65 r1, r2=1-r1
		length 20 nt length
		region ”0000” Region filter. 1 for in and 0 for out.
		EXON,INTRON,UTR,INTERGENIC
		rfc ”000000” 1 for use and 0 for not.
		RFC: 10, 12, 12a, 21, 23, 25

4.2 Input Example

		{
		“specie”	:	“Saccharomyces-cerevisiae”,
		“location”	:	“NC 001144-chromosome12:1..500”,
		“pam”		:	“NGG”,
		“rfc”		:	“100101”
		}

4.3 Output

		status 		0 				Request Status. (0: ok, 1: failed, 2: still running)
		message  	no args 			Return message
		specie  		E.coil 			Specie
		gene  		thrA 				Gene name
		location  		Chr2:336..2798 	Location
		region  		array[]			Selected sequence information
		{
		endpoint		1807			Region end point
		description		intergenic		Region information
		}
		result array[] Top 50 Only
		{
		grna TC. . . CGG(20) sgRNA sequence
		position Chr2:15413205 Location
		strand + Which DNA chain (+/-)
		region exon Region of this sgRNA
		total score 86 Sguide
		Sspe 93 Sspe
		Seff 7 Seff
		count 2 Nmm
		offtarget array[] Top 20 Only
		{
		osequence CT. . . TGGG(20) possible-offtarget sgRNA sequence
		oscore 3.5 Smm
		omms 4 Nmm
		oposition Chr3:4158 Location of po-sgRNA
		ostrand + Which DNA chain (+/-)
		oregion Intergenic Region of this sgRNA
		}
		}

4.4 Output example when ok:

		{
		”status”: 0,
		”message”: {
		”specie”: ”E.coli”,
		”kind”: ”E.coli K12-MG1655”,
		”gene”: ””,
		”location”: ”1:336..2798”
		},
		”result”: [{”key”: ”#1”,
		”grna”: ”GAAGTTCGGCGGTACATCAGTGG”,
		”position”: ”1:368”,
		”total score”: 100,
		”count”: 0,
		”offtarget”: []
		}, {
		”key”: ”#2”,
		”grna”: ”TAATGAAAAAGGCGAACTGGTGG”,
		”position”: ”1:935”,
		”total score”: 100,
		”count”: 0,
		”offtarget”: []
		}, {
		”key”: ”#3”,
		”grna”: ”TGGAAAGCAATGCCAGGCAGGGG”,
		”position”: ”1:427”,
		”total score”: 100,
		”count”: 0,
		”offtarget”: []
		}, {
		”key”: ”#4”,
		”grna”: ”CAAAATCACCAACCACCTGGTGG”,
		”position”: ”1:479”,
		”total score”: 100,
		”count”: 0,
		”offtarget”: []
		},{
		”key”: ”#44”,
		”grna”: ”ATTTTTGCCGAACTTTTGACGGG”,
		”position”: ”1:564”,
		”total score”: 91,
		”count”: 2,
		”offtarget”: [{
		”osequence”: ”ATTTTCGCCAAACATTTGGCAGG”,
		”oscore”: 0.954750,
		”omms”: 4,
		”ostrand”: ”-”,
		”oposition”: ”1:1924344”,
		”oregion”: ”exco”
		}, {
		”osequence”: ”ATTGTTGCGCAACTTTTGGCTGG”,
		”oscore”: 0.480417,
		”omms”: 4,
		”ostrand”: ”-”,
		”oposition”: ”1:3827949”,
		”oregion”: ”exco”
		}]
		}]
		}

4.5 Output example when failed:

		{
		“status”: 1,
		“message”: “illegal args”
		}

4.6 Appendix. Equations

R=A,G; M=A,C; W=A,T; S=C,G; K=G,T; Y=C,T; H=A,C,T; V=A,C,G; B=C,G,T; D=A,G,T; N=A, G, C, T

Documentation & Download
Service API Documentation