Results 1 to 5 of 5
- 04-22-2010, 05:57 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 2
- Rep Power
- 0
I need ideas on how to read this file
Hi,
I want to read a flat file with the following info:
http://www.geneontology.org/ontology...ology_edit.obo
There are about 30,000 Terms. Most terms are linked with others and all of them have an id which has this format: GO:number, i.e: GO:0006310.
For every term I need to get:
-their id.
-the is_a id.
- the relationship id
For instance:
I need:[Term]
id: GO:0000019
name: regulation of mitotic recombination
namespace: biological_process
def: "Any process that modulates the frequency, rate or extent of DNA recombination during mitosis." [GOC:go_curators]
synonym: "regulation of recombination within rDNA repeats" NARROW []
is_a: GO:0000018 ! regulation of DNA recombination
relationship: regulates GO:0006312 ! mitotic recombination
GO:0000019, GO:0000018, GO:0006312.
Finally I must ignore them when "is_obsolete: true" is present. (The Term is not relevant and I don't need it's info)
I don't need any java code (although any suggestion is greatly appreciated), but I need a way to get this done. My final goal is to make a matrix with the Term's id in the first column, and the rest of the ids found, in the following columns. Any idea on how to do this?
P.S: Please forgive me if this is not the right forum. Feel free to move it.
- 04-22-2010, 06:09 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Read a line by line from the file, and then validate with your patterns. Regular expressions make sense in that case.
- 04-22-2010, 09:52 PM #3
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
You will want a Record class and a Value class. The Record itself is a set of key/value pairs, so you will want to store it as an ArrayList<Map<String, Value>>. The Value is text (String) and possibly one or more links (ArrayList<String>). You'll read through the file, parsing Values and Records. When you have a complete Record, you will store it in a Map<String, Record> (probably using the HashMap implementation) using the id field as the key.
I think you'll find the project simpler if you parse all the fields, including the ones you're not interested in. This will keep your code simple and easy to read, and you can always filter out the ones you don't want afterward.
It sounds more complicated than it is. Take a swing at either the Record or Value class first, and show us what you come up with. We can keep you steered in the right direction.
-Gary-
- 04-23-2010, 05:39 AM #4
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
To analyze the text you read use this
Regular Expression LessonsIf my answer helped you. Please click my "REP" button and add a comment
Have a Good Java Coding :)
- 04-23-2010, 06:05 AM #5
Member
- Join Date
- Apr 2010
- Posts
- 2
- Rep Power
- 0
Thank you all for replying. Your help was very useful.
I could create a flat file with the relations between the Terms (GO:XXXXXX).
Example:
GO:0000001 is related to GO:0048308 and GO:0048311. GO:0000002 is related to GO:0007005...and so on.GO:0000001,GO:0048308
GO:0000001,GO:0048311
GO:0000002,GO:0007005
GO:0000003,GO:0008150
GO:0000006,GO:0005385
GO:0000007,GO:0005385
GO:0000009,GO:0000030
GO:0000010,GO:0016765
GO:0000011,GO:0007033
GO:0000011,GO:0048308
...
And I assigned an id number to each Term (GO:xxxxxx) with HashMap() like Gary suggested.
Now I must face the final problem:
I need to create a matrix that put a '1' when the Term is related to another one. So I need something like a 30,000x30,000 matrix, but this requires too much memory that I don't have.
What can I do?
Similar Threads
-
Read a file and converting this file into a string
By kostinio in forum New To JavaReplies: 7Last Post: 12-26-2009, 03:54 PM -
Read file from directory, update contents of the each file
By svpriyan in forum New To JavaReplies: 2Last Post: 05-11-2009, 10:07 AM -
how to read openproj(Projity) file i.e. ,POD file(Project Management file)
By mahendra.athneria in forum New To JavaReplies: 0Last Post: 02-11-2009, 09:53 AM -
How to read and write to a file without taking out the comments in the file
By MAGNUM in forum New To JavaReplies: 5Last Post: 02-05-2009, 10:28 AM -
How to read a text file from a Java Archive File
By Java Tip in forum Java TipReplies: 0Last Post: 02-08-2008, 09:13 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks