Presentation is loading. Please wait.

Presentation is loading. Please wait.

CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU C programming Morten Nielsen, CBS, BioCentrum, DTU.

Similar presentations


Presentation on theme: "CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU C programming Morten Nielsen, CBS, BioCentrum, DTU."— Presentation transcript:

1 CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU C programming Morten Nielsen, CBS, BioCentrum, DTU

2 CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU Why C? Fast, robust, simple (?!#&*^) –10 times faster than perl Problems –Few advanced function pre-implemented No regular expression, split etc. –Steep learning curve Good news –We have a large library with useful functions and subroutine –And a very robust template for building programs

3 CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU A simple example Make testdir and cp /usr/opt/www/pub/CBS/researchgroups/immunology/intro/Cprogr am/exercise/*. helloworld.c Compilation –make helloworld (the warning do not matter!) –Will generate a file named helloworld Execution –helloworld

4 CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU Command line options hellowold2.c pparse( &argc, &argv, param, 0, "" ); Number of arguments required Description of arguments

5 CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU Use of library function and data structures File open and close –fp = fopen( filename, “r” ) –fclose(fp) Data structures typedef struct fsalist { struct fsalist *next; char *seq; char name[255]; int len; float score; } FSALIST; FSALIST*fsa; fsa->name, name of entry fsa->seq, sequence fsa->len, length of sequence fastaex.c

6 CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU And now you Compile the program fastaex Try to run the program with different options Include an option to the program that will print the name of the fasta entry

7 CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU Making your own libraries Make a directory called utils cp / usr/opt/www/pub/CBS/researchgroups/immunology/intro/Cprog ram/utils/*./utils/ Look at the file dummy.c Make a library by typing –make Go back to the exercise directory Open the file makefile2 and give the path to the library –MYLIB = /home/people/XXX Compile the program helloworld3 by typing –make -f makefile2 helloworld3


Download ppt "CENTER FOR BIOLOGICAL SEQUENCE ANALYSISTECHNICAL UNIVERSITY OF DENMARK DTU C programming Morten Nielsen, CBS, BioCentrum, DTU."

Similar presentations


Ads by Google