Thread: C programing for DNA...

  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    C programing for DNA...

    hi guys... im new here... Im studying in a university and taking C programing subject this semester... an assignment given to us without guidelines... as we are new to c programing, we need ur help to complete our assignment...

    The questions are...

    1. By using the C language on the Microsoft Visual Studio C++, create a human-size chromosome with 125 Mb by using a pseudorandom number generator (PRNG) function to generate integers of 0, 1, 2, 3 to represent the DNA bases ATGC. Specify estimated time duration for this computing execution.


    2. Store the information of each DNA base in RAM in 2 bits each like 16 DNA bases for a 32-bit integer, or 32 DNA bases for a 64-bit integer.


    3. Store the generated human-size chromosome in an electronic file in the hard disk drive (HDD) in binary form. Specify estimated time duration for this computing execution.


    4. Read the first 0.1% of the generated binary file in Step [T.3], convert the 002, 012, 102, and 112 to the corresponding A, T, G, and C, or any order, and print out the chromosome in ATGC character format in a text file (.TXT). Specify estimated time duration for this computing execution.


    please help us to complete our assignment... thanks in advance to brothers and sisters... TQ...
    Last edited by S16; 04-29-2009 at 12:43 AM.

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    7
    We are using microsoft visual C++ 2005 software...

  3. #3
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Homework Policy

    You give us code we will help you fix it. You give us your homework questions and expect us to answer them, we give you the finger.

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    7
    we are trying to do it for past 3 weeks,,, nothing is working... im not giving homework guys, just need help... in 3 days time we need to submit our assignment...

  5. #5
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Then you need to speak to your teacher and consult your literature. If neither help then you are either in a class that is too hard for you or you need to speak to someone above your teacher about the curriculum. Somehow I doubt that the teacher dumped you into this without any programming knowledge or at the very least an expected amount of knowledge when you began the course (see the pre-requisites for your class)

    Also. it helps to use proper punctuation and capitolization so one can read your text easily.

    This should start you on your way.
    Code:
    int main()
    {
    	return 0;
    }

  6. #6
    Registered User
    Join Date
    Apr 2009
    Posts
    7
    we have tried our best to consalt our lecture... his explaination kinda weird and non of us can understand it... im here not to argue... plz help us...

  7. #7
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    We are not here to do your homework. Post the code that you have so far, what is the expected output and what you are currently getting as output. Then we may talk, until then, you are unlikely to get anything but negative attention.

    Again capitols and punctuation. You could at least try to convince me you are a mature person honestly seeking help, instead of a lazy student who at the last minute found out he needs a passing grade in a course.

  8. #8
    Registered User
    Join Date
    Apr 2009
    Posts
    7
    we have basic about c programing... but the question given to us more then our understanding...

  9. #9
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    I am not going to say any more on the matter. Post an honest attempt and we will help you. If you are going to just keep begging for us to do your work for you, I suggest you leave.

  10. #10
    Registered User
    Join Date
    Apr 2009
    Posts
    7
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    
    int main()
    {
    
    	time_t time_start, time_end, time_period;
    	time_start = time(0);
    	//time_start = time(NULL);
    
    	FILE *fPtr;
    
    	if ((fPtr = fopen("basePair_125kb.bin", "wb+")) == NULL)
    	{
    		printf("File could not be opened.\n");
    		return -1;
    	}
    	
    	srand(time(NULL));
    
    	unsigned long basePair_0, basePair_1, basePair_2, basePair_32bit;
    	
    	int loop;
    	
    	for (loop = 0; loop < 7812; loop++)
    	{
    		basePair_0 = rand();
    		basePair_1 = rand();
    		basePair_2 = rand();
    		basePair_32bit = (basePair_2 << 30) + (basePair_1 << 15) + basePair_0;
    		
    		fprintf(fPtr, "%.8X", basePair_32bit);
    
    		if (loop % 1000 == 0)
    		{
    			printf("loop count = %d\n", loop);
    		}
    	}
    
    	basePair_0 = rand();
    	basePair_1 = rand();
    	basePair_2 = rand();
    
    	basePair_32bit = (basePair_2 << 30) + (basePair_1 << 15) + basePair_0;
    	basePair_32bit = basePair_32bit >> 16;
    
    	printf("Random 15-bit basePair_0: %u\n", basePair_0);
    	printf("Random 15-bit basePair_1: %u\n", basePair_1);
    	printf("Random 2-bit basePair_2: %u\n", basePair_2);
    	printf("Random 32-bit basePair_32bit: %u\n", basePair_32bit);
    	printf("RAND_MAX = %u\n", RAND_MAX);
    	printf("sizeof(long) = %d\n", sizeof(long));
    
    	fprintf(fPtr, "%.4X", basePair_32bit);
    	
    	fclose(fPtr);
    
    	time_end = time(0);
    	//time_end = time(NULL);
    	time_period = time_end - time_start;
    	
    	printf("Time to run the random DNA generation = %d\n", time_period);
    
    	return 0;
    }
    hi guys.... afta consult our lecturer, we successfully done few parts of our assignment... somehow, we do not know how to convert it from hexadecimal form to binary form and finally to character form (ATGC)... anyone can suggest us how to convert?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programing microcontrollers in c
    By gorabhat in forum C Programming
    Replies: 2
    Last Post: 09-09-2008, 10:40 AM
  2. Delete files and subfolder using c programing (Urgent
    By telukuntla in forum C Programming
    Replies: 13
    Last Post: 05-19-2008, 11:51 AM
  3. Human brain and programing
    By avgprogamerjoe in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 08-27-2007, 04:48 PM
  4. Non programing Question
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 06-21-2002, 06:55 AM
  5. C++ Programing
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-06-2001, 04:13 PM

Tags for this Thread