Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: tblastn unix

by kevbot (Vicar)
on Jun 28, 2017 at 07:12 UTC ( [id://1193763]=note: print w/replies, xml ) Need Help??


in reply to tblastn unix

Hello Nicpetbio23!,

The following example uses a couple CPAN modules (Path::Tiny, and Capture::Tiny). The syntax of your tblast command does not seem to be quite right. Detailed descriptions for tblastn command line arguments can be obtained with tblastn -help. I modified your tblastn command based on my reading of the help output.

This code assumes that there are fasta query files in the current directory with .fa file extensions. For each fasta file found, an output file will be generated (with a .txt extension).

NOTE: I did not test this code thoroughly. I commented out the call to system to be sure that the intended $cmd string is generated, but I did not run the tblastn commands.

#!/usr/bin/env perl use strict; use warnings; use Path::Tiny; use Capture::Tiny ':all'; my @paths = path('./')->children( qr/\.fa$/ ); foreach my $file_path (@paths){ my $query_file = $file_path->stringify; my $output_file = path( $file_path->parent, $file_path->basename( '.fa' ).'_output.txt' )->stringify; my $cmd = "tblastn -query $query_file -db genome.db". " -out $output_file"; print "Query file: $file_path\n"; print "\t $cmd\n"; my ($stdout, $stderr, $exit) = capture { system( $cmd ); }; if ($exit != 0){ die "Error: command failed"; } } exit;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1193763]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-25 04:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found