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 intINFINITYindicates 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 StockholmStructureparse(InputStream inStream)parsesInputStreamand returns a the first contained alignment in aStockholmStructureobject.List<StockholmStructure>parse(InputStream inStream, int max)parses anInputStreamand returns at maximummaxobjects contained in that file.
This method leaves the stream open for further calls ofparse(InputStream, int)(same function) orparseNext(int).StockholmStructureparse(String filename)Parses a Stockholm file and returns aStockholmStructureobject 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 aStockholmStructureobject 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 asmaxstructures 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 aStockholmStructureobject 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 aStockholmStructureobject 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. seeInputStreamProviderfor more details.max- maximum number of files to read,INFINITYfor all.- Returns:
- a vector of
StockholmStructurecontaining 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
parsesInputStreamand returns a the first contained alignment in aStockholmStructureobject. 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- theInputStreamcontaining the file to read.- Returns:
- a
StockholmStructureobject representing file contents. - Throws:
IOExceptionParserException- See Also:
parseNext(int)
-
parse
public List<StockholmStructure> parse(InputStream inStream, int max) throws IOException
parses anInputStreamand returns at maximummaxobjects 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,INFINITYto try to obtain as much as possible.- Returns:
- a
ListofStockholmStructureobjects. 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 asmaxstructures 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
-
-