This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Profile{T} | |
raw_data :: Array{Char, 2} | |
data :: Array{Dict{Char, T}, 1} | |
size :: Int64 | |
Profile(raw :: Array{Char, 2}) = get_pr(raw) | |
Profile(str :: String) = Profile{T}( reshape([ letter for letter in str ], length(str), 1) ) | |
function get_pr(raw::Array{Char, 2}) | |
raw_data = copy(raw) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```{r} | |
library(knitr) | |
library(lattice) | |
library(MASS) | |
library(latticeExtra) | |
library(rgl) | |
library(hash) | |
``` | |
```{r} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from file MASS/R/add.R | |
# dropterm method redefined | |
addterm2 <- | |
function(object, ...) UseMethod("addterm2") | |
addterm2.default <- | |
function(object, scope, scale = 0, test = c("none"), | |
k = 2, sorted = FALSE, trace = FALSE, ...) | |
{ | |
if(missing(scope) || is.null(scope)) stop("no terms in scope") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following code solves this problem: http://rosalind.info/problems/glob/ | |
# * it takes data from the input file, in FASTA format (as the problem states). Input file name may be given as a parameter to script | |
# * it writes the result to file named 'output.txt' | |
# * Additionally, it writes to console result && backtracing log | |
# P.S. - Yeees, I know, my english is awful. Please, feel free to review it too =) | |
# | |
# ruby version: 1.9.3 | |
# version 1 - doesn't show backtracing | |
# version 2 - shows some optimal alignment | |
# version 3 - shows all possible backtracings recursively |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rsa' # using rsa gem: http://rsa.rubyforge.org/index.html | |
# core library has some methods for modular arithmetics, but rsa gem has some additional methods. | |
# I've tried to use them to find plaintext | |
# ----------- | |
#known constants | |
# ------------- | |
E = 29 | |
M_POWER = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hw 5 problem 4 solution (Algorithms and datastructures course) | |
# Problem is stated as follows: as input we get array of n elements a[0].. a[n - 1] | |
# !!!!!!!!!!!!!! in this code elements numerated from zero index | |
# must find a way to process it and find l and r indices such that (r - l + 1)*min(a[i], i in [l, r]) is maximized | |
# | |
# ruby 1.9.3 | |
require './problem4_functions' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!~/bin/ruby | |
require 'ostruct' | |
require "rubyvis" | |
require './plotter_utility.rb' | |
#------------ | |
# | |
#------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ruby 1.9.3 | |
puts "Print first array elements (divided by spaces):" | |
a = gets().split(' ').map{|x| x.to_i }.sort #presorted array N1 | |
puts "Print second array elements (divided by spaces):" | |
b = gets().split(' ').map{|x| x.to_i }.sort #presorted array N2 | |
puts "print k value u wanna get" | |
k = gets().to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
xmatrix should meet the following conditions: | |
1. there must be class for 3*3 matrices. | |
2. There must be class for 3dimentional vectors | |
3. there must be ancestor of matrix class, describing matrix of rotation near z axis | |
4. Should overload operations: | |
- matrix addition | |
- multiplication by number | |
- multiplication by vector | |
- multiplication by matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
XFiles should meet the following conditions: | |
1. there must be class for student with his marks. with the following properties: | |
- print self with ther format shown as '<Student Full Name>: <mark1> <mark2> ... <markN>' | |
- should be able to calculate median (mean) mark. | |
- should be able to add new marks | |
- construct Student by his full name | |
2. There also should be class for simple file-based database, which should meet the following conditions: | |
- class should be initialized by filename, when gets filename - load all information from file specified, thus creating a set (array) of Student objects. | |
- should have possibility to add, remove students, to output all students to file. |
OlderNewer