Julia-emacs: Julia Support in Emacs

julia-mode

Emacs major mode for the Julia programming language.

Installation

Installing from MELPA

Unless you want to develop this package, it is recommended that you use it from MELPA:

Enable the MELPA repository.

Enable the package by adding these lines to to your Emacs init file, e.g., ~/.emacs:

(package-install 'julia-mode)
(require 'julia-mode)

Installing from Source

To get the latest version of julia-mode, clone this repository and then use:

(add-to-list 'load-path "<path-to-julia-mode>")
(require 'julia-mode)

Contributing

Contributions are welcome, in the form of pull requests.

We do our best to provide feedback within 2 weeks. Feel free bump the PR thread with a comment after that.

Submitting Pull Requests

Do add unit tests whenever possible. Consider breaking functions into an interface and a backend function for convenient testing.

Do add a short summary in the Unreleased section of the CHANGELOG.

Do use the rx macro (S-expressions) whenever rewriting regular expressions or introducing new ones. This keeps the code much more readable.

Working With Tests

It's easy to add new ERT tests to the julia-mode test suite.

You only need to prepare a new ert-deftest definition in julia-mode-tests.el.

You can run the test suite from the command line with:

emacs -batch -L . -l ert -l julia-mode-tests.el -f  ert-run-tests-batch-and-exit

Download Details:

Author: JuliaEditorSupport
Source Code: https://github.com/JuliaEditorSupport/julia-emacs 
License: View license

#julia #emacs #language 

Julia-emacs: Julia Support in Emacs

A Julia Language Support Package for The Atom Editor

Julia Grammar

Julia grammar definition for Atom, VSCode, and GitHub.

The source of truth in this repo is grammars/julia.cson; julia.json and julia_vscode.json are automatically generated in a pre-commit hook.

Atom

Also an Atom package to provide Julia syntax highlighting, snippets, and docstring folding. Originally based off of JuliaLang/julia.tmBundle, merged with new ideas from language-julia.

Features:

  • Syntax highlighting
  • Snippets for common Julia keywords and constructs (see snippets/language-julia.cson)
  • Toggle folding of docstrings

Installation

Installation happens normally either through apm install language-julia or through the install section of the settings tab within Atom.

Note: if you already have a different version of language-julia plugin installed (e.g. this one), you would need to remove it first using apm uninstall language-julia

Recommended Extras

  • The LaTeX Completions package provides support for unicode characters similarly to the Julia REPL.
  • The Indent Detective package will help you keep to the style guidelines when working on Base or packages.
  • Install language-markdown for syntax highlighting in docstrings.
  • Install atom-language-r for syntax highlighting of R string macros.

Toggling docstrings

Two Atom commands are provided to toggle all docstrings or the docstring under the cursor: language-julia:toggle-docstrings and language-julia:toggle-all-docstrings. These are not assigned keys. Here is one example of adding these to keymaps using org-mode style keys:

'atom-text-editor[data-grammar="source julia"]:not([mini])':
  'tab':       'language-julia:toggle-docstrings'
  'shift-tab': 'language-julia:toggle-all-docstrings'

Contributing

We love contributors. Here are the steps we have taken to develop on this package:

  1. Remove the official install of the package: apm uninstall language-julia
  2. Clone the repository somewhere we can remember: git clone git@github.com:JuliaEditorSupport/atom-language-julia.git
  3. Link the cloned package to ~/.atom (enter the following from the root of the repo directory): apm link .
  4. Hack away!

When new features are added, you should write specs to show that the package is behaving as expected. To run the specs you need to do the following:

  • Make sure you have the library's folder open in the current atom project.
  • Then open the command pallete and select Window: Run package specs. On OSX this key-binding is ctrl+cmd+option+p.

This should open up a new window with the spec results.

Contributor list

Download Details:

Author: JuliaEditorSupport
Source Code: https://github.com/JuliaEditorSupport/atom-language-julia 
License: View license

#julia #language #atom 

A Julia Language Support Package for The Atom Editor

Educational Material and Tutorials for The Turing Language

Turing Tutorials 

This repository contains tutorials on the universal probabilistic programming language Turing.

The tutorials are defined in the tutorials folder. All the outputs are generated automatically from that.

Additional educational materials can be found at StatisticalRethinkingJulia/TuringModels.jl, which contains Turing adaptations of models from Richard McElreath's Statistical Rethinking. It is a highly recommended resource if you are looking for a greater breadth of examples.

Interactive Notebooks

To run the tutorials interactively via Jupyter notebooks, install the package and open the tutorials like:

# Install TuringTutorials
using Pkg
pkg"add https://github.com/TuringLang/TuringTutorials"

# Generate notebooks in subdirectory "notebook"
using TuringTutorials
TuringTutorials.weave(; build=(:notebook,))

# Start Jupyter in "notebook" subdirectory
using IJulia
IJulia.notebook(; dir="notebook")

You can weave the notebooks to a different folder with

TuringTutorials.weave(; build=(:notebook,), out_path_root="my/custom/directory")

Then the notebooks will be generated in the folder my/custom/directory/notebook and you can start Jupyter with

IJulia.notebook(; dir="my/custom/directory/notebook")

Contributing

First of all, make sure that your current directory is TuringTutorials. All of the files are generated from the jmd files in the tutorials folder. So to change a tutorial, change one of the .jmd file in the tutorials folder.

To run the generation process, do for example:

using TuringTutorials
TuringTutorials.weave("00-introduction", "00_introduction.jmd")

To generate all files do:

TuringTutorials.weave()

If you add new tutorials which require new packages, simply updating your local environment will change the project and manifest files. When this occurs, the updated environment files should be included in the PR.

Credits

The structure of this repository is mainly based on SciMLTutorials.jl.

Download Details:

Author: TuringLang
Source Code: https://github.com/TuringLang/TuringTutorials 
License: MIT license

#julia #machinelearning #language 

Educational Material and Tutorials for The Turing Language

CommonMark.jl: A CommonMark-compliant Parser for Julia

CommonMark

A CommonMark-compliant parser for Julia. 

Interface

using CommonMark

Create a markdown parser with the default CommonMark settings and then add footnote syntax to our parser.

parser = Parser()
enable!(parser, FootnoteRule())

Parse some text to an abstract syntax tree from a String:

ast = parser("Hello *world*")

Parse the contents of a source file:

ast = open(parser, "document.md")

Write ast to a string.

body = html(ast)
content = "<head></head><body>$body</body>"

Write to a file.

open("file.tex", "w") do file
    latex(file, ast)
    println(file, "rest of document...")
end

Or write to a buffer, such as stdout.

term(stdout, ast)

Output Formats

Supported output formats are currently:

  • html
  • latex
  • term: colourised and Unicode-formatted for display in a terminal.
  • markdown
  • notebook: Jupyter notebooks.

Extensions

Extensions can be enabled using the enable! function and disabled using disable!.

Typography

Convert ASCII dashes, ellipses, and quotes to their Unicode equivalents.

enable!(parser, TypographyRule())

Keyword arguments available for TypographyRule are

  • double_quotes
  • single_quotes
  • ellipses
  • dashes

which all default to true.

Admonitions

enable!(parser, AdmonitionRule())

Front matter

Fenced blocks at the start of a file containing structured data.

+++
[heading]
content = "..."
+++

The rest of the file...

The block must start on the first line of the file. Supported blocks are:

  • ;;; for JSON
  • +++ for TOML
  • --- for YAML

To enable provide the FrontMatterRule with your choice of parsers for the formats:

using JSON
enable!(parser, FrontMatterRule(json=JSON.Parser.parse))

You can access front matter from a parsed file using frontmatter. As follows.

ast = open(parser, "document.md")
meta = frontmatter(ast)

Footnotes

enable!(parser, FootnoteRule())

Math

Julia-style inline and display maths:

Some ``\LaTeX`` math:

```math
f(a) = \frac{1}{2\pi}\int_{0}^{2\pi} (\alpha+R\cos(\theta))d\theta
```

Enabled with:

enable!(parser, MathRule())

Dollar-style inline and display math is also available using

enable!(parser, DollarMathRule())

Supported syntax:

  • single dollar signs surrounding inline math,
  • double dollars surrounding a single line paragraph for display math.

For more complex math, such as multiline display math, use the literal block syntax available with MathRule().

Tables

Pipe-style tables, similar to GitHub's tables. Literal | characters that are not wrapped in other syntax such as * must be escaped with a backslash. The number of columns in the table is specified by the second line.

| Column One | Column Two | Column Three |
|:---------- | ---------- |:------------:|
| Row `1`    | Column `2` |              |
| *Row* 2    | **Row** 2  | Column ``|`` |

Rows with more cells than specified have the trailing cells discarded, and rows with less cells are topped up with empty cells.

Enabled with:

enable!(parser, TableRule())

Raw Content

Overload literal syntax to support passing through any type of raw content.

enable!(parser, RawContentRule())

By default RawContentRule will handle inline and block content in HTML and LaTeX formats.

This is raw HTML: `<img src="myimage.jpg">`{=html}.

And here's an HTML block:

```{=html}
<div id="main">
 <div class="article">
```
```{=latex}
\begin{tikzpicture}
\draw[gray, thick] (-1,2) -- (2,-4);
\draw[gray, thick] (-1,-1) -- (2,2);
\filldraw[black] (0,0) circle (2pt) node[anchor=west] {Intersection point};
\end{tikzpicture}
```

This can be used to pass through different complex content that can't be easily handled by CommonMark natively without any loss of expressiveness.

Custom raw content handlers can also be passed through when enabling the rule. The naming scheme is <format>_inline or <format>_block.

enable!(p, RawContentRule(rst_inline=RstInline))

The last example would require the definition of a custom RstInline struct and associated display methods for all supported output types, namely: html, latex, and term. When passing your own keywords to RawContentRule the defaults are not included and must be enabled individually.

Attributes

Block and inline nodes can be tagged with arbitrary metadata in the form of key/value pairs using the AttributeRule extension.

enable!(p, AttributeRule())

Block attributes appear directly above the node that they target:

{#my_id color="red"}
# Heading

This will attach the metadata id="my_id" and color="red" to # Heading.

Inline attributes appear directly after the node that they target:

*Some styled text*{background="green"}.

Which will attach metadata background="green" to the emphasised text Some styled text.

CSS-style shorthand syntax #<name> and .<name> are available to use in place of id="<name>" and class="name". Multiple classes may be specified sequentially.

AttributeRule does not handle writing metadata to particular formats such as HTML or LaTeX. It is up to the implementation of a particular writer format to make use of available metadata itself. The built-in html and latex outputs make use of included attributes. html will include all provided attributes in the output, while latex makes use of only the #<id> attribute.

Citations

Use the following to enable in-text citations and reference list generation:

enable!(p, CitationRule())

Syntax for citations is similar to what is offered by Pandoc. Citations start with @.

Citations can either appear in square brackets [@id], or they can be written as
part of the text like @id. Bracketed citations can contain more than one
citation; separated by semi-colons [@one; @two; and @three].

{#refs}
# References

A reference section that will be populated with a list of all references can be marked using a {#refs} attribute from AttributeRule at the toplevel of the document. The list will be inserted after the node, in this case # References.

Citations and reference lists are formatted following the Chicago Manual of Style. Styling will, in future versions, be customisable using Citation Style Language styles.

The reference data used for citations must be provided in a format matching CSL JSON. Pass this data to CommonMark.jl when writing an AST to a output format.

html(ast, Dict{String,Any}("references" => JSON.parsefile("references.json")))

CSL JSON can be exported easily from reference management software such as Zotero or generated via pandoc-citeproc --bib2json or similar. The references data can be provided by the front matter section of a document so long as the FrontMatterRule has been enabled, though this does require writing your CSL data manually.

Note that the text format of the reference list is not important, and does not have to be JSON data. So long as the shape of the data matches CSL JSON it is valid. Below we use YAML references embedded in the document's front matter:

---
references:
- id: abelson1996
  author:
    - family: Abelson
      given: Harold
    - family: Sussman
      given: Gerald Jay
  edition: 2nd Editon
  event-place: Cambridge
  ISBN: 0-262-01153-0
  issued:
    date-parts:
      - - 1996
  publisher: MIT Press/McGraw-Hill
  publisher-place: Cambridge
  title: Structure and interpretation of computer programs
  type: book
---

Here's a citation [@abelson1996].

{#refs}
# References

Auto Identifiers

Headings within a document can be assigned ids automatically using

enable!(p, AutoIdentifierRule())

Identifiers are determined with CommonMark.slugify, which is based on the algorithm used by Pandoc. Non-unique identifiers are suffixed with a numeric counter and so cannot be considered stable. If you need stable identifiers then you should use AttributeRule to assign stable ids manually.

CommonMark Defaults

Block rules enabled by default in Parser objects:

  • AtxHeadingRule()
  • BlockQuoteRule()
  • FencedCodeBlockRule()
  • HtmlBlockRule()
  • IndentedCodeBlockRule()
  • ListItemRule()
  • SetextHeadingRule()
  • ThematicBreakRule()

Inline rules enabled by default in Parser objects:

  • AsteriskEmphasisRule()
  • AutolinkRule()
  • HtmlEntityRule()
  • HtmlInlineRule()
  • ImageRule()
  • InlineCodeRule()
  • LinkRule()
  • UnderscoreEmphasisRule()

These can all be disabled using disable!. Note that disabling some parser rules may result in unexpected results. It is recommended to be conservative in what is disabled.

Note

Until version 1.0.0 the rules listed above are subject to change and should be considered unstable regardless of whether they are exported or not.

Writer Configuration

When writing to an output format configuration data can be provided by:

  • passing a Dict{String,Any} to the writer method,
  • front matter in the source document using the FrontMatterRule extension.

Front matter takes precedence over the passed Dict.

Notable Variables

Values used to determine template behaviour:

template-engine::Function Used to render standalone document templates.

No default is provided by this package. The template-engine function should follow the interface provided by Mustache.render. It is recommended to use Mustache.jl to provide this functionalilty.

Syntax for opening and closing tags used by CommonMark.jl is ${...}. See the templates in src/writers/templates for usage examples.

<format>.template.file::String Custom template file to use for standalone <format>.

<format>.template.string::String Custom template string to use for standalone <format>.

Generic variables that can be included in templates to customise documents:

abstract::String Summary of the document.

authors::Vector{String} Vector of author names.

date::String Date of file generation.

keywords::Vector{String} Vector of keywords to be included in the document metadata.

lang::String Language of the document.

title::String Title of the document.

subtitle::String Subtitle of the document.

Format-specific variables that should be used only in a particular format's template. They are namespaced to avoid collision with other variables.

html

html.css::Vector{String} Vector of CSS files to include in document.

html.js::Vector{String} Vector of JavaScript files to include in document.

html.header::String String content to add at end of <head>.

html.footer::String String content to add at end of <body>.

latex

latex.documentclass::String Class file to use for document. Default is article.

latex.preamble::String String content to add directly before \begin{document}.

The following are automatically available in document templates.

body::String Main content of the page.

curdir::String Current directory.

outputfile::String Name of file that is being written to. When writing to an in-memory buffer this variable is not defined.

Download Details:

Author: MichaelHatherly
Source Code: https://github.com/MichaelHatherly/CommonMark.jl 
License: View license

#julia #markdown #language 

CommonMark.jl: A CommonMark-compliant Parser for Julia

Suppressor.jl: Julia Macros for Suppressing and/or Capturing Output

Suppressor   

Julia macros for suppressing and/or capturing output (stdout), warnings (stderr) or both streams at the same time.

Installation

julia> Pkg.add("Suppressor")

Usage

julia> using Suppressor

julia> using Compat: @warn  # on 0.6

julia> @suppress begin
           println("This string doesn't get printed!")
           @warn("This warning is ignored.")
       end

julia> @suppress_out begin
           println("This string doesn't get printed!")
           @warn("This warning is important")
       end
┌ Warning: This warning is important
└ @ Main REPL[4]:3

julia> @suppress_err begin
           println("This string gets printed!")
           @warn("This warning is unimportant")
       end
This string gets printed!

julia> @suppress begin
           println("This string doesn't get printed!")
           @warn("This warning is ignored.")
           error("Remember that errors are still printed!")
       end
ERROR: Remember that errors are still printed!

The suppress macros return whatever the given expression returns, but Suppressor also provides @capture_out and @capture_err macros that work similiarly to their @suppress_ cousins except they return any output as a string:

julia> output = @capture_out begin
    println("should get captured, not printed")
end;

julia> output == "should get captured, not printed\n"
true

julia> output = @capture_err begin
    @warn("should get captured, not printed")
end;

julia> output[1:56] == "┌ Warning: should get captured, not printed\n└ @ Main"
true

NOTE: the following example only works on Julia 0.6; on later versions of Julia the color codes are never captured

Often when capturing output for test purposes it's useful to control whether color is enabled or not, so that you can compare with or without the color escape characters regardless of whether the julia process has colors enabled or disabled globally. You can use the @color_output macro for this:

@color_output false begin
    output = @capture_err begin
        warn("should get captured, not printed")
    end
end
@test output == "WARNING: should get captured, not printed\n"

@color_output true begin
    output = @capture_err begin
        warn("should get captured, not printed")
    end
end
@test output == "\e[1m\e[33mWARNING: \e[39m\e[22m\e[33mshould get captured, not printed\e[39m\n"

Variable Scope

The macros in Suppressor.jl need to wrap the given expression in a try...finally block to make sure that everything is cleaned up correctly. This means that any variables introduced within the macro expression aren't in-scope afterwards. To work around this you can use local to introduce the variable before the block, for example:

local x
output = @capture_out x = loudfunction()
println(x) # x is available here

Download Details:

Author: JuliaIO
Source Code: https://github.com/JuliaIO/Suppressor.jl 
License: View license

#julia #language 

Suppressor.jl: Julia Macros for Suppressing and/or Capturing Output

OpenBF: 1D Blood Flow Model

openBF.jl

openBF is an open-source 1D blood flow solver based on MUSCL finite-volume numerical scheme, written in Julia and released under Apache 2.0 free software license.

Docs

  • openBF ≦v0.6.3 check this website for documentation and tutorials.
  • openBF v0.7+ docs can be built as julia make.jl inside the docs/ folder (this requires Documenter package).

Installation

Provided you already have a Julia v1.x installation (all platforms download and Windows instructions), you can add openBF as

julia> ]
(v1.x) pkg> add https://github.com/INSIGNEO/openBF

update it as

julia> ]
(v1.x) pkg> update openBF

test it as

julia> ]
(v1.x) pkg> test openBF

and use it as

julia> using openBF
julia> openBF.runSimulation("<input file name>.yml")

You can also create (MacOSX/Linux only) an openBF alias as

$ echo "alias openBF='cp ~/.julia/v1.x/openBF/main.jl ./main.jl && julia main.jl $1'" >> ~/.bashrc
$ source ~/.bashrc
$ openBF -h
usage: main.jl [-v] [-f] [-c] [-h] input_filename

positional arguments:
  input_filename   .yml input file name

optional arguments:
  -v, --verbose    Print STDOUT - default false
  -f, --out_files  Save complete results story rather than only the
                   last cardiac cycle
  -c, --conv_ceil  Ceil convergence value to 100 mmHg (default true)
  -h, --help       show this help message and exit

Example

project name: <project name>
results folder: <path/to/your/results/directory>

blood:
  rho: 1060.0 # density
  mu: 4.e-3   # kinematic viscosity

solver:
  Ccfl: 0.9   # Courant number
  cycles: 100 # max number of cardiac cycles
  jump: 100
  convergence tolerance: 15.0 # convergence min error threshold

network:
  - label: <vessel name>
    sn: 1
    tn: 2
    E: 400000 # Young's modulus
    L: 0.04   # length
    R0: 0.012 # lumen radius
    inlet number: 1
    inlet: Q
    inlet file: <inlet filename>
  - label: <vessel name>
      sn: 2
    tn: 3
    E: 400000
    L: 0.103
    R0: 0.010
    outlet: wk2
      Cc: 8.2e-11      # peripheral compliance
    R1: 8480000000.0 # peripheral resistance

Plotting

Install Plots.jl

julia> ]
(v1.x) pkg> add Plots
(v1.x) pkg> <backspace>
julia> using Plots

(the first time you run this, the library will be compiled and it may takes several minutes)

plot something

using DelimitedFiles

# open the result files
v1 = DelimitedFiles.readdlm("v1_P.last")
v2 = DelimitedFiles.readdlm("v2_P.last")

plot(v1[:,1], v1[:,end]/133.332, label="v1")
plot(v2[:,1], v2[:,end]/133.332, label="v2")

xlabel!("time (s)")
ylabel!("pressure (mmHg)")

waveforms

How to dev

$ git clone https://github.com/INSIGNEO/openBF.git
$ cd openBF
$ julia
julia> ]
(v1.x) pkg> add Revise
(v1.x) pkg> activate .
(openBF) <backspace>
julia> using Revise
julia> using openBF

Ecosystem

  • A collection of 1D networks (from literature) solved by means of openBF can be found in the openBF-hub repository.
  • The scripts to generate a virtual population of ADAN56s can be found in openBF-db repository.
  • openBF badge openBF

Publications

openBF has been used in the following works:

Have you used openBF for your research? Let us know!

Citation

@misc{openBF.jl-2018,
title={openBF: Julia software for 1D blood flow modelling}, 
url={https://figshare.com/articles/openBF_Julia_software_for_1D_blood_flow_modelling/7166183/1}, 
DOI={10.15131/shef.data.7166183}, 
abstractNote={
openBF is an open-source 1D blood flow solver based on MUSCL finite-volume numerical scheme, written in Julia and released under Apache 2.0 free software license.

See https://github.com/INSIGNEO/openBF for the git repository and https://insigneo.github.io/openBF/ for the documentation.
}, 
publisher={figshare}, 
author={Melis, Alessandro}, 
year={2018}, 
month={Oct}}

Download Details:

Author: INSIGNEO
Source Code: https://github.com/INSIGNEO/openBF 
License: View license

#julia #language #model 

OpenBF: 1D Blood Flow Model

MItoS.jl: Mutual information Tools for Protein Sequence analysis

Mutual Information Tools for protein Sequence analysis

NOTE: Julia has reached a stable 1.0 version and MIToS v2 supports it. You need to do using Pkg; Pkg.add("MIToS") to install MIToS on Julia v1 or using Pkg; Pkg.update() to update your installed version.

Some breaking changes were introduced in MIToS v2.3. See the NEWS.md file and the documentation to migrate code from an old version of MIToS. If you need more help to migrate code from MIToS 1.0 in Julia 0.4 to the newer MIToS v2 in Julia v1, you can write a mail to diegozea at gmail dot com asking for assistance.

DOCUMENTATION:
Documentation for MIToS 1.0 in Julia 0.4
Documentation for MIToS v2 or greater in Julia 0.5 or greater:

MIToS is an environment for Mutual Information (MI) analysis and implements several useful tools for Multiple Sequence Alignments (MSAs) and PDB structures management in the Julia language [1]. MI allows determining covariation between positions in a MSA. MI derived scores are good predictors of residue contacts and functional sites in proteins [2,3].

MIToS starting point was an improvement of the algorithm published by Buslje et. al. [2]. A BLOSUM62-based pseudocount strategy, similar to Altschul et. al.[4], was implemented for a better performance in the range of MSAs with low number of sequences. MIToS offers all the necessary tools for using, developing and testing MI based scores, in different modules.

Modules

MIToS tools are separated on different modules, related to different tasks.

  • MSA This module defines multiple functions and types for dealing with MSAs and their annotations. It also includes facilities for sequence clustering.
  • PDB This module defines types and methods to work with protein structures from PDB.
  • SIFTS This module allows access to SIFTS residue-level mapping of UniProt, Pfam and other databases with PDB entries.
  • Information This module defines residue contingency tables and methods on them to estimate information measure from MSAs. It includes functions to estimate corrected mutual information (ZMIp, ZBLMIp) between MSA columns.
  • Pfam This module use the previous modules to work with Pfam MSAs. It also has useful parameter optimization functions to be used with Pfam alignments.
  • Utils MIToS has also an Utils module with common utils functions and types used in this package.

Scripts

MIToS implements several useful scripts for command line execution (without requiring Julia coding):

  • Buslje09.jl : Calculates the corrected MI/MIp described on Buslje et. al. 2009 [2].
  • BLMI.jl : Calculates corrected mutual information using BLOSUM62 based-pseudocounts.
  • Conservation.jl : Calculates the Shannon entropy and the Kullback-Leibler divergence of each MSA column.
  • DownloadPDB.jl : Downloads gzipped files from PDB.
  • Distances.jl : Calculates residues distances in a PDB file.
  • SplitStockholm.jl : Splits a Stockholm file with multiple alignments into one compressed file per MSA
  • AlignedColumns.jl : Creates a Stockholm file with the aligned columns from a Pfam Stockholm file (insertions are deleted) saving the mapping (residue number in UniProt) and the columns in the original MSA.
  • PercentIdentity.jl : Calculates the percentage identity between all the sequences of an MSA and saves mean, median, minimum, etc.
  • MSADescription.jl : Calculates the number of columns, sequences and clusters after Hobohm I clustering at 62% identity given a stockholm file as input [5]. It also gives the percent indentity mean and mean, standard deviation and quantiles of: sequence coverage of the MSA and gap percentage.

Citation

If you use MIToS, please cite:

Diego J. Zea, Diego Anfossi, Morten Nielsen, Cristina Marino-Buslje; MIToS.jl: mutual information tools for protein sequence analysis in the Julia language, Bioinformatics, Volume 33, Issue 4, 15 February 2017, Pages 564–565, https://doi.org/10.1093/bioinformatics/btw646

References

  1. Zea, Diego Javier, et al. "MIToS. jl: mutual information tools for protein sequence analysis in the Julia language." Bioinformatics 33, no. 4 (2016): 564-565.
  2. Buslje, Cristina Marino, et al. "Correction for phylogeny, small number of observations and data redundancy improves the identification of coevolving amino acid pairs using mutual information." Bioinformatics 25.9 (2009): 1125-1131.
  3. Buslje, Cristina Marino, et al. "Networks of high mutual information define the structural proximity of catalytic sites: implications for catalytic residue identification." PLoS Comput Biol 6.11 (2010): e1000978.
  4. Altschul, Stephen F., et al. "Gapped BLAST and PSI-BLAST: a new generation of protein database search programs." Nucleic acids research 25.17 (1997): 3389-3402.
  5. Hobohm, Uwe, et al. "Selection of representative protein data sets." Protein Science

1.3 (1992): 409-417.

Structural Bioinformatics Unit

FIL

Julia 1.0 or higher: MIToS v2

Linux, OSX: Build Status
Windows: Build status

Code Coverage: Coverage Status codecov.io

Download Details:

Author: Diegozea
Source Code: https://github.com/diegozea/MIToS.jl 
License: View license

#julia #language 

MItoS.jl: Mutual information Tools for Protein Sequence analysis

ReduceAlgebra.jl: Meta-package for Reduce.jl and External Packages

ReduceAlgebra.jl

Meta-package for Reduce.jl and External Packages  

The upstream REDUCE software was originally created by Anthony C. Hearn (currently maintained on SourceForge), the Julia packages included with this repository are based on the symbolic parser generator Reduce.jl created by Michael Reed, which extends the Julia language with REDUCE functionality.

In Reduce.jl, an upstream REDUCE package can be used with load_package(::Symbol).

External packages provided by ReduceAlgebra.jl,

What is included with the Reduce.jl core package? Julia docs (stable / latest)

  • Integration of square roots, upstream docs (ALGINT / pdf)
  • Package for compacting expressions, upstream docs (COMPACT / pdf)
  • A package for finding limits, upstream docs (LIMITS / pdf)
  • REDUCE LaTeX formula interface, upstream docs (RLFI / pdf), supports IJulia.jl output
  • REDUCE source code optimization package, upstream docs (SCOPE / pdf)
  • A package for series summation, upstream docs (SUM / pdf)

More packages will be added. See Implement External REDUCE Packages and Implement Reduce for progress.

Download Details:

Author: JuliaReducePkg
Source Code: https://github.com/JuliaReducePkg/ReduceAlgebra.jl 
License: MIT, Unknown licenses found

#julia #language 

ReduceAlgebra.jl: Meta-package for Reduce.jl and External Packages
Monty  Boehm

Monty Boehm

1660029200

ROC.jl: Receiver Operating Characteristic Curve for Julia Language

ROC

An implementation of ROC (Receiver Operating Characteristic) curves for Julia

Installation

] add https://github.com/diegozea/ROC.jl

Use

roc(scores::AbstractVector{T}, labels::AbstractVector{U}, truelabel::L; distances::Bool=false)

Here T is R or Union{R,Missing} for some type R<:Real and U is L or Union{L,Missing} for some type L<:Any. The labels vector must take exactly two non-missing values.

distances defines whether the scores values are distance-scored, i.e. a higher score value means a worse match. The default is false indicating the more typical opposite case where a higher score value means a better match

roc(scores::AbstractVector{R}, labels::BitVector{Bool}; distances::Bool=false)

Alternative method for optimal performance (no missing values allowed).

The methods above return a ROCData object, whose fields FPR and TPR are the vectors of true and false positive rates, respectively.

AUC(curve::ROCData)

Area under the curve.

PPV(curve::ROCData)

Positive predictive value.

Example

Generate synthetic data:

julia> function noisy(label; λ=0.0)
           if label
               return 1 - λ*rand()
           else
               return λ*rand()
           end
       end

julia> labels = rand(Bool, 200);

julia> scores(λ) = map(labels) do label
           noisy(label, λ=λ)
       end

Compare area under ROC curves:

julia> using ROC

julia> roc_good = roc(scores(0.6), labels, true);
julia> roc_bad = roc(scores(1.0), labels, true);

julia> area_good = AUC(roc_good)
0.9436237564063913

julia> area_bad =  AUC(roc_bad)
0.5014571399859311

Use Plots.jl to plot the receiver operator characteristics:

julia> using Plots

julia> plot(roc_good, label="good");
julia> plot!(roc_bad, label="bad")

This generates the plot appearing at the top of the page.


Linux, OSX: Build Status
Windows: Build status
Code Coverage: Coverage Status codecov.io


Download Details:

Author: Diegozea
Source Code: https://github.com/diegozea/ROC.jl 
License: View license

#julia #language #curve 

ROC.jl: Receiver Operating Characteristic Curve for Julia Language
Royce  Reinger

Royce Reinger

1659822060

Numerizer: Parse Numbers in Natural Language From Strings

Numerizer

Numerizer is a gem to help with parsing numbers in natural language from strings (ex forty two). It was extracted from the awesome Chronic gem chronic.

Installation

$ gem install numerizer

Usage

>> require 'numerizer'
=> true
>> Numerizer.numerize('forty two')
=> "42"
>> Numerizer.numerize('two and a half')
=> "2.5"
>> Numerizer.numerize('three quarters')
=> "3/4"
>> Numerizer.numerize('two and three eighths')
=> "2.375"

Contributors

Tom Preston-Werner, John Duff

Author: jduff
Source Code: https://github.com/jduff/numerizer 
License: MIT license

#ruby #natural #language 

Numerizer: Parse Numbers in Natural Language From Strings
Monty  Boehm

Monty Boehm

1658965380

A Very Simple Hackable Parser & Lexer for Simple Languages

SimpleParser

This parser is intended for parsing small simple languages. It is rather primitive. The main thing it has got going for itself is that the implementation is so simple that if you need to write support for some simple language and don't want to drag in too many dependencies, then this is simple code to hack and tweak.

I am using it as the foundation of two simple parsers. One for parsing ASCII plist files and the other for Go function signatures.

To use the parser, first create lexer for the code you are parsing. Then create a parser from this lexer and start parsing the top level statement or datastructure.

lexer = Lexer(code)
parser = Parser(lexer)
parse_toplevel(parser)

You implement your parse functions using:

  • look_ahead_type(parser) to find the type of the token comming up.
  • match(parser, token_type) verify that look ahead token is what we expect and consume it.

The lexer implements the julia iterator interface so you iterate through each token in a regular for-loop.

Author: ordovician
Source Code: https://github.com/ordovician/SimpleParser.jl 
License: View license

#julia #language 

A Very Simple Hackable Parser & Lexer for Simple Languages
Royce  Reinger

Royce Reinger

1658879820

Detectlanguage-ruby: Detect Language API Ruby Client

Detect Language API Ruby Client

Detects language of the given text. Returns detected language codes and scores.

Before using Detect Language API client you have to setup your personal API key. 

Installation

Add this line to your application's Gemfile:

gem 'detect_language'

Or install it yourself as:

gem install detect_language

Configuration

If you are using Rails, create initializer config/initializers/detect_language.rb and add following code there. Otherwise just integrate following code into your apps configuration.

DetectLanguage.configure do |config|
  config.api_key = "YOUR API KEY"

  # enable secure mode (SSL) if you are passing sensitive data
  # config.secure = true
end

Usage

Language detection

DetectLanguage.detect("Buenos dias señor")

Result

[{"language"=>"es", "isReliable"=>true, "confidence"=>6.62}]

Simple language detection

If you need just a language code you can use simple_detect. It returns just the language code.

DetectLanguage.simple_detect("Buenos dias señor")

Result

"es"

Batch detection

It is possible to detect language of several texts with one request. This method is significantly faster than doing one request per text. To use batch detection just pass array of texts to detect method.

DetectLanguage.detect(["Buenos dias señor", "Labas rytas"])

Result

Result is array of detections in the same order as the texts were passed.

[ [{"language"=>"es", "isReliable"=>true, "confidence"=>6.62}], 
  [{"language"=>"lt", "isReliable"=>true, "confidence"=>6.82}] ]

Getting your account status

DetectLanguage.user_status

Result

{"date"=>"2013-11-17", "requests"=>95, "bytes"=>2223, "plan"=>"FREE", "plan_expires"=>nil,
 "daily_requests_limit"=>5000, "daily_bytes_limit"=>1048576, "status"=>"ACTIVE"}

Getting list supported languages

DetectLanguage.languages

Result

Array of language codes and names.

You can get it by signing up at https://detectlanguage.com

Author: Detectlanguage
Source Code: https://github.com/detectlanguage/detectlanguage-ruby 
License: MIT license

#ruby #detect #language #api 

Detectlanguage-ruby: Detect Language API Ruby Client
Royce  Reinger

Royce Reinger

1658872380

Cld: Compact Language Detection in Ruby

Compact Language Detection

Blazing-fast language detection for Ruby provided by Google Chrome's Compact Language Detector.

How to Use

CLD.detect_language("This is a test")
# => {:name => "ENGLISH", :code => "en", :reliable => true}

CLD.detect_language("plus ça change, plus c'est la même chose")
# => {:name => "FRENCH", :code => "fr", :reliable => true}

Installation

Add this line to your application's Gemfile:

gem "cld"

And then execute:

$ bundle

Thanks

Thanks to the Chrome authors, and to Mike McCandless for writing a Python version.

Author: jtoy
Source Code: https://github.com/jtoy/cld 
License: BSD-3-Clause license

#ruby #language #detection 

Cld: Compact Language Detection in Ruby
Rocio  O'Keefe

Rocio O'Keefe

1658157122

Traindown: A Language to Help Athletes Express Their Training

Traindown

A language to help athletes express their training. Inspired by Markdown.

This is the Dart implementation of the Traindown language spec version 1.2.1. For more information, please visit the Traindown website.

Installing

Use this package as a library

Depend on it

Run this command:

With Dart:

 $ dart pub add traindown

With Flutter:

 $ flutter pub add traindown

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  traindown: ^3.2.1

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:traindown/traindown.dart';

example/example.dart

import 'dart:io';

import 'package:traindown/src/presenters/console_presenter.dart';
import 'package:traindown/src/presenters/json_presenter.dart';
import 'package:traindown/src/formatter.dart';
import 'package:traindown/src/parser.dart';
import 'package:traindown/src/session.dart';

void main() {
  // Here is an example Traindown string that could be polished that is being
  // passed into a Parser for parsing.
  Parser parser = Parser(
      '@ 2019-10-21; # unit:lbs; Squat: 500 #rir:10; 550 2r; 600 3r 3s; * Was hard');

  // The result of the parsing is a List<Token> that we can then hand off
  // to things like our Formatter.
  Formatter formatter = Formatter();

  // Let's see what our Formatter can do! Here we make a new one that uses
  // just the default output options.
  String formatted = formatter.format(parser.tokens());

  // Ah, much better.
  print('Enjoy this formatted Traindown!\n');
  print(formatted);
  print('\n\n---\n\n');

  // Output be like
  /*
    Enjoy this formatted Traindown!

    @ 2019-10-21

    # unit: lbs

    Squat:
      500
        # rir: 10
      550 2r
      600 3r 3s
        * Was hard
  */

  // With the Formatter, you can alter the output to suit your specific needs.
  // Here is an example where we open up some breathing room.
  formatter.indenter = '    ';

  print('Very space. Much wow\n');
  print(formatter.format(parser.tokens()));
  print('\n\n---\n\n');

  // Output be like
  /*
    Very space. Much wow

    @ 2019-10-21

    # unit: lbs

    Squat:
        500
            # rir: 10
        550 2r
        600 3r 3s
            * Was hard
  */

  // Once we parse, we typically want to do *stuff* with the data. That's where
  // Sessions come in. Let's take one for a test drive.

  Session session = Session(parser.tokens());

  // Here is just the default toString of a session.
  print(session);

  // We also have an assortment of pre-made presenters as well as a base class
  // that you can use to build your own!

  ConsolePresenter cp = ConsolePresenter(session);

  // And here is what it likes to present.

  print("An example of a text based presenter\n");
  print(cp.present());
  print('\n\n---\n\n');

  // There is also JSON available.

  JsonPresenter jp = JsonPresenter(session);

  // Which spits out

  print("And here is some JSON\n");
  print(jp.present());
  print('\n\n---\n\n');

  // You can also read a file with little effort

  File file = File("./example/example.traindown");
  String src = file.readAsStringSync();
  Parser fileParser = Parser(src);
  Session fileSession = Session(fileParser.tokens());

  // And using our handy presenter again

  ConsolePresenter fcp = ConsolePresenter(fileSession);

  // We see some awesomeness!

  print("A longer example presented for the console\n");
  print(fcp.present());
  print('\n\n---\n\n');
}

Original article source at: https://pub.dev/packages/traindown 

#flutter #dart #language 

Traindown: A Language to Help Athletes Express Their Training
Royce  Reinger

Royce Reinger

1658023740

Thailang4r: Thai Language Utility for Ruby

thailang4r

Thai language utility for Ruby

I have built this project in order to collect and share tools for Thai language, which are written in Ruby language.

Installation

gem install thailang4r

Character level

  • chlevel is similar th_chlevel in libthai.
  • string_chlevel gives array of level back for example string_chlevel("กี") will return [1, 2]

Word breaker

# encoding: UTF-8
require 'thailang4r/word_breaker'
word_breaker = ThaiLang::WordBreaker.new
puts word_breaker.break_into_words("ฉันกินข้าว")
# ["ฉัน", "กิน", "ข้าว"]

Romanization

A port of royin.py transliteration from PyThaiNLP.

# encoding: UTF-8
require 'thailang4r/roman'
royin = ThaiLang::Royin.new
p royin.romanize("ฉันกินข้าว", "-")
# => "chan-kin-khao"

Author: veer66
Source Code: https://github.com/veer66/thailang4r 
License: Apache-2.0 license

#ruby #util #language 

Thailang4r: Thai Language Utility for Ruby