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

View of /FigTutorial/test_prot.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\nMALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRLLTALGALER\n>FOO\nDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL\n>TEST\nMALDVAAIRAHVPALKSGTARFDAPGGTQTPQPVIDAIAAALTAPLANRGRNTEGERNADRIVDEARSALADLLGTTPGTVVFGRSATQLAYDLSRTLAKGWGPGDEVVVTRLDHDSNIRPWVQAAEAAGADVRWADFDPATGELRPEHLAAVLGPRTRLVAVTAASNLIGTMPDLPALASLVHANGAHFHVDAVHYASHAVVDLAATGADTLVCSPYKFLGPHLGVLTGRAELLESLRPDKLLPSADTVPERFELGTLPYELLAGTSAAVDFLAGLEAEAEGSRRDRLVASFAALEAHEEALRERLERGLAELGGITVYSRAARRTPTLLFTVAGLRPADVYRQLAERAVDAPAGSFYAVEAARRLGLGDEGGVRVGLAPYSSAEDVDRL\n>fig|83333.1.peg.4\nMKLYNLKDHNEQVSFAQAVTQGLGKNQGLFFPHDLPEFSLTEIDEMLKLDFVTRSAKILSAFIGDEIPQEILEERVRAAFAFPAPVANVESDVGCLELFHGPTLAFKDFGGRFMAQMLTHIAGDKPVTILTATSGDTGAAVAHAFYGLPNVKVVILYPRGKISPLQEKLFCTLGGNIETVAIDGDFDACQALVKQAFDDEELKVALGLNSANSINISRLLAQICYYFEAVAQLPQETRNQLVVSVPSGNFGDLTAGLLAKSLGLPVKRFIAATNVNDTVPRFLHDGQWSPKATQATLSNAMDVSQPNNWPRVEELFRRKIWQLKELGYAAVDDETTQQTMRELKELGYTSEPHAAVAYRALRDQLNPGEYGLFLGTAHPAKFKESVEAILGETLDLPKELAERADLPLLSHNLPADFAALRKLMMNHQ
\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_function_to_prot", 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;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3