This is with reference to the query posted in Local Blast: Querying A Single Sequence Without Input File. Possible ?. If I try to run the following using command line it runs perfectly fine:
blastn -query <(echo -e ">Name\nATCGTTAGCT") -subject <(echo -e ">Name\nATCGTTAGCT")
But, I am doing the same by a C program where I run BLASTP which takes in two strings (fasta_GWIDD
and fasta_UNIPROT
in the code) and compares them. The problem that I am encountering is the use of echo/system in the code. Can anyone suggest what am I missing out??
for(i=0;i<index1;i++)
{
sprintf(fasta_GWIDD,">%s\\n%s\n",fasta_name1[i],fasta_seq1[i]);
setenv("GwiddVar", fasta_GWIDD, 1) ;
sprintf(fasta_UNIPROT,">%s\\n%s\n",fasta_name2[i],fasta_seq2[i]);
setenv("UniprotVar", fasta_UNIPROT, 1) ;
system("blastp -query <(echo -e $GwiddVar) -subject<(echo -e $UniprotVar)");
}
The error is:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `blastp -query <(echo -e $GwiddVar) -subject<(echo -e $UniprotVar)'
Did you try placing a space between
-subject
and<(
? Also, where does sh point? You're using process substitution for bash. Anyway, there is a C API...Placing a space between
-subject
and<(
doesn't help. It gives the same error:Can you please clarify your last lines: "process substitution for bash" and "there is a C API"
As Pierre Lindenbaum mentioned,
<(some process)
is process substitution in bash, but not other shells. Ifsh
is a different shell, such as the originalsh
, then that won't work. If you don't know what a shell is, then, well, you have some reading to do.Since you're writing in C anyway, you might just want to use the C interface (aka, the C API) to blast and avoid all of this. I'm not sure how else to explain an interface if you don't know what that is other than to just link to the documentation.