Package org.biojava.nbio.alignment.io
Class StockholmFileParser
- java.lang.Object
-
- org.biojava.nbio.alignment.io.StockholmFileParser
-
public class StockholmFileParser extends Object
Stockholm file parser.
for more information about the format refer to- ftp://ftp.sanger.ac.uk/pub/databases /Pfam/current_release/userman.txt.
- ftp://ftp.sanger.ac.uk/pub/databases/Rfam/CURRENT /USERMAN.
- http://sonnhammer.sbc.su.se/Stockholm.html.
Pfam DESCRIPTION OF FIELDS Compulsory fields: ------------------ AC Accession number: Accession number in form PFxxxxx.version or PBxxxxxx. ID Identification: One word name for family. DE Definition: Short description of family. AU Author: Authors of the entry. SE Source of seed: The source suggesting the seed members belong to one family. GA Gathering method: Search threshold to build the full alignment. TC Trusted Cutoff: Lowest sequence score and domain score of match in the full alignment. NC Noise Cutoff: Highest sequence score and domain score of match not in full alignment. TP Type: Type of family -- presently Family, Domain, Motif or Repeat. SQ Sequence: Number of sequences in alignment. // End of alignment. Optional fields: ---------------- DC Database Comment: Comment about database reference. DR Database Reference: Reference to external database. RC Reference Comment: Comment about literature reference. RN Reference Number: Reference Number. RM Reference Medline: Eight digit medline UI number. RT Reference Title: Reference Title. RA Reference Author: Reference Author RL Reference Location: Journal location. PI Previous identifier: Record of all previous ID lines. KW Keywords: Keywords. CC Comment: Comments. NE Pfam accession: Indicates a nested domain. NL Location: Location of nested domains - sequence ID, start and end of insert. WK Wikipedia Reference: Reference to wikipedia. Obsolete fields: ----------- AL Alignment method of seed: The method used to align the seed members. AM Alignment Method: The order ls and fs hits are aligned to the model to build the full align.
- Since:
- 3.0.5
- Author:
- Amr ALHOSSARY, Marko Vaz
-
-
Field Summary
Fields Modifier and Type Field Description static int
INFINITY
indicates reading as much as possible, without limits
-
Constructor Summary
Constructors Constructor Description StockholmFileParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StockholmStructure
parse(InputStream inStream)
parsesInputStream
and returns a the first contained alignment in aStockholmStructure
object.List<StockholmStructure>
parse(InputStream inStream, int max)
parses anInputStream
and returns at maximummax
objects contained in that file.
This method leaves the stream open for further calls ofparse(InputStream, int)
(same function) orparseNext(int)
.StockholmStructure
parse(String filename)
Parses a Stockholm file and returns aStockholmStructure
object with its content.
This function is meant to be used for single access to specific file and it closes the file after doing its assigned job.List<StockholmStructure>
parse(String filename, int max)
Parses a Stockholm file and returns aStockholmStructure
object with its content.
This function doesn't close the file after doing its assigned job; to allow for further calls ofparseNext(int)
.List<StockholmStructure>
parseNext(int max)
Tries to parse and return as maximum asmax
structures in the last used file or input stream.
Please consider calling eitherparse(InputStream)
,parse(InputStream, int)
, orparse(String, int)
before calling this function.
-
-
-
Field Detail
-
INFINITY
public static final int INFINITY
indicates reading as much as possible, without limits- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StockholmFileParser
public StockholmFileParser()
-
-
Method Detail
-
parse
public StockholmStructure parse(String filename) throws IOException, ParserException
Parses a Stockholm file and returns aStockholmStructure
object with its content.
This function is meant to be used for single access to specific file and it closes the file after doing its assigned job. Any subsequent call toparseNext(int)
will throw an exception or will function with unpredicted behavior.- Parameters:
filename
- complete(?) path to the file from where to read the content- Returns:
- stockholm file content
- Throws:
IOException
- when an exception occurred while opening/reading/closing the file+ParserException
- if unexpected format is encountered
-
parse
public List<StockholmStructure> parse(String filename, int max) throws IOException, ParserException
Parses a Stockholm file and returns aStockholmStructure
object with its content.
This function doesn't close the file after doing its assigned job; to allow for further calls ofparseNext(int)
.- Parameters:
filename
- file from where to read the content. seeInputStreamProvider
for more details.max
- maximum number of files to read,INFINITY
for all.- Returns:
- a vector of
StockholmStructure
containing parsed structures. - Throws:
IOException
- when an exception occurred while opening/reading/closing the file.ParserException
- if unexpected format is encountered- See Also:
parseNext(int)
-
parse
public StockholmStructure parse(InputStream inStream) throws ParserException, IOException
parsesInputStream
and returns a the first contained alignment in aStockholmStructure
object. Used mainly for multiple files within the same input stream, (e.g. when reading from Pfam flat files.
This method leaves the stream open for further calls ofparseNext(int)
.- Parameters:
inStream
- theInputStream
containing the file to read.- Returns:
- a
StockholmStructure
object representing file contents. - Throws:
IOException
ParserException
- See Also:
parseNext(int)
-
parse
public List<StockholmStructure> parse(InputStream inStream, int max) throws IOException
parses anInputStream
and returns at maximummax
objects contained in that file.
This method leaves the stream open for further calls ofparse(InputStream, int)
(same function) orparseNext(int)
.- Parameters:
inStream
- the stream to parsemax
- maximum number of structures to try to parse,INFINITY
to try to obtain as much as possible.- Returns:
- a
List
ofStockholmStructure
objects. If there are no more structures, an empty list is returned. - Throws:
IOException
- in case an I/O Exception occurred.- See Also:
parseNext(int)
-
parseNext
public List<StockholmStructure> parseNext(int max) throws IOException
Tries to parse and return as maximum asmax
structures in the last used file or input stream.
Please consider calling eitherparse(InputStream)
,parse(InputStream, int)
, orparse(String, int)
before calling this function.- Parameters:
max
-- Returns:
- Throws:
IOException
-
-