[Bio] / FigTutorial / test_dna.pl Repository:
ViewVC logotype

View of /FigTutorial/test_dna.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Fri May 1 20:32:38 2009 UTC (10 years, 6 months ago) by disz
Branch: MAIN
CVS Tags: rast_rel_2009_05_18, rast_rel_2014_0912, rast_rel_2010_0928, rast_rel_2009_0925, rast_rel_2010_0827, rast_rel_2014_0729, rast_rel_2009_07_09, myrast_33, rast_rel_2011_0928, rast_rel_2010_0526, rast_rel_2010_1206, rast_rel_2010_0118, rast_rel_2011_0119, HEAD
test scripts for the streaming figfam server

#!/usr/bin/perl -w 
use strict;
use LWP::UserAgent;
use HTTP::Request::Common;
use Getopt::Long;
use File::Basename;
use Data::Dumper;



my $ua = new LWP::UserAgent;
$HTTP::Request::Common::DYNAMIC_FILE_UPLOAD=1;
#my $url = "http://bio-macpro-1.mcs.anl.gov/~disz/FIG/test_server.cgi";
my $url = "http://bio-macpro-1.mcs.anl.gov/~disz/FIG/figfam_server_1.cgi";
my $fname = $ARGV[0];

my @form = (Content => [upfile => [$fname]]);

my $form = ">FQ8D8DZ01A01DU\nttcgtcatttttagacgaagcgcagaacacgactgacgcccaaact\n>FQ8D8DZ01A0006\natcaggctgtgatcgcggaattccggaggaattatgcagaaaaaaccagatgaagccaagttttttcgctgaccacagccaatatggcatttcccaatggaaattcctatcaattggcgtggttaaagttgaaaaacgggcgtgacagagtcaaaagttctcagaaaaacgtcgcataaaaaaagttaccaaccaaggtccccccctaggtgtgtaatcaggggaccttgattggtcctagcttgtttatgcgtaagttttgagactttttgggctctgtcctgacttattgccgtgactatggaacgctgcaataagtccgatctttgagcgaaatatgccattttttattgtaattataccaataattataataaaaaactaagcatattaagccaatgatcgaaggaaacatcaaagacgaataacgcagaaagcgactggcggccaaatctaaaaaagacgtagatttgatgcagaggccaggagtctttcgagtagcaaccgagggccacgaagacgcctgtttgagcgtcgactaggcatcg\n>FQ8D8DZ01A00BO\ngattggttccgcacccacaataaccgaagacaaactaaaaaaactataggaggtctcccgaactaactcttatcaggctgtgatcgcggaattccggaggaattatgcagaaaaaaccagatgaagccaagtttttcgctgaccacagccaatatggcatttcccaatggaaattcctatcaattggcgtggttaaagttgaaaaacgggcgtgacagagtcaaaagttctcagaaaacgtcgcataaaaaagttaccaaccaaggtccccccctaggtgtgtaatcaggggaccttgattggtcctagcttgtttatgcgtaagttttgagacttttgggctctgtcctgacttattgccgtgactatggaacgctgcaataagtccgatctttgagcgaaatatgccatttttttattgtaattataccaataattataataaaaaactaggcatattaagccaatgatcgaaggaaacatcaaagacgaataacgcagaaagcgactggcggccaaatctaaaaaagacgtagatttgatgcagaggccaggatt\n>FQ8D8DZ01A033M\nctacaggaatagaaactttggctttcgccaatcccatttcgacaagtttgtctgcatttgcttcgtcatcaacaaaattaataaattttgcaggatcattatcaaattgatttctaatttgactcggtaatccctcaaacatgctattagcagccgctactgtattcattgcgtcttggtaatcaaatccggtcatatcagcgtattgtttttcgaactggtttagatggtctattagtccagtcttattgtacttacgtactatcttatttatgtctgtctcatctttatgattctgttccgttaaaccatcaccagttgcgattgcaactcttaattttggtccataagccgttctaaaaggaacgccatctactttttctttgttgtccattttttacttcctaagg\n";
#
#
#           The POST method also supports the `multi-
#           part/form-data' content used for Form-based File
#           Upload as specified in RFC 1867.  You trigger this
#           content format by specifying a content type of
#           `'form-data'' as one of the request headers.  If one
#           of the values in the $form_ref is an array reference,
#           then it is treated as a file part specification with
#           the following interpretation:
#
#             [ $file, $filename, Header => Value... ]
#
#           The first value in the array ($file) is the name of a
#           file to open.  This file will be read and its content
#           placed in the request.  The routine will croak if the
#           file can't be opened.  Use an `undef' as $file value
#           if you want to specify the content directly.  The
#           $filename is the filename to report in the request.
#           If this value is undefined, then the basename of the
#           $file will be used.  You can specify an empty string
#           as $filename if you don't want any filename in the
#           request.
my $res = $ua->post( $url."?function=assign_functions_to_DNA", Content_Type => 'multipart/form-data', 
			'Content' => [ 'subject' => 'Demand',
					'upfile' => [$fname],
					# else send in line string
#					'upfile' => [
#						undef,
#						'inline',
#						'Content_Type' => 'application/fasta',
#						'Content' => "$form"
#					]
			]);
