BLAT command call in c++ project (Netbeans)
1
0
Entering edit mode
4.0 years ago

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

BLAT C++ • 999 views
ADD COMMENT
2
Entering edit mode
4.0 years ago
kloetzl ★ 1.1k

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.
ADD COMMENT
0
Entering edit mode

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?

ADD REPLY
0
Entering edit mode

Sorry, I don't know blat. ☺

ADD REPLY
0
Entering edit mode

still thank you for your help :)

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 2484 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