CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
system command

 



needhelp
Novice

Nov 21, 2008, 10:04 AM

Post #1 of 5 (445 views)
system command Can't Post

I am trying to use the system command in a loop to execute a program against files in my file system. Of course I need
to use variables in the system command and I am having trouble doing this.

The following code works:

system ('c:\netblast\blastcl3 -p blastp -d nr -i 1B94.fasta -o 1B94.out');

The following code gives me an error:

$file = "C:\\Documents and Settings\\dfergus2\\My Documents\\workspace\\PerlBio\\1B94.fasta";
$output_file = "C:\\Documents and Settings\\dfergus2\\My Documents\\workspace\\PerlBio\\1B94.out";

@args = ("c:\\netblast\\blastcl3", "-p blastp", "-d nr", "-i $file", "-o $output_file");
system(@args);

Error: [NULL_Caption] FATAL ERROR: blast: Unable to open input file C:\Documents and Settings\dfergus2\My Documents\workspace\PerlBio\1B94.fasta

It seems to be a problem with how the parameters to blastcl3 are passed.

Thanks for the help.


KevinR
Veteran


Nov 21, 2008, 10:16 AM

Post #2 of 5 (444 views)
Re: [needhelp] system command [In reply to] Can't Post

try:


Code
 
$file = 'C:/Documents and Settings/dfergus2/My Documents/workspace/PerlBio/1B94.fasta';
$output_file = 'C:/Documents and Settings/dfergus2/My Documents/workspace/PerlBio/1B94.out';
$args = qq{'c:/netblast/blastcl3 -p blastp -d nr -i $file -o $output_file'};
system($args);


Not sure it will work but give it a try.
-------------------------------------------------


(This post was edited by KevinR on Nov 21, 2008, 10:19 AM)


needhelp
Novice

Nov 21, 2008, 10:24 AM

Post #3 of 5 (440 views)
Re: [KevinR] system command [In reply to] Can't Post

Had to change to the following to Windows:

$args = qq{'C:\\netblast\\blastcl3 -p blastp -d nr -i $file -o $output_file'};



system
($args);

Get error

The filename, directory name, or volume label syntax is incorrect.

Thanks




needhelp
Novice

Nov 21, 2008, 2:29 PM

Post #4 of 5 (433 views)
Re: [needhelp] system command [In reply to] Can't Post

I did get it to work.

$args = "c:\\netblast\\blastcl3 -p blastp -d nr -i ". $file . " -o " . $output_file;

system($args);

Thanks




KevinR
Veteran


Nov 21, 2008, 2:52 PM

Post #5 of 5 (432 views)
Re: [needhelp] system command [In reply to] Can't Post

If that worked then this should work too:


Code
$args = qq{C:\\netblast\\blastcl3 -p blastp -d nr -i $file -o $output_file};


Note I removed the single-quotes that were in the previous code I posted.
-------------------------------------------------


(This post was edited by KevinR on Nov 21, 2008, 2:52 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives