Hello Nicpetbio23!,

I would like to add a few points to your question My main question is how do I change my unix command so that I can go through a list of query and genome sequences and return the tblastn results for each?. I would start by saying do not use system, why? Simply written in the documentation, I quote:

This is not what you want to use to capture the output from a command +; for that you should use merely backticks or qx//, as described in ` +STRING` in perlop.

So back to your question, I assume that you want to capture the output of your command through a loop as the fellow monk 1nickt replied to your question already.

So in conclusion, I spend a small amount of time to install the blast on my linuxOS following this great tutorial Bioinformatics: introduction to using BLAST with Ubuntu.

After completing the installation and creating the db for testing purposes, I created a small script to demonstrate how to use backticks with tblastn.

#!usr/bin/perl use say; use strict; use warnings; my $dir_before = `ls -la`; chomp $dir_before; say $dir_before; # execute your linux command with backticks `blastn -query example.fa -db /home/tinyos/blast_db/refseq_rna.00 -out + results.txt`; my $dir_after = `ls -la`; chomp $dir_after; say $dir_after; __END__ $ perl bio.pl total 20 drwxr-xr-x 2 tinyos tinyos 4096 Jun 28 00:30 . drwxr-xr-x 7 tinyos tinyos 4096 Jun 28 00:19 .. -rw-r--r-- 1 tinyos tinyos 279 Jun 28 00:30 bio.pl -rw-r--r-- 1 tinyos tinyos 0 Jun 28 00:21 bio.pl~ -rw-r--r-- 1 tinyos tinyos 459 Jun 28 00:04 example.fa -rw-r--r-- 1 tinyos tinyos 458 Jun 28 00:04 example.fa~ total 32 drwxr-xr-x 2 tinyos tinyos 4096 Jun 28 00:30 . drwxr-xr-x 7 tinyos tinyos 4096 Jun 28 00:19 .. -rw-r--r-- 1 tinyos tinyos 279 Jun 28 00:30 bio.pl -rw-r--r-- 1 tinyos tinyos 0 Jun 28 00:21 bio.pl~ -rw-r--r-- 1 tinyos tinyos 459 Jun 28 00:04 example.fa -rw-r--r-- 1 tinyos tinyos 458 Jun 28 00:04 example.fa~ -rw-r--r-- 1 tinyos tinyos 10739 Jun 28 00:30 results.txt

Since the blastn does not return anything I check my directory again. I assume your command is returning something? If this is the case then backticks, if not create a loop as the fellow monk 1nickt pointed out and use system every time to check if your command was correct. Then find a way to open the output and do something with the file. So voila you are done :D

Hope this helps, BR

Seeking for Perl wisdom...on the process of learning...not there...yet!

In reply to Re: tblastn unix by thanos1983
in thread tblastn unix by Nicpetbio23!

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.