- Joined
- Apr 26, 2004
- Location
- The Netherlands
Well hello, yet another programming language for me to learn but i like it alot.
I need to write a java program that takes input in the form of a string of single-letter amino acid ID's, makes sure they are all capitals, then converts it to the triple letter equivalent and finds the relevant hydrophobicity.
So for example, if i put in aa, it should return "ALA ALA" and "+ +" Because A stands for alanine and it is hydrophobic.
(using a separate class 'Translator' to do the conversions, hence the method calls)
This code works fine for single translations but as soon as the input is more then one character it won't work. I need to perform it on a string like 'aghrn', so i need to break down the string into its separate characters, but how do i do that? In python you can go string and it will display the character at location i, but java starts whining about it needing to be an array So, how can i break a string up into it's separate characters?
The program (consisting of 2 classes) can be found at http://www.openopinion.com/Testing/uploader/files/7/Translator.txt and http://www.openopinion.com/Testing/uploader/files/7/Vink6.txt
I need to write a java program that takes input in the form of a string of single-letter amino acid ID's, makes sure they are all capitals, then converts it to the triple letter equivalent and finds the relevant hydrophobicity.
So for example, if i put in aa, it should return "ALA ALA" and "+ +" Because A stands for alanine and it is hydrophobic.
Code:
public void actionPerformed(ActionEvent event) {
String text = textField1.getText();
text = Translator.uppercase(text);
x = Translator.one2three(text);
textField2.setText(x);
y = Translator.one2hydro(text);
textField3.setText(y);
(using a separate class 'Translator' to do the conversions, hence the method calls)
This code works fine for single translations but as soon as the input is more then one character it won't work. I need to perform it on a string like 'aghrn', so i need to break down the string into its separate characters, but how do i do that? In python you can go string and it will display the character at location i, but java starts whining about it needing to be an array So, how can i break a string up into it's separate characters?
The program (consisting of 2 classes) can be found at http://www.openopinion.com/Testing/uploader/files/7/Translator.txt and http://www.openopinion.com/Testing/uploader/files/7/Vink6.txt
Last edited: