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
f = File.open("A-large-practice.in") | |
num_testcases = f.readline.strip.to_i | |
casenumber = 1 | |
num_testcases.times do | |
credit = f.readline.strip.to_i | |
num_items = f.readline.strip.to_i | |
prices = f.readline.split(' ').collect {|x| x.to_i} |
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
f = File.open("B-large-practice.in") | |
num_testcases = f.readline.to_i | |
(1..num_testcases).each do |casenumber| | |
words = f.readline.split(' ') | |
print "Case #" + casenumber.to_s + ": " | |
words.reverse.each { |word| print word + " "} | |
print "\n" |
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
import static org.junit.Assert.assertEquals; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Iterator; | |
import java.util.List; | |
import org.junit.Test; | |
class Merger { |
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
require 'rubygems' | |
require 'bio' | |
seq = Bio::Sequence::NA.new("atgcagctctttgtccgcgcccaggagctacacaccttcgaggtgaccggccaggaaacggtcgcccagatcaaggctcatgtagcctcactggagggcattgccccggaagatcaagtcgtgctcctggcaggcgcgcccctggaggatgaggccactctgggccagtgcggggtggaggccctgactaccctggaagtagcaggccgcatgcttggaggtaaagtccatggttccctggcccgtgctggaaaagtgagaggtcagactcctaaggtggccaaacaggagaagaagaagaagaagacaggtcgggctaagcggcggatgcagtacaaccggcgctttgtcaacgttgtgcccacctttggcaagaagaagggccccaatgccaactcttaa") | |
remote = Bio::Blast.remote('blastn', 'genes-nt', '-e 0.01') | |
blobj = remote.query(seq) | |
blobj.each_hit do |hit| | |
puts "#{hit.target_def} #{hit.evalue}" | |
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
require 'rubygems' | |
require 'bio' | |
blaster = Bio::Blast.local("tblastx", "/Users/philipp/Dropbox/IDP/ESTs/Ephydatia_muelleri/Ephydatia_muelleri", "", "/Users/philipp/Downloads/blast-2.2.25/bin/blastall") | |
sequence = ">EM1c1_molpal [Ephydatia_muelleri]\nGTTTTGTACAAGAAGACCATTCATAAGAACAATATTGATGACCACACAGTACACTAGAAG" | |
fasta = Bio::FastaFormat.new(sequence) | |
result = fasta.query(blaster) | |
puts result.hits.length | |
fasta.entry() | |
result = fasta.query(blaster) |
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/bash | |
echo $* | |
RUBY_VERSION=/usr/bin/env ruby -v | |
echo $RUBY_VERSION | |
if [[ $RUBY_VERSION == "jruby*" ]]; | |
then | |
echo "JRUBY\!" | |
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
if RUBY_PLATFORM =~ /java/ | |
puts "JRUBY!" | |
command = "ruby -J-Xmx2g " + File.join(File.dirname(__FILE__), '..', 'lib/hello.rb') | |
system(command) | |
else | |
puts "MRI" | |
command = "ruby " + File.join(File.dirname(__FILE__), '..', 'lib/hello.rb') | |
system(command) | |
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
JRUBY! | |
warning: -J-Xmx2g argument ignored (launched in same VM?) | |
Hello | |
Still there? |
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/bash | |
params=$* | |
ruby_version=$(ruby -v) | |
echo $ruby_version | |
dir=$(dirname $0) | |
if [[ $ruby_version == jruby* ]]; | |
then | |
ruby "-J-Xmx2g" "${dir}/lib/annotate-gff.rb" ${params} | |
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
#!/Users/philipp/.rvm/rubies/ruby-1.9.2-p180/bin/ruby | |
# | |
# This file was generated by RubyGems. | |
# | |
# The application 'annotate-gff' is installed as part of a gem, and | |
# this file is here to facilitate running it. | |
# | |
require 'rubygems' |
OlderNewer