FAQs: Difference between revisions

From Jstacs
Jump to navigationJump to search
No edit summary
No edit summary
Line 7: Line 7:
<p>
<p>
'''Q: Why shall I use the [http://www.jstacs.de/api/de/jstacs/data/AlphabetContainer.html AlphabetContainer] and not just a simple [http://www.jstacs.de/api/de/jstacs/data/Alphabet.html Alphabet] instance?'''<br />
'''Q: Why shall I use the [http://www.jstacs.de/api/de/jstacs/data/AlphabetContainer.html AlphabetContainer] and not just a simple [http://www.jstacs.de/api/de/jstacs/data/Alphabet.html Alphabet] instance?'''<br />
'''A:''' Because for some data you will not have the same alphabet at each position of the sequence, e.g. when using phenotypic data. Hence, we also strongly recomend to always use [http://www.jstacs.de/api/de/jstacs/data/AlphabetContainer.html#getAlphabetLengthAt(int) getAlphabetLengthAt(int)] when setting e.g. the size of an array.
'''A:''' Because for some data you will not have the same alphabet at each position of the sequence, e.g. when using phenotypic data. Hence, we also strongly recommend to always use [http://www.jstacs.de/api/de/jstacs/data/AlphabetContainer.html#getAlphabetLengthAt(int) getAlphabetLengthAt(int)] when setting e.g. the size of an array.
</p>
</p>
<hr />
<hr />
<p>
'''Q: How can I create a simple sequence?'''<br />
'''A:''' Try to use the [http://www.jstacs.de/api/de/jstacs/data/Sequence.html#create(de.jstacs.data.AlphabetContainer,%20java.lang.String) create method] of [http://www.jstacs.de/api/de/jstacs/data/Sequence.html Sequence], e.q. Sequence.create( new AlphabetContainer( new DNAAlphabet() ), "ACGTACGT" );
</p>
<hr />
<p>
'''''Q: How can I load my own data?'''''<br />
'''A: If your sequences are stored either in plain text or in FastA format, you can directly [http://www.jstacs.de/api/de/jstacs/data/Sample.html#Sample(de.jstacs.data.AlphabetContainer,%20de.jstacs.io.StringExtractor,%20java.lang.String) create] a new [http://www.jstacs.de/api/de/jstacs/data/Sample.html Sample] from the file.
</p>
<p>


'''''Q: How can I create a simple sequence?'''''<br>
</p>
'''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?'''''<br>
'''A: '''
 
'''''Q: How can store and load my model, classifier, ...?'''''<br>
'''''Q: How can store and load my model, classifier, ...?'''''<br>
'''A:''' ''All classes that implement Storable should have a method toXML() that returns a StringBuffer containing the instance as [http://en.wikipedia.org/wiki/XML 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.''
'''A:''' ''All classes that implement Storable should have a method toXML() that returns a StringBuffer containing the instance as [http://en.wikipedia.org/wiki/XML 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.''

Revision as of 11:21, 7 September 2008

Handling data

Q: How do I 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?
A: Because for some data you will not have the same alphabet at each position of the sequence, e.g. when using phenotypic data. Hence, we also strongly recommend to always use getAlphabetLengthAt(int) when setting e.g. the size of an array.


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: If your sequences are stored either in plain text or in FastA format, you can directly create a new Sample from the file.

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.

Q: The class UserTime does not work! Why?
A: The class UserTime uses native code. Therefore there are at least two possibilities:
A1: You have forgotten to set the Java library path: -Djava.library.path=...
A2: You have to compile the native code on your system.