[Bio] / Clearinghouse / clearinghouseapi.htm Repository:
ViewVC logotype

View of /Clearinghouse/clearinghouseapi.htm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Apr 21 15:38:38 2005 UTC (14 years, 6 months ago) by disz
Branch: MAIN
CVS Tags: myrast_33, HEAD
added date to browser

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta name=Title
content="Gid = deposit_genome(who, name, pkg, taxon, checksum, license)">
<meta name=Keywords content="">
<meta http-equiv=Content-Type content="text/html; charset=macintosh">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="clearinghouseapi_files/filelist.xml">
<title>Gid = deposit_genome(who, name, pkg, taxon, checksum, license)</title>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>Terry Disz</o:Author>
  <o:Template>Normal</o:Template>
  <o:LastAuthor>Terry Disz</o:LastAuthor>
  <o:Revision>2</o:Revision>
  <o:LastPrinted>2005-04-20T16:47:00Z</o:LastPrinted>
  <o:Created>2005-04-20T19:52:00Z</o:Created>
  <o:LastSaved>2005-04-20T19:52:00Z</o:LastSaved>
  <o:Pages>2</o:Pages>
  <o:Words>1013</o:Words>
  <o:Characters>5776</o:Characters>
  <o:Company>Argonne National Laboratory</o:Company>
  <o:Lines>48</o:Lines>
  <o:Paragraphs>11</o:Paragraphs>
  <o:CharactersWithSpaces>7093</o:CharactersWithSpaces>
  <o:Version>11.257</o:Version>
 </o:DocumentProperties>
 <o:OfficeDocumentSettings>
  <o:PixelsPerInch>96</o:PixelsPerInch>
  <o:TargetScreenSize>800x600</o:TargetScreenSize>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:Compatibility>
   <w:UseFELayout/>
  </w:Compatibility>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
@font-face
	{font-family:"Times New Roman";
	panose-1:0 2 2 6 3 5 4 5 2 3;
	mso-font-charset:0;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:50331648 0 0 0 1 0;}
@font-face
	{font-family:Arial;
	panose-1:0 2 11 6 4 2 2 2 2 2;
	mso-font-charset:0;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:50331648 0 0 0 1 0;}
