Safe Haskell | None |
---|---|
Language | Haskell2010 |
New parsers and structures for secondary structures. The structures here a strict.
TODO Parser should check if a #Vienna Secondary Structure
or #Extended Secondary Structure
precedes the entries.
Synopsis
- data SubStructure (t :: k) a
- = Unpaired {
- _label :: !a
- | Paired {
- _label :: !a
- _subStructures :: !(Vector (SubStructure t a))
- = Unpaired {
- subStructures :: forall t a t. Traversal (SubStructure t a) (SubStructure t a) (Vector (SubStructure t a)) (Vector (SubStructure t a))
- label :: forall t a. Lens' (SubStructure t a) a
- _Paired :: forall t a t. Prism (SubStructure t a) (SubStructure t a) (a, Vector (SubStructure t a)) (a, Vector (SubStructure t a))
- _Unpaired :: forall t a. Prism' (SubStructure t a) a
- newtype FullStructure (t :: k) a = FullStructure {
- _fullStructure :: Vector (SubStructure t a)
- fullStructure :: forall t a t a. Iso (FullStructure t a) (FullStructure t a) (Vector (SubStructure t a)) (Vector (SubStructure t a))
- pUnpaired :: Parser (SubStructure () ())
- pPaired :: Parser (SubStructure () ())
- pSubStructure :: Parser (SubStructure () ())
- pFullStructure :: Parser (FullStructure () ())
- newtype StructureParseError = StructureParseError String
- parseVienna :: MonadError StructureParseError m => ByteString -> m (FullStructure () ())
- toTree :: (SubStructure t a -> Maybe b) -> b -> FullStructure (t :: k) a -> Tree b
Documentation
data SubStructure (t :: k) a Source #
A completely closed sub-structure. An unpaired region .
is closed. A
paired region (r)
is closed, where r
contains arbitrarily many unpaired
and paired elements.
TODO Should be extended with Extended
, but this requires knowing which of
the ends overlap with paired: left, right, or both.
Unpaired | |
| |
Paired | |
|
Instances
subStructures :: forall t a t. Traversal (SubStructure t a) (SubStructure t a) (Vector (SubStructure t a)) (Vector (SubStructure t a)) Source #
label :: forall t a. Lens' (SubStructure t a) a Source #
_Paired :: forall t a t. Prism (SubStructure t a) (SubStructure t a) (a, Vector (SubStructure t a)) (a, Vector (SubStructure t a)) Source #
_Unpaired :: forall t a. Prism' (SubStructure t a) a Source #
newtype FullStructure (t :: k) a Source #
A full structure is composed of a number of sub-structures. The empty structure is a full structure.
FullStructure | |
|
Instances
fullStructure :: forall t a t a. Iso (FullStructure t a) (FullStructure t a) (Vector (SubStructure t a)) (Vector (SubStructure t a)) Source #
Parses a ViennaRNA secondary structure string.
pUnpaired :: Parser (SubStructure () ()) Source #
pPaired :: Parser (SubStructure () ()) Source #
pSubStructure :: Parser (SubStructure () ()) Source #
pFullStructure :: Parser (FullStructure () ()) Source #
newtype StructureParseError Source #
Instances
Show StructureParseError Source # | |
Defined in Biobase.Secondary.New showsPrec :: Int -> StructureParseError -> ShowS # show :: StructureParseError -> String # showList :: [StructureParseError] -> ShowS # |
parseVienna :: MonadError StructureParseError m => ByteString -> m (FullStructure () ()) Source #
Transform into a Tree
.
:: (SubStructure t a -> Maybe b) | how to handle substructure elements? |
-> b | The root label |
-> FullStructure (t :: k) a | The |
-> Tree b |
Transform a FullStructure
into a Tree
.
Given a full structure generated like this:
s = either (error . show) id $ parseVienna $ pack ".()(())."
a tree of just the base paired can be created with
toTree (preview (_Paired._1)) () s