arrayList in a while loop
I got a little bit of code I am kinda stuck with.
I got this arrayList where we stored a fasta file.
Code:
Fasta file example:
>seq1
guguurguorgungun
ionjlimlmo
>seq2
jjkliuihlni
>seq3
ppokkpdgstdcbch
mdhdgsvtxtgsgwd
jdbuydfyhedgy
Now I would like to make a while loop where he constantly takes the next >seq... (and the lines below) and do something with it.
But the problem is, how do I get it to take the next >seq...
I was thinking of letting it count++;
But overall, how can I find a certain ietm in the arrayList? (Like this ">")
I don't know if indexOf would help?
Re: arrayList in a while loop
Quote:
how can I find a certain ietm in the arrayList? (Like this ">")
If the ArrayList contains String objects, then you should be able to find the String: ">"
But if the '>' is embedded in a longer String or class, you will have to get each object in the list and look in the object's contents.
Re: arrayList in a while loop
We now made a function getProtein. And what getProtein does is he takes every >seq and the lines below.
Now the idea was something like this:
int count = 0;
// Do something to continue to the next with getProtein function (>seq2 etc.)
count++;
Do you maybe have any idea on this one?
Like how to get the next >seq...
Re: arrayList in a while loop
Quote:
Like how to get the next >seq...
To look at the contents of a String you could use the indexOf() method.