code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
require 'digest/sha1'
class User < ActiveRecord::Base
has_many :courses, :class_name => 'Course', :foreign_key => 'creator_id'
has_many :spots, :class_name => 'Spot', :foreign_key => 'creator_id'
# Virtual attribute for the unencrypted password
attr_accessor :password
validates_presence... | Ruby |
class AccountController < ApplicationController
# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem
# If you want "remember me" functionality, add this before_filter to Application Controller
before_filter :login_from_cookie
# say something nice, you goof! ... | Ruby |
require 'json'
class CourseController < ApplicationController
include AuthenticatedSystem
before_filter :login_required
def index
redirect_to :action => 'choice'
end
def choice
@course = params[:id] ? Course.find(params[:id]) : nil
render :action => 'choice'
end
def ajax_spots
@cour... | Ruby |
class SpotController < ApplicationController
include AuthenticatedSystem
before_filter :login_required
def index
redirect_to :action => 'new'
end
def new
if request.get?
@spot = Spot.new
render :action => 'new'
else
@spot = Spot.new(params['spot'].merge(:creator => current_u... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_white_nigh... | Ruby |
ActionController::Routing::Routes.draw do |map|
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# ... | Ruby |
# Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
unless defined?(RAILS_ROOT)
root_path = File.join(File.dirname(__FILE__), '..')
unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
require 'pathname'
root_path = Pathname.new(root_path).cleanpath(true).to_s
end
... | Ruby |
# Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION ... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
module AuthenticatedSystem
protected
# Returns true or false if the user is logged in.
# Preloads @current_user with the user model if they're logged in.
def logged_in?
current_user != :false
end
# Accesses the current user from the session.
def current_user
@current_user ||= ... | Ruby |
module AuthenticatedTestHelper
# Sets the current user in the session from the user fixtures.
def login_as(user)
@request.session[:user] = user ? users(user).id : nil
end
def content_type(type)
@request.env['Content-Type'] = type
end
def accept(accept)
@request.env["HTTP_ACCEPT"] = accept
en... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
require 'sinatra/activerecord/rake'
require './main' | Ruby |
source :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'sinatra-activerecord'
gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client'
group :development do
gem 'rake'
gem 'sqlite3-ruby'
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def up
create_table :users do |t|
t.string :profile_id
t.string :email
t.string :refresh_token
end
add_index :users, :profile_id
end
def down
drop_table :users
end
end
| Ruby |
# Copyright (C) 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Ruby |
require 'sinatra.rb'
# Sinatra defines #set at the top level as a way to set application configuration
set :run, false
set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development)
require './main'
run Sinatra::Application | Ruby |
require 'puppet/provider/parsedfile'
shells = "/etc/shells"
Puppet::Type.type(:shells).provide(:parsed,
:parent => Puppet::Provider::ParsedFile,
:default_target => shells,
:filetype => :flat
) do
desc "The shells provider that ... | Ruby |
module Puppet
newtype(:shells) do
@doc = "Manages shells in /etc/shells. For example::
shells { \"/bin/bash\":
ensure => present,
}
There is also an optional target attribute if your
shells file is located elsewhere."
ensurable
newparam(:shell, :name... | Ruby |
Facter.add("etctest") do
setcode do
"/etc/test.conf"
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:set_role_attr) do |args|
address = args[0]
roleid = args[1]
rname = args[2]
rvalue = args[3]
cmd = "curl -s \"%s/status/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, rname, rvalue]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_provider_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getProviderAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets }
... | Ruby |
module Puppet::Parser::Functions
newfunction(:get_role_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getRoleAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets }
puts re... | Ruby |
module Puppet::Parser::Functions
newfunction(:set_profile_applied) do |args|
roleid = args[0]
address = args[1]
cmd="curl -s \"%s/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, "ProfileABCApplied", "True"]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:write_line_to_file) do |args|
filename = args[0]
str = args[1]
File.open(args[0], 'a') {|fd| fd.puts str }
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_dependent_attrlist, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getDependentAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets... | Ruby |
require 'puppet/provider/parsedfile'
shells = "/etc/shells"
Puppet::Type.type(:shells).provide(:parsed,
:parent => Puppet::Provider::ParsedFile,
:default_target => shells,
:filetype => :flat
) do
desc "The shells provider that ... | Ruby |
module Puppet
newtype(:shells) do
@doc = "Manages shells in /etc/shells. For example::
shells { \"/bin/bash\":
ensure => present,
}
There is also an optional target attribute if your
shells file is located elsewhere."
ensurable
newparam(:shell, :name... | Ruby |
Facter.add("etctest") do
setcode do
"/etc/test.conf"
end
end
| Ruby |
#Will call setCustomRoleAttr
module Puppet::Parser::Functions
newfunction(:set_role_attr) do |args|
address = args[0]
roleid = args[1]
rname = args[2]
rvalue = args[3]
cmd = "curl --insecure -s \"%s/status/setCustomRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, rname, rvalue]
puts ... | Ruby |
module Puppet::Parser::Functions
newfunction(:get_provider_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl --insecure -s \"%s/status/getProviderAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=... | Ruby |
module Puppet::Parser::Functions
newfunction(:get_role_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl --insecure -s \"%s/status/getRoleAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets }
... | Ruby |
module Puppet::Parser::Functions
newfunction(:set_profile_applied) do |args|
roleid = args[0]
address = args[1]
cmd="curl --insecure -s \"%s/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, "ProfileABCApplied", "True"]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:write_line_to_file) do |args|
filename = args[0]
str = args[1]
File.open(args[0], 'a') {|fd| fd.puts str }
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_dependent_attrlist, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl --insecure -s \"%s/status/getDependentAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| re... | Ruby |
require 'puppet/provider/parsedfile'
shells = "/etc/shells"
Puppet::Type.type(:shells).provide(:parsed,
:parent => Puppet::Provider::ParsedFile,
:default_target => shells,
:filetype => :flat
) do
desc "The shells provider that ... | Ruby |
module Puppet
newtype(:shells) do
@doc = "Manages shells in /etc/shells. For example::
shells { \"/bin/bash\":
ensure => present,
}
There is also an optional target attribute if your
shells file is located elsewhere."
ensurable
newparam(:shell, :name... | Ruby |
Facter.add("etctest") do
setcode do
"/etc/test.conf"
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:set_role_attr) do |args|
address = args[0]
roleid = args[1]
rname = args[2]
rvalue = args[3]
cmd = "curl -s \"%s/status/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, rname, rvalue]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_provider_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getProviderAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets }
... | Ruby |
module Puppet::Parser::Functions
newfunction(:get_role_attr, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getRoleAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets }
puts re... | Ruby |
module Puppet::Parser::Functions
newfunction(:set_profile_applied) do |args|
roleid = args[0]
address = args[1]
cmd="curl -s \"%s/setRoleAttr?roleid=%s&name=%s&value=%s\"" % [address, roleid, "ProfileABCApplied", "True"]
puts cmd
system(cmd)
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:write_line_to_file) do |args|
filename = args[0]
str = args[1]
File.open(args[0], 'a') {|fd| fd.puts str }
end
end
| Ruby |
module Puppet::Parser::Functions
newfunction(:get_dependent_attrlist, :type => :rvalue) do |args|
address = args[0]
roleid = args[1]
name=args[2]
cmd="curl -s \"%s/status/getDependentAttr?roleid=%s&name=%s\"" % [address, roleid, name]
puts cmd
result = ""
IO.popen(cmd) { |f| result=f.gets... | Ruby |
module HL7
# HL7 segment
class Segment < HL7::Field
def initialize(values=nil,separator='|',subseparator='^',rep_sep='~',esc="\\")
super(values,separator,subseparator,rep_sep,esc)
end
attr_writer :parent
attr_writer :no
# search for segments after this segment of type +seg+,
# s... | Ruby |
# Patient IDentification
module HL7
class HL7::Pid < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:set_id,false,Si],
[:patient_id,false,Cx],
[:patient_identifier_list,true,Cx],
[:alternate_patient_id,false,Cx],
[:patient_name,true,Xpn],
[:... | Ruby |
require 'date'
require 'base64'
# a literal HL7 string, no parsing performed.
class Literal
attr_reader :esc, :rep_sep, :subseparator, :separator
def self.parse(text, separator, subseparator, subsubseparator, rep_sep, esc)
self.new(text,separator, subseparator, subsubseparator, rep_sep, esc)
end
def in... | Ruby |
require 'hl7/field'
require 'hl7/types'
require 'hl7/segment'
require 'hl7/error'
require 'hl7/msa'
require 'hl7/msh'
require 'hl7/obr'
require 'hl7/obx'
require 'hl7/orc'
require 'hl7/pid'
require 'hl7/prd'
require 'hl7/pv1'
require 'hl7/rf1'
require 'pp'
module HL7
class Message
def initialize(segs=[])
... | Ruby |
# observation control. Basically redundant in modern use of HL7
module HL7
class Orc < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:order_control,false,Id],
[:placer_order_number,false,Ei],
[:filler_order_number,false,Ei],
[:placer_group_number,false,Ei... | Ruby |
#!/usr/bin/env ruby
$: << "~/wedgetail/lib"
require 'hl7/message'
pp HL7::Message.parse(STDIN.read)
| Ruby |
# message header
module HL7
class Msh < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:encoding_characters,false,Literal],
[:sending_application,false,Hd],
[:sending_facility,false,Hd],
[:receiving_application,false,Hd],
[:receiving_facility,false,... | Ruby |
# Observation, by far the most important segment
module HL7
class Obx < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:set_id,false,Si],
[:value_type,false,Id],
[:identifier,false,Ce],
[:subidentifier,false,St],
[:value,true,Obx5],
[:unit,f... | Ruby |
module HL7
# message acknowledgement
class Msa < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:code,false,Id],
[:control_id,false,St],
[:text,false,St],
[:number,false,Nm],
[:delayed_ack_type,false,St], # deprecated to the point that the 2.5 docs refuse to te... | Ruby |
#!/usr/bin/env ruby
$: << "~/wedgetail/lib"
require 'hl7/message'
pp HL7::Message.parse(STDIN.read)
| Ruby |
# represents a HL7 segment or a field with components, or a component with subcomponents
module HL7
class Field
attr_writer :separator
attr_reader :separator
# +values+ is a Hash of inital values for the field/segment
def initialize(values=nil,separator='^',subseparator="&",rep_sep='~',esc="\\")... | Ruby |
# an HL7 parsing error
module HL7
class Error < StandardError
end
end | Ruby |
# Patient Visit 1 (there is a Patient Visit 2)
# few of these fields have any relevence for Australia use.
module HL7
class Pv1 < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:set_id,false,Si],
[:patient_class,false,Is],
[:assigned_patient_location,false,Pl],
... | Ruby |
# observation request
module HL7
class Obr < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:set_id,false,Si],
[:placer_order_number,false,Ei],
[:filler_order_number,false,Ei],
[:universal_service_identifier,false,Ce],
[:priority,false,Id],
... | Ruby |
# PRovider Data
module HL7
class HL7::Prd < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:role,true,Ce],
[:name,true,Xpn],
[:address,true,Xad],
[:location,false,Pl],
[:communication_information,true,Xtn],
[:preferred_contact_method,false,C... | Ruby |
# Referral Information 1
module HL7
class Rf1 < HL7::Segment
def fields_desc
[
[:segment,false,Literal],
[:status,false,Ce], # table 283
[:priority,false,Ce], # table 280
[:referral_type,false,Ce], # table 281
[:disposition,true,Ce], # table 282
[:category,fal... | Ruby |
module Athen
# base class for user-interfaces
class CommonInterface
def debug=(d)
@debug = d
end
def logfile=(s)
@logfile = s
end
# log a string, as part of routine operations
def log(s)
@logfile.write(s+'\n')
end
# log a string: when debugging
def debug(s)... | Ruby |
require 'tmpdir'
require 'date'
class GPGError < StandardError
attr :message
def initialize(message)
@message = message
end
end
class WrongKey < GPGError
def initialize
@message = "FROM has tried to send you a message using the wrong public key, so you couldn't decrypt it.Please ask them t... | Ruby |
require 'interfaces'
require 'athen_mail'
require 'athen_file'
begin
include 'fox16'
include 'gui'
include 'wizard'
rescue
end
| Ruby |
# this is the component that interfaces with the filesystem
require 'date'
require 'hl7/message'
require 'sqlite3'
SQLite3::Database.results_as_hash = true
SQLite3::Database.type_translation = true
begin
require 'win32/registry'
rescue
end
module Athen
class FileManager
def file_code
(Time.now.to_i).... | Ruby |
require 'net/smtp'
require 'net/imap'
require 'net/pop'
require 'base64'
require 'rubygems'
require 'mail'
require 'gpg'
module Athen
class MailManager
def initalize(iface,fso)
@fso = fso
@iface = iface
Mail.defaults do
params = {:address=> @fso.get_config('smtp_server'),:port=>25}
... | Ruby |
require 'rubygems'
require 'fox16'
require 'interfaces'
require 'thread'
include Fox
module Athen
class MainWindow < FXMainWindow
def initialize(app)
super(app, "ATHEN", :width => 600, :height => 400)
packer = FXPacker.new(self, :opts => LAYOUT_FILL)
hframe1 = FXHorizontalFrame.new(packer,
... | Ruby |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', '..', 'touch', 'resources', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css")
# Require any additional compass plu... | Ruby |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css")
environment = :production
output_style = :compressed | Ruby |
# Get the directory that this configuration file exists in
dir = File.dirname(__FILE__)
# Load the sencha-touch framework automatically.
load File.join(dir, '..', 'themes')
# Compass configurations
sass_path = dir
css_path = File.join(dir, "..", "css-debug")
environment = :development
output_style = :expanded | Ruby |
# This file registers the sencha-touch framework with compass
# It's a magic name that compass knows how to find.
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'theme_images.rb')
# Include compass-recipes
require File.join(File.dirname(__FILE__), 'vendor', 'compass-recipes', 'config')
Compass::BrowserSup... | Ruby |
stylesheet 'sencha-touch.scss' | Ruby |
module SenchaTouch
module SassExtensions
module Functions
module ThemeImages
def theme_image(theme, path, mime_type = nil)
path = path.value
images_path = File.join(File.dirname(__FILE__), "..", "images", theme.value)
real_path = File.join(images_path, path)
i... | Ruby |
require 'pp'
def estimate_acceleration_distance(initial_rate, target_rate, acceleration)
(target_rate*target_rate-initial_rate*initial_rate)/(2*acceleration)
end
def intersection_distance(initial_rate, final_rate, acceleration, distance)
(2*acceleration*distance-initial_rate*initial_rate+final_rate*final_ra... | Ruby |
require 'rubygems'
require 'optparse'
require 'serialport'
options_parser = OptionParser.new do |opts|
opts.banner = "Usage: stream [options] gcode-file"
opts.on('-v', '--verbose', 'Output more information') do
$verbose = true
end
opts.on('-p', '--prebuffer', 'Prebuffer commands') do
$prebuffer = ... | Ruby |
#!/usr/bin/ruby
require 'script/stream' | Ruby |
#!/usr/bin/env ruby
# Simple example of using Atheme's XMLRPC server with ruby
# $Id: rubyxmlrpc.rb 8403 2007-06-03 21:34:06Z jilles $
require "xmlrpc/client"
login = "someaccount"
password = "somepassword"
sourceip = "::1"
server = XMLRPC::Client.new("localhost", "/xmlrpc", 8080)
result = server.call("atheme.login"... | Ruby |
#!/usr/bin/env ruby
# Simple example of using Atheme's XMLRPC server with ruby
# $Id: rubyxmlrpc.rb 8403 2007-06-03 21:34:06Z jilles $
require "xmlrpc/client"
login = "someaccount"
password = "somepassword"
sourceip = "::1"
server = XMLRPC::Client.new("localhost", "/xmlrpc", 8080)
result = server.call("atheme.login"... | Ruby |
while line = ARGF.gets do
if line=~ /^\s*S\s+(\d+)\s+\S+\((\d+)\)\s+\d+/
puts "#{$1}\t#{$2}"
end
end
| Ruby |
## input: pileup, window size
# ignore the very edges of chromosomes
$wsize = 200
$bases = {'A' =>0, 'C' => 0, 'G' => 0, 'T' => 0, 'N' => 0}
$head = nil
$window = []
def main
p, $wsize = getArgs()
middle = $wsize / 2
# $stderr.puts middle
File.new(p,'r').each do |line|
cols = line.split(/\s+/)
base... | Ruby |
## todo: integrate HapMap allele frequency as the Prior SNP rate for known SNPs
## estimate the probability of error of raw SNP calls on the condition of:
## 1. quality scores
# 2. longest homopolymer size in a 13-bp reference window centered on the substitution base
# 3. distance to 3' end on the read
# 4. "s... | Ruby |
# input format:
# read_ID chromosome start end direction
require 'getoptlong'
opts = GetoptLong.new(
["--map", "-m", GetoptLong::REQUIRED_ARGUMENT],
["--gsize", "-s", GetoptLong::OPTIONAL_ARGUMENT],
["--help", "-h", GetoptLong::NO_ARGUMENT]
)
optHash = {}
opts.each do |opt, arg|
optHash[op... | Ruby |
# do blat and cross_match
require 'getoptlong'
opts = GetoptLong.new(
["--reference", "-r", GetoptLong::REQUIRED_ARGUMENT],
["--query", "-q", GetoptLong::REQUIRED_ARGUMENT],
# ["--output", "-o", GetoptLong::OPTIONAL_ARGUMENT],
["--minscore", "-m", GetoptLong::OPTIONAL_ARGUMENT],
["--cutoff", "-c", ... | Ruby |
require 'getoptlong'
opts = GetoptLong.new(
["--source", "-s", GetoptLong::OPTIONAL_ARGUMENT],
["--length", "-l", GetoptLong::REQUIRED_ARGUMENT],
["--prefix", "-p", GetoptLong::OPTIONAL_ARGUMENT],
["--qual", "-q", GetoptLong::NO_ARGUMENT],
["--help", "-h", GetoptLong::NO_ARGUMENT]
)
optHash = {}
o... | Ruby |
## todo: integrate HapMap allele frequency as the Prior SNP rate for known SNPs
## estimate the probability of error of raw SNP calls on the condition of:
## 1. quality scores
# 2. longest homopolymer size in a 13-bp reference window centered on the substitution base
# 3. distance to 3' end on the read
# 4. "s... | Ruby |
# input: cross_match -discrep_lists output and the reference sequence
# output: raw SNP list with relevant information
# some part modified from Lei Chen's program
# only do substitutions
require 'getoptlong'
opts = GetoptLong.new(
["--crossmatch", "-x", GetoptLong::REQUIRED_ARGUMENT],
["--reference", "-r"... | Ruby |
# compute coverage for targeted region:
# if the fasta is given, compute the coverage for each base position of the fasta
# if chromosome and s/e of regions are given, compute the targeted regions
require 'getoptlong'
opts = GetoptLong.new(
["--crossmatch", "-x", GetoptLong::REQUIRED_ARGUMENT],
["--output"... | Ruby |
# input: cross_match -discrep_lists output and the reference sequence
# output: raw SNP list with relevant information
# Author: Yufeng "Joshua" Shen
# Dec, 2008
#
# What's new:
# (perhaps) less memory usage
require 'getoptlong'
# global variables
$basechange={"A"=>"T","T"=>"A","G"=>"C","C"=>"G","N"=>"N","X"=... | Ruby |
require 'getoptlong'
require 'rsruby'
r=RSRuby.instance
opts = GetoptLong.new(
["--input", "-i", GetoptLong::REQUIRED_ARGUMENT],
["--pvalue","-p", GetoptLong::REQUIRED_ARGUMENT],
["--help","-h", GetoptLong::REQUIRED_ARGUMENT]
)
optHash = {}
opts.each do |opt, arg|
optHash[opt] = arg
end
... | Ruby |
require 'zlib'
blatResult = ARGV[0]
cut = ARGV[1]
if cut == nil
$cutoffRatio = 0.995
else
$cutoffRatio = cut.to_f
end
reads = {}
if blatResult =~ /.gz$/
fo = Zlib::GzipReader.open(blatResult)
else
fo = File.new(blatResult, 'r')
end
# File.new(blatResult, 'r').each do |line|
fo.each do |line|
next unles... | Ruby |
#!/usr/bin/env ruby
##Intialize directory###############
package=File.dirname(File.expand_path($0))
$stderr.puts package
homeDir=Dir.pwd
inputDir=homeDir+'/input/'
parDir=homeDir+'/par/'
outputDir=homeDir+'/output/'
##Intialize files##################
parFile=parDir+'nqs.par'
fo_par=File.new(parFile,'... | Ruby |
#!/usr/bin/env ruby
require 'getoptlong'
require 'bigdecimal'
opts = GetoptLong.new(
["--input", "-i", GetoptLong::REQUIRED_ARGUMENT]
)
optHash = {}
opts.each do |opt, arg|
optHash[opt] = arg
end
homeDir=Dir.pwd
outputDir=homeDir+'/output/'
file_name=File.basename(optHash["--input"])
file_pat... | Ruby |
#!/usr/bin/env ruby
homeDir=Dir.pwd
#$stderr.puts homeDir
#homeDir=File.dirname(File.expand_path($1))
$stderr.puts homeDir
outputDir=homeDir+'/output/'
concensusDir=homeDir+'/consensus/'
inputDir=homeDir+'/input/'
parDir=homeDir+'/par/'
refDir=homeDir+'/references/'
#refDir=homeDir+'/references/'
file_pa... | Ruby |
#!/usr/bin/env ruby
##Intialize directory###############
package=File.dirname(File.expand_path($0))
$stderr.puts package
homeDir=Dir.pwd
inputDir=homeDir+'/input/'
parDir=homeDir+'/par/'
outputDir=homeDir+'/output/'
##Intialize files##################
parFile=parDir+'nqs.par'
fo_par=File.new(parFile,'... | Ruby |
## synonymous, non-synonymous, etc
# use BioRuby, could be replaced by simple Hash with a codon table.
# todo: output gene sequences with mutation in it -- for calculation of KaKs.
# question: how to deal with heterozygous SNPs?
# input : reference sequence, exon coordinates, and SNP list
require 'bio'
require '... | Ruby |
require 'getoptlong'
#Program Overview:
# 'atlasSubstitution.rb' is used to parse out the substitutions from the crossmatch result and list
# all of these substitutions including their corresponding coordination on reference, coverage, number of
# variation, the variant reads information etc. As a necessary step... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.