@font-face
	{font-family:Batang;
	mso-font-alt:\BC14\D0D5;
	mso-font-charset:129;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1342176593 1775729915 48 0 524447 0;}
 /* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";}
h1
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:1;
	font-size:16.0pt;
	font-family:Arial;
	mso-font-kerning:16.0pt;}
h2
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:2;
	font-size:14.0pt;
	font-family:Arial;
	font-style:italic;}
h3
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:3;
	font-size:13.0pt;
	font-family:Arial;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
table.MsoNormalTable
	{mso-style-parent:"";
	font-size:10.0pt;
	font-family:"Times New Roman";}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
</head>

<body bgcolor=white lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>

<div class=Section1>

<h1 align=center style='text-align:center'><span style='font-size:18.0pt'>The
SEED Data Clearinghouse<o:p></o:p></span></h1>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>Objects stored in the clearinghouse are:<o:p></o:p></p>

<p class=MsoNormal>Genomes<o:p></o:p></p>

<p class=MsoNormal>Annotations<o:p></o:p></p>

<p class=MsoNormal>Subsystems<o:p></o:p></p>

<p class=MsoNormal>Similarities<o:p></o:p></p>

<p class=MsoNormal>Feature Updates<o:p></o:p></p>

<h1><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></h1>

<h1>TABLES</h1>

<h2>Clearing_house table</h2>

<p class=MsoNormal><span style='color:red'>CREATE table clearing_house (id
serial, accession_id int, type text, meta_data text, description text)<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:red'><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></span></p>

<p class=MsoNormal>Note: Type is one of GENOME, ANNOTATIONS, SUBSYSTEM, SIMS,
Feature Updates</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>Note: meta-data form is keyword<span style="mso-spacerun:
yes">&nbsp; </span>tab value pairs, newline separated. </p>

<p class=MsoNormal>Examples:</p>

<p class=MsoNormal>Name<span style='mso-tab-count:1'>&nbsp;&nbsp; </span>Valine
Synthesis</p>

<p class=MsoNormal>Version<span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>1</p>

<p class=MsoNormal>Curator<span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Master:Ross</p>

<p class=MsoNormal>Start_date <span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style="mso-spacerun: yes">&nbsp;</span>2/1/2005</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Meta Data Table</h2>

<p class=MsoNormal>Clearing house object id int, tag text, value text</p>

<p class=MsoNormal><span style='color:red'>CREATE table meta_data (ch_id int,
tag text, value text)<o:p></o:p></span></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Accession Table</h2>

<p class=MsoNormal>Accid(int), personid(int), when(date_time), comments(text),
source(guid)</p>

<p class=MsoNormal><span style='color:red'>Create table accession (id serial,
person_id int, accession_date date, comments text, source_id int);<o:p></o:p></span></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Genome_id table</h2>

<p class=MsoNormal><span style='color:red'>CREATE table genome_id (id serial,
taxon text, checksum text)<o:p></o:p></span></p>

<p class=MsoNormal>This is used to create unique Genome idŐs and is only used
in the register-genome call</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Package_location table</h2>

<p class=MsoNormal><span style='color:red'>CREATE table package_location (id
serial, ch_id int, pathname text)<o:p></o:p></span></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h1>Service APIŐs<span style="mso-spacerun: yes">&nbsp; </span>in
clearinghouse_services</h1>

<h2>Startup()</h2>

<p class=MsoNormal><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Drops
and recreates all the tables.<o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Register_genome(taxon_id, checksum)<o:p></o:p></h2>

<p class=MsoNormal><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Makes
an entry in the genome_id table and returns a unique id for the genome<o:p></o:p></p>

<h2>Get_download_url()<o:p></o:p></h2>

<p class=MsoNormal><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Returns
a url used to download a package<o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Get_upload_url()<o:p></o:p></h2>

<p class=MsoNormal><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Returns
a url and an ID to be used in uploading a file.<o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Finish_upload(id_list, type, who, meta_data, description, source)<o:p></o:p></h2>

<p class=MsoNormal><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Called
after a successful upload of a package to make the entry in the DB<o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>What_is_there(column name)<o:p></o:p></h2>

<p class=MsoNormal><span style='mso-tab-count:1'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Returns<span
style="mso-spacerun: yes">&nbsp; </span>an array of value arrays sorted by <i>column_name</i><span
style='font-style:normal'>.<o:p></o:p></span></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Take_this_file(type, who, meta_data, description, source, file_path)<o:p></o:p></h2>

<p class=MsoNormal style='margin-left:.5in'>Called when there is a locally
available file to be inserted into the database. Typically this happens when
the web server providing the upload interface is collocated with the
clearinghouse code and db.<o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Take_this_package(type, who, meta_data, description, source, url)<o:p></o:p></h2>

<p class=MsoNormal style='margin-left:.5in'>Called by a client that can provide
access to a url so the clearinghouse server can pull the file from the client.<o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h1>Examples</h1>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Test_take_this_deposit_from_me<o:p></o:p></h2>

<p class=MsoNormal>#!/usr/bin/env perl</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>use SOAP::Lite;</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>my $proxy = SOAP::Lite-&gt;
uri('http://www.soaplite.com/Scripts')<span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>-&gt; proxy('http://localhost/CH/clearinghouse_services.cgi');</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>if (@ARGV != 6) {</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>die &quot;Usage deposit
type, who, meta_data, description, source, pkg_url\n&quot;;</p>

<p class=MsoNormal>}</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>my $meta_data = `cat $ARGV[2]`;</p>

<p class=MsoNormal>$response = $proxy-&gt;take_this_pkg($ARGV[0], $ARGV[1],
$meta_data, $ARGV[3], $ARGV[4], $ARGV[5]);</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>if ($response-&gt;fault)</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>print &quot;Failed to
deposit: &quot;, $response-&gt;faultcode, &quot; &quot;,
$response-&gt;faultstring, &quot;\n&quot;;</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h3>run_take_this</h3>

<p class=MsoNormal>perl test_take_this_deposit_from_me.pl SIMS Terry meta_data
&quot;A description&quot; chapman <a href="http://localhost/testfile">http://localhost/testfile</a><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>test_let_me_give_you_this (3 part upload: 1. Get url, 2 upload, 3. Finish)<o:p></o:p></h2>

<p class=MsoNormal>#!/usr/bin/env perl</p>

<p class=MsoNormal>use SOAP::Lite;</p>

<p class=MsoNormal>use LWP::UserAgent;</p>

<p class=MsoNormal>use HTTP::Request::Common;</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>if (@ARGV &lt; 6) {</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>die &quot;Usage
let_me_give_you_this type, who, meta_data, description, source,
path(s)...\n&quot;;</p>

<p class=MsoNormal>}</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $type = shift;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $who = shift;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $meta_data = shift;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $description = shift;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $source = shift;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my @path = @ARGV;</p>

<p class=MsoNormal>my $data = `cat $meta_data`;</p>

<p class=MsoNormal>my $proxy = SOAP::Lite-&gt;
uri('http://www.soaplite.com/Scripts')<span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>-&gt; proxy('http://localhost/CH/clearinghouse_services.cgi');</p>

<p class=MsoNormal>#</p>

<p class=MsoNormal>#step 1 - get url to upload to</p>

<p class=MsoNormal>#</p>

<p class=MsoNormal>my @id_list;</p>

<p class=MsoNormal>for my $path (@path) {</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$response =
$proxy-&gt;get_upload_url();</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if ($response-&gt;fault)</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>{</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>die &quot;Failed to deposit: &quot;, $response-&gt;faultcode, &quot;
&quot;, $response-&gt;faultstring, &quot;\n&quot;;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>}</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my ($url, $id) =
@{$response-&gt;result};</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>print $url, $id,
&quot;\n&quot;;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>push @id_list, $id;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#step 2 - upload the
file (The url is pkg_upload.cgi)</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span># get the file size</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $size = -s $path;</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>$HTTP::Request::Common::DYNAMIC_FILE_UPLOAD = 1;</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>#print &quot;Uploading
file $path to $url...\n&quot;;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $req = POST($url,</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>Content_Type =&gt; 'form-data',</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>Content =&gt; [file_id =&gt; $id,</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>file_size=&gt; $size,</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>file =&gt; [$path]]);</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>#</p>

<p class=MsoNormal>#</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $ua = new
LWP::UserAgent;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $resp =
$ua-&gt;request($req);</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>if
(!$resp-&gt;is_success) {</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>die &quot;Failed to upload $path&quot;;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</p>

<p class=MsoNormal>}</p>

<p class=MsoNormal>#step 3 - finish up, this makes the entry in the DB</p>

<p class=MsoNormal># now finish the deposit</p>

<p class=MsoNormal>$response = $proxy-&gt;finish_upload(\@id_list, $type, $who,
$data, $description, $source);</p>

<p class=MsoNormal>#check this response sometime</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h3>run_let_me_give_you_this</h3>

<p class=MsoNormal>test_let_me_give_you_this GENOME Terry2 meta_data<span
style="mso-spacerun: yes">&nbsp; </span>&quot;A giving description&quot;
localhost-chapman test_let_me_give_you_this.pl<span style="mso-spacerun:
yes">&nbsp; </span>run_let_me_give_you_this<o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<h2>Using the what_is_there API &#8211; a browser for the CH<o:p></o:p></h2>

<p class=MsoNormal>#!/usr/bin/perl</p>

<p class=MsoNormal>use CGI qw/:standard :html3/;</p>

<p class=MsoNormal>use SOAP::Lite;my $proxy = SOAP::Lite-&gt;
uri('http://www.soaplite.com/Scripts')<span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>-&gt;
proxy('http://localhost/CH/clearinghouse_services.cgi');</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>my $action = param('action');</p>

<p class=MsoNormal>if ($action =~/(\w+)/) {</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$column = $1;</p>

<p class=MsoNormal>} else{</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>$column =
&quot;ID&quot;;</p>

<p class=MsoNormal>}</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>#get the download url</p>

<p class=MsoNormal>$response = $proxy-&gt;get_download_url();</p>

<p class=MsoNormal>if ($response-&gt;fault)</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>die &quot;Failed to get
download url: &quot;, $response-&gt;faultcode, &quot; &quot;,
$response-&gt;faultstring, &quot;\n&quot;;</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}</p>

<p class=MsoNormal>my $url = $response-&gt;result;</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span></p>

<p class=MsoNormal>#get the clearinghouse contents sorted by column</p>

<p class=MsoNormal>$response = $proxy-&gt;what_is_there($column);<span
style="mso-spacerun: yes">&nbsp; </span></p>

<p class=MsoNormal>if ($response-&gt;fault)</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>die &quot;Failed to
retrieve data: &quot;, $response-&gt;faultcode, &quot; &quot;,
$response-&gt;faultstring, &quot;\n&quot;;</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>#build the html table</p>

<p class=MsoNormal>my @table;</p>

<p class=MsoNormal>for my $row (@{$response-&gt;result}) {</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my ($id, $type,
$meta_data, $desc, $who, $source, $file_list) = @$row;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my @download_list;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $file_num = 1;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>for my $file_id
(@$file_list)</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>push(@download_list, a({href =&gt; $url . &quot;?ID=$file_id&quot;},
&quot;Download file $file_num&quot;));</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>$file_num++;</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>my $download_list =
join(&quot; &quot;, @download_list);</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>push @table,
th($id).td([$type, $meta_data, $desc, $who, $source, $download_list]);</p>

<p class=MsoNormal>}</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal>#now print it all</p>

<p class=MsoNormal>print header,</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;
</span>start_html('Clearing House'),</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;
</span>h1('Clearing House Browser');</p>

<p class=MsoNormal>print start_form;</p>

<p class=MsoNormal>print table({-border=&gt;''},</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>caption(strong('The entire clearing house (Click column heading to
sort)')),</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>Tr({-align=&gt;CENTER,-valign=&gt;TOP},</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>[</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>#th(['ID','Type','MetaData','Description','Who', 'Source',
'Download']),<span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>th([submit(-name=&gt;'action',
-value=&gt;&quot;ID&quot;),submit(-name=&gt;'action', -value=&gt;&quot;Type&quot;),'MetaData','Description',submit(-name=&gt;'action',-value=&gt;'Who'),submit(-name=&gt;'action',-value=&gt;&quot;Source&quot;),
'Download']),</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>@table</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>]</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span>)</p>

<p class=MsoNormal><span style="mso-spacerun:
yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>),</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;
</span>end_form,</p>

<p class=MsoNormal><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;
</span>end_html;</p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>

</div>

</body>

</html>

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3