Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!

# Alisha Burke

Greenhorn
since Jan 22, 2005
Cows and Likes
Cows
0
In last 30 days
0
Total given
0
Likes
0
0
Total given
0
Given in last 30 days
0
Scavenger Hunt
Ranch Hand Scavenger Hunt
Greenhorn Scavenger Hunt

## Recent posts by Alisha Burke

Hi everyone!

I am currently working on a sequence alignment program which must be able to produce the optimal alignment as well as the traceback algorithm. I have finished doing the code and was able to compiled without any errors.

However, my program is only doing half its job as it is not giving me the optimal alignment which it should. Can anyone help me with this? Thank you. I will post my code upon request. Thx.
[ January 12, 2006: Message edited by: Alisha Burke ]
14 years ago
I think this is an intermediate question so I will post my question here. I am currently in my second year course in Bioinformatics. As part of my subject requirement, I have been asked to come up with a Dynamic Programming for global alignment with traceback algorithm using Java Programming.

Right now, I have completed the first part of my program(the matrix) and its working properly. However, I have no idea on how to approach the 2nd part of the program (optimal alignment with traceback).

As my program is modeled for biologist, I would do my best to explain it in simple English terms. First off, the users must be able to enter 2 DNA sequence termed SEQUENCE 1 and SEQUENCE 2 (with no gap penalty and with linear gap penalty options imposed) include traceback algorithm.

For example: SEQUENCE 1: AAGT
SEQUENCE 2: AGT
Gap Penalty: -2
Match Score: 1 (if x=y ie AA or GG then match score is +1)
-1(if x ≠y ie AG or GT then mismatch score is -1)

Program will then produce as follows:
X A A G T
X 0-2-4-6-8
A-2 1-1-3-5
G-4-1 0 0-2
T-6-3-2-1 1

Note X stands for gap.

The second part of the program (the one that I am stuck with) is suppose to produce the optimal global alignment from the matrix.
So in this example, there are 2 optimal alignments:
A � G T - A G T
| | | and | | |
A A G T A A G T

Note: | stands for a match
- stands for a gap

How do I get the optimal global alignment is from the matrix with the traceback algorithm. Basically the traceback algorithm serves as a pointer that lead us back to the parent cells (in simple words we must find the path of choices that led to this optimal alignment)

The pointers start from the final cell (last row last column) and it follows any path back to point 0,0.
So the previous matrix must include the arrows which serves as pointers as shown below:
X A AG T
X 0 ←-2 -4-6-8
A -2 d 1←d -1-3-5
G -4 -1 0 d 0-2
T -6 -3 -2-1 d 1

Note: If arrows are pointing upwards ↑ or to the left ← means there is a gap which is
represented by a �-�
If arrows are pointing diagonally which I indicated as a d in the matrix (cant attach
a diagonal arrow) means there is a match and is represented by a � | �

So this is the part I am having problem with (traceback algorithm with the optimal alignment).

What I have thought so far:
>>Saving the pointers in each cell by using the if-statements as follows:
M[i,j] = max{M[i-1,j-1] + s(S1,S2[j]), M[i-1,j]+g, M[I,j-1] + g} ;
Initialize P[i,j]=�
If(M[i,j]==M[i-1,j-1]+s(S1[i],S2[j])) then P[i,j] = P[i,j]

If(M[i,j]==M[i-1, j]+g) then P[i,j] = P[i,j]

If(M[i,j]==M[i,j-1]+g) then P[i,j] = P[i,j]

