|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcompbio.data.sequence.FastaReader
public class FastaReader
Reads files with FASTA formatted sequences. All the information in the FASTA header is preserved including trailing white spaces. All the white spaces are removed from the sequence. Examples of the correct input:
>zedpshvyzg GCQDKNNIAELNEIMGTTRSPSDWQHMKGASPRAEIGLTGKKDSWWRHCCSKEFNKTPPPIHPDMKRWGWMWNRENFEKFLIDNFLNPPCPRLMLTKGTWWRHEDLCHEIFWSTLRWLCLGNQSFSAMIWGHLCECHRMIWWESNEHMFWLKFRRALKKMNSNGPCMGPDNREWMITNRMGKEFCGPAFAGDCQSCWRKCHKTNKICFNEKKGTPTKIDHEQKDIMDILKDIDNHRNWKQCQLWLLTSKSTDQESTTMLTWSTWRDFFIIIKQPFDHKCRGALDANGDFQIAAELKWPAPMIILRQNQKTMHDKSCHHFFTNRCPLMHTTRANDKQCSWHTRKQFICQQDFTTWQHRPDTHRILPSWCMSTRRKNHIKNTPALAFSTCEMGDLPNGWAPGTIILQRQFTQAIKLPQETTGWPRCDPKFDHWNMSKWLRQLLGRDDEMIPPQCD >xovkactesa CPLSKWWNRRAFLSHTANHWMILMTWEGPHDGESKMRIAMMKWSPCKPTMSHFRCGLDAWAEPIRQIACESTFRM FCTTPRPIHKLTEMWGHMNGWTGAFCRQLECEWMMPPRHPHPCTSTFNNNKKRLIGQIPNEGKQLFINFQKPQHG FSESDIWIWKDNPTAWHEGLTIAGIGDGQHCWNWMPMPWSGAPTSNALIEFWTWLGMIGTRCKTQGMWWDAMNHH DQFELSANAHIAAHHMEKKMILKPDDRNLGDDTWMPPGKIWMRMFAKNTNACWPEGCRDDNEEDDCGTHNLHRMC >ntazzewyvv CGCKIF D D NMKDNNRHG TDIKKHGFMH IRHPE KRDDC FDNHCIMPKHRRWGLWD EASINM AQQWRSLPPSRIMKLNG HGCDCMHSHMEAD DTKQSGIKGTFWNG HDAQWLCRWG EFITEA WWGRWGAITFFHAH ENKNEIQECSDQNLKE SRTTCEIID TCHLFTRHLDGW RCEKCQANATHMTW ACTKSCAEQW FCAKELMMN W KQMGWRCKIFRKLFRDNCWID FELPWWPICFCCKGLSTKSHSAHDGDQCRRW WPDCARDWLGPGIRGEF FCTHICQQLQRNFWCGCFRWNIEKRMFEIFDDNMAAHWKKCMHFKFLIRIHRHGPITMKMTWCRSGCCFGKTRRLPDSSFISAFLDPKHHRDGSGMMMWSSEMRSCAIPDPQQAWNQGKWIGQIKDWNICFAWPIRENQQCWATPHEMPSGFHFILEKWDALAHPHMHIRQKKCWAWAFLSLMSSTHSDMATFQWAIPGHNIWSNWDNIICGWPRI > 12 d t y wi k jbke KLSHHDCD N H HSKCTEPHCGNSHQMLHRDP CCDQCQSWEAENWCASMRKAILF
Constructor Summary | |
---|---|
FastaReader(java.io.InputStream inputStream)
This class will not close the incoming stream! So the client should do so. |
|
FastaReader(java.lang.String inputFile)
Header data can contain non-ASCII symbols and read in UTF8 |
Method Summary | |
---|---|
void |
close()
Call this method to close the connection to the input file if you want to free up the resources. |
boolean |
hasNext()
|
FastaSequence |
next()
Reads the next FastaSequence from the input |
void |
remove()
Not implemented |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FastaReader(java.lang.String inputFile) throws java.io.FileNotFoundException
inputFile
- the file containing the list of FASTA formatted sequences to
read from
java.io.FileNotFoundException
- if the input file is not found
java.lang.IllegalStateException
- if the close method was called on this instancepublic FastaReader(java.io.InputStream inputStream) throws java.io.FileNotFoundException
inputStream
-
java.io.FileNotFoundException
Method Detail |
---|
public boolean hasNext()
hasNext
in interface java.util.Iterator<FastaSequence>
java.lang.IllegalStateException
- if the close method was called on this instancepublic FastaSequence next()
next
in interface java.util.Iterator<FastaSequence>
java.lang.AssertionError
- if the header or the sequence is missing
java.lang.IllegalStateException
- if the close method was called on this instancepublic void remove()
remove
in interface java.util.Iterator<FastaSequence>
public void close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |