Local Blast: Querying A Single Sequence Without Input File. Possible ?
3
4
Entering edit mode
12.9 years ago
Pasta ★ 1.3k

Hi,

When using BLASTALL by command line, is there any way of querying BLASTALL without using any input file but a directly a sequence ?

I would like to do something like:

blastall -n blastn -d MyBud.fna -XX "ATCGTTAGCT"

Thx for your help

blast • 12k views
ADD COMMENT
11
Entering edit mode
12.9 years ago

no, but you can provide your sequence via stdin:

echo -e ">Name\nATCGTTAGCT" | blastall -n blastn -d MyBud.fna

i Query File [File In]

default = stdin

The query should be in FASTA format. If multiple FASTA entries are in the input file, all queries will be searched.

ADD COMMENT
0
Entering edit mode

Perfect! That will do the trick. Thanks for your help

ADD REPLY
0
Entering edit mode

Just an add (because I just tried it on a server): if your interpreter is sh (not bash), then you need not the use of "-e" (which does not exist in sh anyway).

ADD REPLY
0
Entering edit mode

Just an add (because I just tried it on a server): if your interpreter is csh (not bash or sh), then you need not the use of "-e" which does not exist in csh anyway.

ADD REPLY
7
Entering edit mode
12.9 years ago
Sujai Kumar ▴ 270

Another tip, the new blast+ suite takes bash subprocesses, so, you could even do:

blastn -query <(echo -e ">Name\nATCGTTAGCT") -subject <(echo -e ">Name\nATCGTTAGCT")

etc...

ADD COMMENT
0
Entering edit mode

thats pretty cool :)

ADD REPLY
0
Entering edit mode

Excellent. Thanks.

ADD REPLY
0
Entering edit mode

This is very useful. Note that process substitution is invoked by bash, not shell. So if use this in Perl, you can do something like this:

my $seq1=">seq1\\nTGAAAGATGG";
my $seq2=">seq2\\nTGAAAGATGG";
my $line="blastn -subject <(echo -e \"$seq1\") -query <(echo -e \"$seq2\") -outfmt 6";
my $result=qx(bash -c '$line');
print "$result\n";

Hope it helps!

ADD REPLY
0
Entering edit mode

blastn -subject <(echo -e \"$seq1\") -query <(echo -e \"$seq2\") -outfmt 6

for this command how it can be run in python , if you know please reply asap. if i want to put directly Sequence in place of $seq2 , how it is possible

because i am trying this command in python but getting this error

Warning: (1431.1) CFastaReader: Ignoring invalid residue " at line 1, position 0 Warning: (1431.1) CFastaReader: Ignoring invalid residue " at line 1, position 78

ADD REPLY
2
Entering edit mode
10.9 years ago
jwhabig ▴ 20

I was interested in performing the same operation from within python and thought I'd share an example of my implementation in case it is valuable to anyone else in the same boat.

import subprocess

blastn = subprocess.Popen('blastn -db PVY -outfmt 6', shell=True, stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

results, err = blastn.communicate('AAATTAAAACAACTCAATACAACATAAGAAAATCAACGCAAAAACACTCACAAAAGCTTTC')

ADD COMMENT
0
Entering edit mode

This is what I was looking for!

ADD REPLY

Login before adding your answer.

Traffic: 2142 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6