This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BLAT command call in c++ project (Netbeans)

Hi there,

I want to execute blat (to search a pattern in my fasta file) using its command in a function in my c++ project. i am using netbeans compiler.

Can anybody help me out in this regard?

How can we use pre-compiled executable tool in our own code to use it in run time.

Thanking in anticipation,
Madiha

cpp blat

1 answer

You can use the system() function to call other programs. See man system.

The  system()  library  function  uses  fork(2) to create a child process that executes the shell command specified in command using execl(3) as follows:

   execl("/bin/sh", "sh", "-c", command, (char *) 0);

system() returns after the command has been completed.

Thank you kloetz, its working! one more question if you know about blat..as blat takes file as input and give output in another file..is there any command of blat that takes string as inputs and string as output?

Sorry, I don't know blat. ☺

is there any command of blat that takes string as inputs and string as output

What do you mean by that? In a way blat is taking strings (DNA/Protein sequence) in a file and providing a formatted table (psl) as default output. It is not meant a general string search program, if that is what you are asking.

yes it takes string of DNA etc in file, what i am asking is that is there any way of providing database and query in or at least query in the form of string instead of file and take output in string or any other data structure?..because i have to use it in my code multiple times for multiple genes in a loop, so i am trying to avoid file reading and writing again and again.

Log in to answer this question.