Utils

Utils

MIToS.UtilsModule.

The Utils has common utils functions and types used in other modules.

using MIToS.Utils
source

Contents

Types

MIToS.Utils.AllType.

All is used instead of MIToS 1.0 "all" or "*", because it's possible to dispatch on it.

source

Format is used for write special parse (and read) methods on it.

source

Constants

Macros

Methods and functions

Base.readMethod.

read(pathname, Format [, Type [, … ] ] ) -> Type

This function opens a file in the pathname and calls parse(io, ...) for the given Format and Type on it. If the pathname is an HTTP or FTP URL, the file is downloaded with download in a temporal file. Gzipped files should end on .gz.

source
Base.writeMethod.

write{T<:Format}(filename::AbstractString, object, format::Type{T}, mode::ASCIIString="w")

This function opens a file with filename and mode (default: "w") and writes (print) the object with the given format. Gzipped files should end on .gz.

source

Returns the filename. Throws an ErrorException if the file doesn't exist, or a warning if the file is empty.

source

It checks if a PDB code has the correct format.

source

download_file uses Requests.jl and FTPClient.jl instead of system calls to download files from the web. It takes the file url as first argument and, optionally, a path to save it. Keyword arguments (ie. allow_redirects, max_redirects, timeout, headers) are are directly passed to to Requests.get_streaming.

julia> download_file("http://www.uniprot.org/uniprot/P69905.fasta","seq.fasta",
       allow_redirects=false,
       headers=Dict("User-Agent" => "Mozilla/5.0 (compatible; MSIE 7.01; Windows NT 5.0)"))
"seq.fasta"
source

get_n_words{T <: Union{ASCIIString, UTF8String}}(line::T, n::Int) It returns a Vector{T} with the first n (possibles) words/fields (delimited by space or tab). If there is more than n words, the last word returned contains the finals words and the delimiters. The length of the returned vector is n or less (if the number of words is less than n). This is used for parsing the Stockholm format.

julia> get_n_words("#=GR O31698/18-71 SS    CCCHHHHHHHHHHHHHHHEEEEEEEEEEEEEEEEHHH", 3)
3-element Array{String,1}:
 "#=GR"
 "O31698/18-71"
 "SS    CCCHHHHHHHHHHHHHHHEEEEEEEEEEEEEEEEHHH"
source

Getter for the array field of NamedArrays

source

hascoordinates(id) It returns true if id/sequence name has the format: UniProt/start-end (i.e. O83071/192-246)

source

Returns true if the file exists and isn't empty.

source

Create an iterable object that will yield each line from a stream or string.

source

Returns a square symmetric matrix from the vector vec. side is the number of rows/columns. The diagonal is not included by default, set to true if there are diagonal elements in the list.

source

Returns a vector with the part ("upper" or "lower") of the square matrix mat. The diagonal is not included by default.

source

Selects the first element of the vector. This is useful for unpacking one element vectors. Throws a warning if there are more elements. element_name is element by default, but the name can be changed using the second argument.

source