Hi there, I am currently doing a bioinformatics project on dynamic programming.
I need to read a text file, and extract the information in it and use the information in it for my dynamic programming java codes(both java codes must be together). May I know how to extract the information? I think I need to read the file and extract it by rows and columns.

Hi there, I am currently doing a bioinformatics project on dynamic programming.
I need to read a text file, and extract the information in it and use the information in it for my dynamic programming java codes(both java codes must be together). May I know how to extract the information? I think I need to read the file and extract it by rows and columns.

It's important to know the way you want to extract data from file which depends on processing strategy.

You can read file by each byte or read file by line/sized piece using buffered reading.

See on: InputStream, InputStreamReader, BufferedReader and choose most prefereablefor your case.

I am not sure if i get your meaning but is your data like a MYSQL format

If yes extract the rows by reading single lines in a buffer
For the columns use the string split function

Richard

There is no specific way to extract columns(that i know of), you can use the "Substring" function if all the columns are evenly spaced, or you should try and detect where the next word after the previous starts and get colums that way, there are a lot of ways to do this.

As for reading lines see what Nikelin

See on: InputStream, InputStreamReader, BufferedReader and choose most prefereablefor your case.

posted and use those methods in a loop or/until EOF is reached. this is the easy part.

Regards Krefie

Edited 6 Years Ago by Krefie: n/a

I am not sure if i get your meaning but is your data like a MYSQL format

If yes extract the rows by reading single lines in a buffer
For the columns use the string split function

Richard

Hi Richard, thanks for your reply.
I don't really get it when you said reading single lines in a buffer? What does that mean? And the string split function is it using string tokenizer?

This question has already been answered. Start a new discussion instead.