if ($res->is_success) {
	print $res->content;
} else {
	print "Error ", $res->content;
};

exit;

#ASSIGN-FUNCTION-TO-PROT is similar to PLACE-IN-FAMILY, except
#       that the returned list contains either
#
#                COULD-NOT-PLACE-IN-FAMILY
#       or
#                ID FUNCTION
#
#       That is, it does not indicate which FIGfam was used to
#       determine the function.  This allows higher-performance
#       alternatives for cases in which multiple FIGfams implement the
#       same function.  The algorithm supported utilizes the underlying
#       FIGfams, but characterizes sets that implement the same
#       function and does not support distinguishing which FIGfam
#       is actually the right subgrouping.
#
@form = (function=>"assign_function_to_DNA",
	id_seq => ">FQ8D8DZ01A01DU, ttcgtcatttttagacgaagcgcagaacacgactgacgcccaaact",

	id_seq=>"FQ8D8DZ01A0006, atcaggctgtgatcgcggaattccggaggaattatgcagaaaaaaccagatgaagccaagttttttcgctgaccacagccaatatggcatttcccaatggaaattcctatcaattggcgtggttaaagttgaaaaacgggcgtgacagagtcaaaagttctcagaaaaacgtcgcataaaaaaagttaccaaccaaggtccccccctaggtgtgtaatcaggggaccttgattggtcctagcttgtttatgcgtaagttttgagactttttgggctctgtcctgacttattgccgtgactatggaacgctgcaataagtccgatctttgagcgaaatatgccattttttattgtaattataccaataattataataaaaaactaagcatattaagccaatgatcgaaggaaacatcaaagacgaataacgcagaaagcgactggcggccaaatctaaaaaagacgtagatttgatgcagaggccaggagtctttcgagtagcaaccgagggccacgaagacgcctgtttgagcgtcgactaggcatcg
",
	id_seq=>"FQ8D8DZ01A00BO, gattggttccgcacccacaataaccgaagacaaactaaaaaaactataggaggtctcccgaactaactcttatcaggctgtgatcgcggaattccggaggaattatgcagaaaaaaccagatgaagccaagtttttcgctgaccacagccaatatggcatttcccaatggaaattcctatcaattggcgtggttaaagttgaaaaacgggcgtgacagagtcaaaagttctcagaaaacgtcgcataaaaaagttaccaaccaaggtccccccctaggtgtgtaatcaggggaccttgattggtcctagcttgtttatgcgtaagttttgagacttttgggctctgtcctgacttattgccgtgactatggaacgctgcaataagtccgatctttgagcgaaatatgccatttttttattgtaattataccaataattataataaaaaactaggcatattaagccaatgatcgaaggaaacatcaaagacgaataacgcagaaagcgactggcggccaaatctaaaaaagacgtagatttgatgcagaggccaggatt", 
	id_seq => ">FQ8D8DZ01A033M,  ctacaggaatagaaactttggctttcgccaatcccatttcgacaagtttgtctgcatttgcttcgtcatcaacaaaattaataaattttgcaggatcattatcaaattgatttctaatttgactcggtaatccctcaaacatgctattagcagccgctactgtattcattgcgtcttggtaatcaaatccggtcatatcagcgtattgtttttcgaactggtttagatggtctattagtccagtcttattgtacttacgtactatcttatttatgtctgtctcatctttatgattctgttccgttaaaccatcaccagttgcgattgcaactcttaattttggtccataagccgttctaaaaggaacgccatctactttttctttgttgtccattttttacttcctaagg");

print "ASSIGN-FUNCTION-TO-DNA\n";
print "INPUT\n", &Dumper(@form), "\nOUTPUT\n";

$res = $ua->post($url, \@form);

if ($res->is_success) {
	print $res->content;
} else {
	print "Error ", $res->content;
};

exit;
@form = (function=>"assign_function_to_prot",
	id_seq=>"FQ8D8DZ01A0006, atcaggctgtgatcgcggaattccggaggaattatgcagaaaaaaccagatgaagccaagttttttcgctgaccacagccaatatggcatttcccaatggaaattcctatcaattggcgtggttaaagttgaaaaacgggcgtgacagagtcaaaagttctcagaaaaacgtcgcataaaaaaagttaccaaccaaggtccccccctaggtgtgtaatcaggggaccttgattggtcctagcttgtttatgcgtaagttttgagactttttgggctctgtcctgacttattgccgtgactatggaacgctgcaataagtccgatctttgagcgaaatatgccattttttattgtaattataccaataattataataaaaaactaagcatattaagccaatgatcgaaggaaacatcaaagacgaataacgcagaaagcgactggcggccaaatctaaaaaagacgtagatttgatgcagaggccaggagtctttcgagtagcaaccgagggccacgaagacgcctgtttgagcgtcgactaggcatcg
",
	id_seq=>"FQ8D8DZ01A00BO, gattggttccgcacccacaataaccgaagacaaactaaaaaaactataggaggtctcccgaactaactcttatcaggctgtgatcgcggaattccggaggaattatgcagaaaaaaccagatgaagccaagtttttcgctgaccacagccaatatggcatttcccaatggaaattcctatcaattggcgtggttaaagttgaaaaacgggcgtgacagagtcaaaagttctcagaaaacgtcgcataaaaaagttaccaaccaaggtccccccctaggtgtgtaatcaggggaccttgattggtcctagcttgtttatgcgtaagttttgagacttttgggctctgtcctgacttattgccgtgactatggaacgctgcaataagtccgatctttgagcgaaatatgccatttttttattgtaattataccaataattataataaaaaactaggcatattaagccaatgatcgaaggaaacatcaaagacgaataacgcagaaagcgactggcggccaaatctaaaaaagacgtagatttgatgcagaggccaggatt", 
	id_seq => ">FQ8D8DZ01A033M,  ctacaggaatagaaactttggctttcgccaatcccatttcgacaagtttgtctgcatttgcttcgtcatcaacaaaattaataaattttgcaggatcattatcaaattgatttctaatttgactcggtaatccctcaaacatgctattagcagccgctactgtattcattgcgtcttggtaatcaaatccggtcatatcagcgtattgtttttcgaactggtttagatggtctattagtccagtcttattgtacttacgtactatcttatttatgtctgtctcatctttatgattctgttccgttaaaccatcaccagttgcgattgcaactcttaattttggtccataagccgttctaaaaggaacgccatctactttttctttgttgtccattttttacttcctaagg");

print "ASSIGN-FUNCTION-TO-PROT\n";
print "INPUT\n", &Dumper(@form), "\nOUTPUT\n";

$res = $ua->post($url, \@form);

if ($res->is_success) {
	print $res->content;
} else {
	print "Error ", $res->content;
};

#
#PLACE-IN-FAMILY takes as input a list of protein sequences.  It
#       returns a list where each element describes the outcome of
#       trying to place the corresponding input sequence into a
#       FIGfam.  Each output can be either
#
#                COULD-NOT-PLACE-IN-FAMILY
#       or
#                ID FUNCTION
#
#       where ID is of the form FIGxxxxxx and FUNCTION is the family
#       function. 
#

@form = (function=>"place_in_family",
		seq=>"MALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRLLTALGALER", 
	seq=>"DPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL",
	seq=>"MALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL");

print "PLACE-IN-FAMILY\n";
print "INPUT\n", &Dumper(@form), "\nOUTPUT\n";

$res = $ua->post($url, \@form);

if ($res->is_success) {
	print $res->content;
} else {
	print "Error ", $res->content;
};

#
#MEMBERS-OF-FAMILIES takes as input a list of FIGfam IDs.  The
#       output is a list of functions for those families
#       (INVALID-FAMILY will be returned for IDs that do not correspond
#       to an active family), as well as a list of the IDs in each family.
#
@form = (function=>"members_of_families", id=>"FIG000001", id=>"FIG000002");
print "\nMEMBERS-OF-FAMILY\n"; 
print "INPUT\n", &Dumper(@form), "\nOUTPUT\n";

$res = $ua->post($url, \@form);

if ($res->is_success) {
	print $res->content;
} else {
	print "Error ", $res->content;
};

#
#ALL-FAMILIES returns a list of [FIGfam-ID,function] tuples.
#
@form = (function=>"all_families");
print "\nALL-FAMILIES\n"; 
print "INPUT\n", &Dumper(@form), "\nOUTPUT\n";

$res = $ua->post($url, \@form);

if ($res->is_success) {
	print $res->content;
} else {
	print "Error ", $res->content;
};
#SHOULD-BE-MEMBER takes as input a list of 2-tuples
#
#             [FIGfam-ID,protein sequence]
#
#       It returns a list of boolean values indicating whether or not
#       the indicated protein sequence can be placed in the designated
#       family.
#
@form = (function=>"should_be_member", 
		id_seq=>"FIG000001,MALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRLLTALGALER", 
	id_seq=>"FIG000001,DPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL",
	id_seq=>"FIG000002,MALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL");

print "\nSHOULD-BE-MEMBER\n"; 
print "INPUT\n", &Dumper(@form), "\nOUTPUT\n";

$res = $ua->post($url, \@form);

if ($res->is_success) {
	print $res->content;
} else {
	print "Error ", $res->content;
};

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3