FAQs: Difference between revisions

From Jstacs
Jump to navigationJump to search
(New page: == FAQs & Code examples == Here we collected some questions that were asked quite often ... '''''Q: How to create an AlphabetContainer instance for DNA sequences?'''''<br> '''A:''' ''Alp...)
 
No edit summary
Line 7: Line 7:


'''''Q: Why shall I use the AlphabetContainer and not just a simple Alphabet instance in the models, ...?'''''<br>
'''''Q: Why shall I use the AlphabetContainer and not just a simple Alphabet instance in the models, ...?'''''<br>
'''A:''' ''Because for some data you will have not the same alphabet at each position of the sequence, e.g. for phenotypic data, ...''
'''A:''' ''Because for some data you will not have the same alphabet at each position of the sequence, e.g. for phenotypic data, ...''


'''''Q: How can I create a simple sequence?'''''<br>
'''''Q: How can I create a simple sequence?'''''<br>

Revision as of 15:46, 4 September 2008

FAQs & Code examples

Here we collected some questions that were asked quite often ...

Q: How to create an AlphabetContainer instance for DNA sequences?
A: AlphabetContainer container = new AlphabetContainer( new DNAAlphabet() );

Q: Why shall I use the AlphabetContainer and not just a simple Alphabet instance in the models, ...?
A: Because for some data you will not have the same alphabet at each position of the sequence, e.g. for phenotypic data, ...

Q: How can I create a simple sequence?
A: Try to use the create method of Sequence, e.q. Sequence.create( new AlphabetContainer( new DNAAlphabet() ), "ACGTACGT" );

Q: How can I load my own data?
A: JAN ...

Q: How can store and load my model, classifier, ...?
A: All classes that implement Storable should have a method toXML() that returns a StringBuffer containing the instance as XML. Furthermore, such classes should have a proper constructor with a single argument StringBuffer. This can be used to create a new instance form a StringBuffer that contains an instance as XML. In addition, The class FileManger allows to read and write StringBuffer to the hard drive.

Q: Why does Jstacs use XML to save instances?
A: Because it is human readable.