Thread: Utilizing another compiled program for a task.

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Question Utilizing another compiled program for a task.

    I'm trying to write a program that takes information from a text file and uses it to provide arguments to another executable file.

    I want to use a BLAST executable to compare several DNA sequence files with each other and this would be much more convenient to accomplish if I could put the executable's mode operators (the dashed things -mode etc.) and the filenames into a text file and write a program that just feeds all the different permutations of comparisons into the BLAST EXE.

    I haven't yet determined how the blast program returns its outputs or how to use it properly, so i'm not even sure how to handle what it will send back, but i'm sure its possible, as web servers interpret the results to post on screen when you run blasts on the science websites that host these services.

    At the moment I just want to write the skeleton of the C code that will read the text file and set itself up to execute the permutations of comparisons.

    This is not a homework assignment, I'm working in a lab for the summer for a summer internship, and I will have to use this process several times with different parameters to compare many different DNA sequences with each other to determine if there are any signifcant similarities between them. (comparing each with all the others once).

    Can anybody give me advice on this?

    I forgot to mention this, but either the file will also include the name for a text output file or I will construct names for seperate outputs for each comparison, if these are even possible to create with this software.
    Last edited by kotoroshinoto; 06-03-2008 at 08:41 AM. Reason: forgot something, don't want to double post.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That text file is generally called a "script" or "batch file", and most systems will allow you do that. And you can usually do things like run through a list of combinations and permutations. So there's really no need to write a C program to do this.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    5
    I do not believe that the BLAST software (which does not have a built in gui) was equipped to handle batch inputs. It usually only runs a single input. (blast usually compares one DNA strand against an entire database, but I am attempting to use a program called blast2, which compares 2 dna sequences)

    The fact that the web sites that use this software can receive and interpret the results indicates that it is readily incorporated into other programming.
    Last edited by kotoroshinoto; 06-03-2008 at 10:35 AM. Reason: corrections

  4. #4
    Registered User
    Join Date
    Jun 2008
    Posts
    5
    The arguments list for the blast program are as follows (given when running the program without arguments)
    D:\UMDNJ\BLAST\bin>bl2seq.exe

    bl2seq 2.2.18 arguments:

    -i First sequence [File In]
    -j Second sequence [File In]
    -p Program name: blastp, blastn, blastx, tblastn, tblastx. For blastx 1st seq
    uence should be nucleotide, tblastn 2nd sequence nucleotide [String]
    -g Gapped [T/F]
    default = T
    -o alignment output file [File Out]
    default = stdout
    -d theor. db size (zero is real size) [Real]
    default = 0
    -a Text ASN.1 output file [File Out] Optional
    -G Cost to open a gap (-1 invokes default behavior) [Integer]
    default = -1
    -E Cost to extend a gap (-1 invokes default behavior) [Integer]
    default = -1
    -X X dropoff value for gapped alignment (in bits) (zero invokes default behav
    ior)
    blastn 30, megablast 20, tblastx 0, all others 15 [Integer]
    default = 0
    -W Word size, default if zero (blastn 11, megablast 28, all others 3) [Intege
    r]
    default = 0
    -M Matrix [String]
    default = BLOSUM62
    -q Penalty for a nucleotide mismatch (blastn only) [Integer]
    default = -3
    -r Reward for a nucleotide match (blastn only) [Integer]
    default = 1
    -F Filter query sequence (DUST with blastn, SEG with others) [String]
    default = T
    -e Expectation value (E) [Real]
    default = 10.0
    -S Query strands to search against database (blastn only). 3 is both, 1 is t
    op, 2 is bottom [Integer]
    default = 3
    -T Produce HTML output [T/F]
    default = F
    -m Use Mega Blast for search [T/F] Optional
    default = F
    -Y Effective length of the search space (use zero for the real size) [Real]
    default = 0
    -t Length of the largest intron allowed in tblastn for linking HSPs [Integer]

    default = 0
    -I Location on first sequence [String] Optional
    -J Location on second sequence [String] Optional
    -D Output format: 0 - traditional, 1 - tabular [Integer]
    default = 0
    -U Use lower case filtering for the query sequence [T/F] Optional
    default = F
    -A Input sequences in the form of accession.version [T/F]
    default = F
    -V Force use of the legacy BLAST engine [T/F] Optional
    default = F


    I think the best approach would to to have the first line of text contain the arguments (all of the batch jobs would need to be run under the same conditions)
    and for the rest of the lines to contain the filenames of the sequence files. I won't need to open/close multiple files because the blast software can read from the text files already. All i really need to know is how to invoke the blast executable properly within a C program.
    Last edited by kotoroshinoto; 06-03-2008 at 10:49 AM. Reason: to add something

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    C does not necessarily appear to be the best tool for the task, but if it's what you have, then it will certainly work. (I think a batch file would be spiffy for the job, although it would probably take me a few tries to remember how the for syntax works in .bat files.) If you must must must use C, you can use system("command") to pass that command off to your shell. You can build that command string using sprintf or the like, after parsing the script files.

  6. #6
    Registered User
    Join Date
    Jun 2008
    Posts
    5
    The only languages I have experience with are C and java, I have no idea how to write *.bat files. system("command") will probably work just fine.

  7. #7
    Registered User
    Join Date
    Jun 2008
    Posts
    5

    Problem

    When I attempt to call it using system I get this response.

    'blast2seq.exe' is not recognized as an internal or external command,
    operable program or batch file.

    what have I done wrong in the system call?

    ---edit my bad spelling mistake
    Last edited by kotoroshinoto; 06-03-2008 at 01:54 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM