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
MIToS.Utils.FileFormatType

FileFormat is used for defile special parse_file (called by read_file) and print_file (called by read_file) methods for different file formats.

source

Constants

MIToS.Utils.THREE2ONEConstant

THREE2ONE is a dictionary that maps three-letter amino acid residue codes (String) to their corresponding one-letter codes (Char). The dictionary is generated by parsing components.cif file from the Protein Data Bank.

julia> using MIToS.Utils

julia> one_letter_code = THREE2ONE["ALA"]
'A': ASCII/Unicode U+0041 (category Lu: Letter, uppercase)
source

Macros

Methods and functions

MIToS.Utils.check_fileMethod

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

source
MIToS.Utils.download_fileMethod

download_file uses Downloads.jl to download files from the web. It takes the file url as first argument and, optionally, a path to save it. Keyword arguments are are directly passed to to Downloads.download.

julia> using MIToS.Utils

julia> download_file("https://www.uniprot.org/uniprot/P69905.fasta", "seq.fasta")
"seq.fasta"
source
MIToS.Utils.get_n_wordsMethod

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> using MIToS.Utils

julia> get_n_words("#=GR O31698/18-71 SS    CCCHHHHHHHHHHHHHHHEEEEEEEEEEEEEEEEHHH", 3)
3-element Vector{String}:
 "#=GR"
 "O31698/18-71"
 "SS    CCCHHHHHHHHHHHHHHHEEEEEEEEEEEEEEEEHHH"
source
MIToS.Utils.list2matrixMethod

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
MIToS.Utils.matrix2listMethod

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

source
MIToS.Utils.read_fileMethod

read_file(pathname, FileFormat [, Type [, … ] ] ) -> Type

This function opens a file in the pathname and calls parse_file(io, ...) for the given FileFormat 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
MIToS.Utils.select_elementMethod

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
MIToS.Utils.write_fileMethod

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

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

source