pasv_lib 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: df461385c8a2bf6b7bb2052e6036765c45171b23
4
+ data.tar.gz: 832627db920a572f5235f72dc40404af49ee9ec8
5
+ SHA512:
6
+ metadata.gz: 02e27066e616a082b524da16745e9cc5504e70afb86f10ae0f33709fb3dd09793ea1fc33f4524f3578c889dd8d07003b4aee1ea5d8dc5a57498416f860bf21d4
7
+ data.tar.gz: a47f4f65fe15e78f357ef58cf997e2fd6b8807aaf076589a4beb023a254a41fc0db7aaac2ef3116d8716fdeff5f0614aa4999a42cd36cadd328630857b72ad21
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at moorer@udel.edu. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in pasv_lib.gemspec
6
+ gemspec
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # PasvLib
2
+
3
+ Library code for [PASV](http://www.github.com/mooreyan/pasv).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'pasv_lib'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install pasv_lib
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[mooreryan]/pasv_lib. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+
35
+ ## Code of Conduct
36
+
37
+ Everyone interacting in the PasvLib project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[mooreryan]/pasv_lib/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pasv_lib"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/pasv_lib.rb ADDED
@@ -0,0 +1,137 @@
1
+ require "pasv_lib/version"
2
+
3
+ module PasvLib
4
+ module CoreExtensions
5
+ module Time
6
+ def date_and_time fmt="%F %T.%L"
7
+ Object::Time.now.strftime fmt
8
+ end
9
+
10
+ def time_it title="", logger=nil, run: true
11
+ if run
12
+ t = Object::Time.now
13
+
14
+ yield
15
+
16
+ time = Object::Time.now - t
17
+
18
+ if title == ""
19
+ msg = "Finished in #{time} seconds"
20
+ else
21
+ msg = "#{title} finished in #{time} seconds"
22
+ end
23
+
24
+ if logger
25
+ logger.info msg
26
+ else
27
+ $stderr.puts msg
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ module Process
34
+ include CoreExtensions::Time
35
+
36
+ def run_it *a, &b
37
+ exit_status, stdout, stderr = systemu *a, &b
38
+
39
+
40
+ puts stdout unless stdout.empty?
41
+ unless stderr.empty? || stderr.include?("Insecure world writable dir")
42
+ $stderr.puts stderr
43
+ end
44
+
45
+ exit_status
46
+ end
47
+
48
+ def run_it! *a, &b
49
+ exit_status = self.run_it *a, &b
50
+
51
+ # Sometimes, exited? is not true and there will be no exit
52
+ # status. Success should catch all failures.
53
+ AbortIf.abort_unless exit_status.success?,
54
+ "Command failed with status " +
55
+ "'#{exit_status.to_s}' " +
56
+ "when running '#{a.inspect}', " +
57
+ "'#{b.inspect}'"
58
+
59
+ exit_status
60
+ end
61
+
62
+ # Examples
63
+ #
64
+ # Process.extend CoreExtensions::Process
65
+ # Time.extend CoreExtensions::Time
66
+ #
67
+ # Process.run_and_time_it! "Saying hello",
68
+ # %Q{echo "hello world"}
69
+ #
70
+ # Process.run_and_time_it! "This will raise SystemExit",
71
+ # "ls arstoeiarntoairnt" do
72
+ # puts "i like pie"
73
+ # end
74
+ def run_and_time_it! title="",
75
+ cmd="",
76
+ logger=AbortIf::logger,
77
+ &b
78
+
79
+ AbortIf.logger.debug { "Running: #{cmd}" }
80
+
81
+ time_it title, logger do
82
+ run_it! cmd, &b
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ module Utils
89
+ # @note Takes 1-based coordinates.
90
+ def spans_start query_seq, gapped_start
91
+ !query_seq[0..gapped_start-1].tr("-", "").empty?
92
+ end
93
+
94
+ # @note Takes 1-based coordinates.
95
+ def spans_end query_seq, gapped_end
96
+ !query_seq[gapped_end-1..query_seq.length-1].tr("-", "").empty?
97
+ end
98
+
99
+ # @note Returns a hash that accepts and returns 1-based coordinates.
100
+ def pos_to_gapped_pos gapped_key_seq
101
+ pos_to_gapped_pos = {}
102
+ nongap_idx = 0
103
+
104
+ gapped_key_seq.each_char.with_index do |char, gapped_idx|
105
+ unless char == "-"
106
+ pos_to_gapped_pos[nongap_idx + 1] = (gapped_idx + 1)
107
+
108
+ nongap_idx += 1
109
+ end
110
+ end
111
+
112
+ pos_to_gapped_pos
113
+ end
114
+
115
+ # @note The key posns are 1-based and non-gapped. The query seq
116
+ # is gapped.
117
+ def get_oligo gapped_query_seq, key_posns, pos_to_gapped_pos
118
+ gapped_key_posns = key_posns.map do |pos|
119
+ pos_to_gapped_pos[pos]
120
+ end
121
+
122
+ gapped_key_posns.map do |pos|
123
+ idx = pos - 1
124
+
125
+ gapped_query_seq[idx]
126
+ end.join.upcase
127
+ end
128
+
129
+ def get_type oligo, spans
130
+ if spans == "NA"
131
+ oligo
132
+ else
133
+ "#{oligo}_#{spans}"
134
+ end
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,3 @@
1
+ module PasvLib
2
+ VERSION = "0.1.0"
3
+ end
data/pasv_lib.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "pasv_lib/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pasv_lib"
8
+ spec.version = PasvLib::VERSION
9
+ spec.authors = ["Ryan Moore"]
10
+ spec.email = ["moorer@udel.edu"]
11
+
12
+ spec.summary = %q{Library code for PASV}
13
+ # spec.description = %q{TODO: Write a longer description or delete this line.}
14
+ spec.homepage = "http://www.github.com/mooreryan/pasv_lib"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.15"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec", "~> 3.0"
26
+
27
+ spec.add_runtime_dependency "systemu", "~> 2.6", ">= 2.6.5"
28
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pasv_lib
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Moore
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: systemu
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.6'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 2.6.5
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '2.6'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 2.6.5
75
+ description:
76
+ email:
77
+ - moorer@udel.edu
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - ".gitignore"
83
+ - ".rspec"
84
+ - ".travis.yml"
85
+ - CODE_OF_CONDUCT.md
86
+ - Gemfile
87
+ - README.md
88
+ - Rakefile
89
+ - bin/console
90
+ - bin/setup
91
+ - lib/pasv_lib.rb
92
+ - lib/pasv_lib/version.rb
93
+ - pasv_lib.gemspec
94
+ homepage: http://www.github.com/mooreryan/pasv_lib
95
+ licenses: []
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.6.14
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: Library code for PASV
117
+ test_files: []