Results 1 to 6 of 6
  1. #1
    Shea6892 is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Help with text processing and using arrays

    So for an assignment I have to do some biology thing dealing with nucleotides and anyways I have to process text from a .txt file such as how many times the letter A would come up on the line and also how many times a sequence(for example ATG followed by numerous other 3 letter sequences) appears on the line and also have to determine if they are protein if they fall in a certain order. I am just having trouble thinking this one up altogether so any guidance is appreciated. Thanks.

    Edit: and I need to do this using the Scanner class.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: Help with text processing and using arrays

    Seeing as you ignored the three responses on your previous thread ( Help with a simple tax program ) there may not be many members who feel like helping you here.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    christopherx is offline Member
    Join Date
    Oct 2011
    Posts
    92
    Rep Power
    0

    Default Re: Help with text processing and using arrays

    Well I should hope you use the Scanner class. So, you have to look for patterns in a text file...

    Some stuff you should look up:

    StringTokenizer class.
    Scanner.next() and Scanner.nextInt()
    Regular expressions

    A combination of all those things above, with or without StringTokenizer, will help you get the solution you want.

  4. #4
    Shea6892 is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Help with text processing and using arrays

    Quote Originally Posted by DarrylBurke View Post
    Seeing as you ignored the three responses on your previous thread ( Help with a simple tax program ) there may not be many members who feel like helping you here.

    db
    Very understandable if that was the case and sorry for those who did reply and I didn't respond back I must have gotten right into it after I posted and figured it out then completely forgot, so I am sorry for those who responded to get no reply from me.

    Christopherx thanks I will look deeper into what you suggest but i think it is more an issue of using arrays and how I can get the charAt() to count the number of A's and other letters along with grouping sequences of 3 letters together and counting how many times they occur and the order of them.

  5. #5
    christopherx is offline Member
    Join Date
    Oct 2011
    Posts
    92
    Rep Power
    0

    Default Re: Help with text processing and using arrays

    Quote Originally Posted by Shea6892 View Post
    Christopherx thanks I will look deeper into what you suggest but i think it is more an issue of using arrays and how I can get the charAt() to count the number of A's and other letters along with grouping sequences of 3 letters together and counting how many times they occur and the order of them.
    Okay. the number of A's in an array is a subset of the elements in the Array. That is:

    SETA{A} is a member of ARRAY{A-Z}. So, I suggest a for-each loop to cycle through every value. Or a for loop, if you want to have the pointer. Then just write some if statements such that, If you see a certain letter, you initiate the search for a certain pattern, if it fails then move onto the next search. This, filter like system will help process each individual letter as it comes through.

  6. #6
    Shea6892 is offline Member
    Join Date
    Jan 2012
    Posts
    6
    Rep Power
    0

    Default Re: Help with text processing and using arrays

    Quote Originally Posted by christopherx View Post
    Okay. the number of A's in an array is a subset of the elements in the Array. That is:

    SETA{A} is a member of ARRAY{A-Z}. So, I suggest a for-each loop to cycle through every value. Or a for loop, if you want to have the pointer. Then just write some if statements such that, If you see a certain letter, you initiate the search for a certain pattern, if it fails then move onto the next search. This, filter like system will help process each individual letter as it comes through.
    Yeah okay thanks a lot guys I think I have everything working correctly now. Good looks on the help I needed it.

Similar Threads

  1. Seeking examples of text processing code
    By theordore in forum New To Java
    Replies: 13
    Last Post: 05-24-2011, 11:45 AM
  2. image processing
    By rohankapoor in forum New To Java
    Replies: 4
    Last Post: 03-01-2011, 06:35 AM
  3. text file into arrays using StreamTokenizer
    By Spooge in forum New To Java
    Replies: 6
    Last Post: 10-19-2010, 12:35 AM
  4. Arrays.sort... why sorting all arrays in class?
    By innspiron in forum New To Java
    Replies: 6
    Last Post: 03-23-2010, 01:40 AM
  5. Processing help
    By menez in forum Java Applets
    Replies: 3
    Last Post: 02-23-2010, 02:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •