This file contains hidden or 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
| # Convert tex formula into google chart API format (Jekyll/Octopress plugin) | |
| # | |
| # Usage: {% gctex tex_formula %} | |
| # | |
| # Author: yag_ays (yanagi.ayase [at] gmail.com) | |
| # blog: http://yagays.github.com/ | |
| # | |
| # Ref: http://d.hatena.ne.jp/repose/20110506/1304612242 | |
| require "cgi" |
This file contains hidden or 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
| #/usr/bin/env ruby | |
| require "optparse" | |
| def v(s) | |
| if s == "NaN" | |
| return s | |
| elsif s.include?("%") | |
| return s.gsub("%","").to_f | |
| else |
This file contains hidden or 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
| #/usr/bin/env ruby | |
| # usage: | |
| # ruby rand_fastq.rb hoge.fasta > random.fastq | |
| require 'bio' | |
| genome = "" | |
| read_length = 100 | |
| read_count = 10000000 |
This file contains hidden or 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
| (map #(if (zero? (rem % 3)) | |
| (if (zero? (rem % 5)) | |
| "fizzbuzz" | |
| "fizz") | |
| (if (zero? (rem % 5)) | |
| "buzz" | |
| %)) | |
| (range 1 101)) | |
This file contains hidden or 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
| ;;; 文字列の指定 | |
| (def sentence "mississippi") | |
| (def sentence "Ask not what your country can do for you but what you can do for your country") | |
| ;;; 接尾辞リストを作る | |
| (defn tail [x] | |
| (loop [s x result []] | |
| (if (empty? s) (conj result s) (recur (apply str (rest s)) (conj result s) )))) | |
| ;;; ソートする |
This file contains hidden or 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
| ;; 訓練データ | |
| (def text_classified_p '(["good" "bad" "good" "good"] | |
| ["exciting" "exciting"] | |
| ["good" "good" "exciting" "boring"])) | |
| (def text_classified_n '(["bad" "boring" "boring" "boring"] | |
| ["bad" "good" "bad"] | |
| ["bad" "bad" "boring" "exciting"])) | |
| ;;多変数ベルヌーイモデル | |
| (defn train [features] |
This file contains hidden or 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
| #compdef samtools | |
| ################################################ | |
| # SAMtools commands and options are based on ver. 0.1.18 | |
| # http://samtools.sourceforge.net/samtools.shtml | |
| # | |
| # Edited by yag_ays 2011.10.25 | |
| ################################################ | |
| _samtools() { |
This file contains hidden or 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
| #/usr/bin/env ruby | |
| def open_indel_file(filename) | |
| h = [] | |
| open(filename) { |f| | |
| f.each_line do |line| | |
| a = line.chomp.split("\t") | |
| h << a | |
| end |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| # -*- coding: utf-8 -*- | |
| require "pp" | |
| def input_marshal_data(path) | |
| a = 0 | |
| a_id_list = [] | |
| open(path,"rb") {|f| | |
| a = Marshal.load(f) |
This file contains hidden or 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
| #/usr/bin/env ruby | |
| def open_t_delimited_file(filename) | |
| h = {} | |
| File.open(filename).readlines.each do |line| | |
| a = line.split("\t") | |
| h[a[0]] = a | |
| end | |
| puts filename.to_s + " was loaded." | |
| return h |