However, as several optimal alignments may exist for a pair of sequences I am a bit lost on finding the right way to approach this problem. For example if there are two arrows branching off from one cell as you can see in the previous example (ie diagnol arrow(d) and left arrow(← , then I would firstly have to save this cell in memory, then I would have to traceback one arrow/pointer until it reaches Cell 0,0 then when that�s done I have to return again to the cell where there�s the branch off and continue to traceback the 2nd pointer until it reaches Cell 0,0.

This is quite a simplified version of the problem. There may be more than a hundred branches in the program so that�s why I would need to tackle this problem accordingly.

Hope you could give me some ideas on this�. I can attach my source code of my 1st part of the program if ask. Thank you.

I have been editing my post as the matrix and arrows are not showing properly here.... Can't seem to do anything about it though...if you have any further questions on my explanation do ask..

[ January 09, 2006: Message edited by: Alisha Burke ]
[ January 09, 2006: Message edited by: Alisha Burke ]
14 years ago
I need some help here...

Firstly, I am using a formulae to get the amount balance of money at the end of some year. The answer that i am getting is like this> \$45780.19845673344 and on and on....how do i get it like \$45780.00 only?

And is that the reason why i am getting the incorrect value of my answer?

Hope any of you here can clarify for me.
Thank you.

15 years ago
Hi Liam....

So how do i get the vote button to be just below the textfield/label (that was my main problem actually)....and using the code that you gave me how come the textfields becomes large when i maximize the window(is it suppose to be that way?)

thx
15 years ago
U mean i can't do it the traditional way?
15 years ago
Why is it so difficult to use layout managers? All i want is to put all the components in the center. My button "Vote" which is suppose to be centered and just right below the textfield is now on the left side of the label.

I've been seriously contemplating to use absolute positioning but people have been telling me its a very bad idea.

I am currently using border layout and grid layout only.

15 years ago

Assuming the text you want to change is in a textField you can change the text with setText(). Add a listener to the second/last text entry field and call a method that resets your textField with the new value. Should also be able to use setFont() to make it bold if that's what you want.

Yup yr correct about the setFont actually i've been using it the whole time but there was a bit of confusion there (as i was previously using textField and changed to textArea).....i am trying to get used to using textAreas..

And yes i have tried using setText as you can read in my post, however, its only displaying the last line of my answer....when i use append it tops up the new answer to the old ...and i only want the new answers.
15 years ago
Helloo everyone!!

Anyone out there who knows how to erase existing text with a new one. I don't think i can use something.setText("") or can I???

Basically what i did is : when a user enters 2 numbers or more the program will do the calculation and display the results. However the problem that i am facing now is when i change the numbers to a new one it will continue doing the calculation and display the results but it will add on the answer to the existing one.

I want it to erase the previous answers and display just the latest one.

I have only one button to show the answer(I tried using the ifElse statement but because there is no clear button>>its not really working as it should).

So is there any other way to automatically clear the text in the textarea(output) once the values in the textfields(input)is changed?

And is there a method to make this bold ormake anything italic without using g.setFont in graphics paint. Just curious.

15 years ago
Thanks for pointing it out to me
Wonder why i missed that in the first place :roll:
15 years ago
I agree with u Igor. This forum is the friendliest forum i have known so far can't say for the other forum where there r a lot of and

Anyway back to my question, i have made some changes to my code. Now what i did was insert the answer(in the output textarea) under the calculate method so that I can use the 'i' variable. Is this correct?....or am I just making it look worse...
[ February 19, 2005: Message edited by: Alisha Burke ]
15 years ago
Hi Liam

copy and paste :roll:

well i used to post the same question in 6 different forums. Not a very good idea though cos some ppl are members of diff forums and they'll notice (like you ) .

I stick to 2 forums now(this java ranch is my favourite)

*cheers*
15 years ago
Hi all,

I have a code which does simple multiplication like 1x2, 2x2 and so on.
Why is it that when i try to insert the result of multiplication in a "textarea" i get compilation error( I have tried using without textareas and the multiplication is going on well). I want to familiarize with textareas that's why i am testing this out. Please shed some light on this....thank you.

[ February 19, 2005: Message edited by: Alisha Burke ]

[ February 19, 2005: Message edited by: Alisha Burke ]
[ February 19, 2005: Message edited by: Alisha Burke ]
15 years ago
Goof or no goof I appreciate you helping me
15 years ago
Thanks Liam!

Its working perfectly except for the fact that the positioning of the powers is going from 0,1,2,3 to 16. And i need it backwards 16,15,14.......3,2,1,0.
I know i need to edit some parts of the code in the for loop to achieve this so I am working on it and i'll post some more if i need help.

Thankx again.
15 years ago
Hi Liam,

Appreciate it if you do not post the entire code or repost my code for that matter just parts that needs correction Thankx.
15 years ago