GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Apr-2004, 01:53
kelly80 kelly80 is offline
New Member
 
Join Date: Apr 2004
Posts: 7
kelly80 is on a distinguished road
Unhappy

C I/O problem


I am using c language to write a program to handle file processing which i need to read through a txt file contains the following information(here is just a short sample):

*2609_AUS74

#gggga
&Right tag;1 cag;1 gat;1 .
+Left ata;1 gta;1 .
[3]

#gggat
&Right aga;1 ata;1 .
+Left act;1 .
[2]

#ggata
&Right gag;1 ctg;1 gct;1 tag;1 cct;1 .
+Left gct;1 ttt;1 ctg;1 cat;1 .
[5]

#gatag
&Right agt;1 ctt;1 acc;1 .
+Left ggg;1 ttg;1 gga;1 .
[3]

#ataga
&Right gtg;1 cct;1 cat;1 .
+Left ggg;1 gag;1 gat;1 .
[3]

*1M_AUS12

#ataga
&Right tgg;1 .
+Left cta;1 gta;1 .
[3]

#ggaga
&Right tag;1 gat;1 aag;1 .
+Left gtt;1 gca;1 .
[3]

#gagat
&Right agg;1 aga;1 .
+Left gga;1 .
[2]

#agata
&Right ggg;1 gac;1 taa;1 .
+Left gag;1 cat;1 .
[3]

the name start with * is a sequence name while the one start with # is the context name(the # is just to easier the finding process)..there r around 16 sequece name in the file which consists of up to 800 context name(not consistant) and each context name have right n left node(with others small context), the number after the ";" is the frequency of that particular small context. while the number inside [] is the frequency of that context in the sequence..

my problem is i need to open the txt file(infile),n find whether the context(for example "gggga") appears in other sequence n put in a table as below:

gggga
|---------------|---------------|
|sequence | frequency |
|---------------|---------------|
|2609_AUS74 | 3 |
|---------------|---------------|
|1M_AUS12 | 0 |
|---------------|---------------|

then move to table gggat, ggata, ggata, gatag, ataga, ggaga, gagat and agata..

the table is output to a file call "outfile"..

i am quite new in c programming actually..and i am not so familiar with those syntax..my idea is create a structure that will hold all the information of a context. These structures will form a link list. For each sequence it points to the top of one of these linklists. then it need to traverse it to check if a linklist contains the context name that i m looking for... but, the problem is..i dun know where to start..my program just write until i open the file, then i dun know how to continue it..using which function to search through the file??fscanf??how to point (let's say a pointer) to the next *sequence names?how to construct the struct??how about when meet a blank line or space,how i going to tell the program to ignore them??

Any help is appreciated..
  #2  
Old 27-Apr-2004, 02:14
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
huh??
Nice Homework Though!
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #3  
Old 27-Apr-2004, 02:29
kelly80 kelly80 is offline
New Member
 
Join Date: Apr 2004
Posts: 7
kelly80 is on a distinguished road
this is not a homework..actually i am dealing with DNA sequences...i need to write a program to summarize the data..since i am a newbie in programming, so i post my problem here..i am not means to ask for a sample program..just i totally lost now n need for some advices..or do u have some information suitable for me to read??

any help is appreciated!!
  #4  
Old 27-Apr-2004, 02:47
Max Payne's Avatar
Max Payne Max Payne is offline
Regular Member
 
Join Date: Apr 2004
Location: 3° 08 North 101° 42 East
Posts: 332
Max Payne is a jewel in the roughMax Payne is a jewel in the roughMax Payne is a jewel in the rough
This is a great tuto for c newbie and would be helpful for file processing..also look at CPLUSPLUS which offers great tuto on basic c++..

consedering your problem, I think you need to familiarize yourself first in those related subject before you start on your problem.. try make programs to read files and write to files.try to learn how to use structures. There are some other threads in this forum which would be helpful..

I'm not being helpful,Am I??
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds
  #5  
Old 27-Apr-2004, 20:15
kelly80 kelly80 is offline
New Member
 
Join Date: Apr 2004
Posts: 7
kelly80 is on a distinguished road

thanks!!


nope,at least u reply me... ok Max Payne,i will make sure myself more familiar with those syntax before i ask for my second question..thanks for the reference.. ;-)
 
 

Recent GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Another FX 5600 problem (but with details that might shed light on this) BobDaDuck Computer Hardware Forum 2 16-Apr-2004 07:53
Rookie problem with date format cave monkey MySQL / PHP Forum 4 18-Mar-2004 08:41
problem with php5 cgi installation fab13 Apache Web Server Forum 3 19-Nov-2003 09:11
unwanted scrollbar problem kelly001 Web Design Forum 3 24-Oct-2003 10:44
Geforce FX 5600 Ultra problem jenovasbirth Computer Hardware Forum 1 04-Oct-2003 17:00

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:19.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.