Question: Local Blast: Querying A Single Sequence Without Input File. Possible ?
4
gravatar for Pasta
7.8 years ago by
Pasta1.3k
Switzerland
Pasta1.3k wrote:

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 • 7.5k views
ADD COMMENTlink modified 5.9 years ago by jwhabig20 • written 7.8 years ago by Pasta1.3k
11
gravatar for Pierre Lindenbaum
7.8 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum124k wrote:

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 COMMENTlink written 7.8 years ago by Pierre Lindenbaum124k

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

ADD REPLYlink written 7.8 years ago by Pasta1.3k

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 REPLYlink written 7.8 years ago by Manu Prestat3.9k

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 REPLYlink written 7.8 years ago by Manu Prestat3.9k
5
gravatar for Sujai Kumar
7.8 years ago by
Sujai Kumar240
United Kingdom
Sujai Kumar240 wrote:

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 COMMENTlink written 7.8 years ago by Sujai Kumar240

thats pretty cool :)

ADD REPLYlink written 7.8 years ago by Yannick Wurm2.3k

Excellent. Thanks.

ADD REPLYlink written 5.9 years ago by a.zielezinski8.9k

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 REPLYlink modified 2.8 years ago • written 2.8 years ago by shujun.ou.10

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 REPLYlink modified 2.6 years ago • written 2.6 years ago by devengsbtm0
2
gravatar for jwhabig
5.9 years ago by
jwhabig20
jwhabig20 wrote:

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 COMMENTlink written 5.9 years ago by jwhabig20

This is what I was looking for!

ADD REPLYlink written 5.1 years ago by rens.holmer20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 711 users visited in the last hour