wrnap 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cced186ba484ebc70d540fe101ff4759d2eb3c47
4
- data.tar.gz: 7fd6be4f1939b038711422c97a070baab330303c
3
+ metadata.gz: cefe9e6fe3cf4bf1b3be6b6a3736811b1ffaaf27
4
+ data.tar.gz: de8eecb67814098f053eb2c6dbd83fa082d57e2c
5
5
  SHA512:
6
- metadata.gz: c02bfb4374a250c235e9f31f35aad4fe495398e867f1584efe446fda114b873904864c165f7b19c13d129935df2b9f0037af8a7f17b14f04f896e306e57076fc
7
- data.tar.gz: 37674ca85c4a31fe90dc97a032358735b7aad243a5a2507433ea227828170f9647ef4afa52fe9e22c96aae7353784714dd40d353fc6da47db1c3d2abf52a228a
6
+ metadata.gz: 4ffa744e8f49dd166642309710ec373b756af413127b65c4e812a6982794328d929f86add790264c8179030100145630a1fd6ac4be925cd7ccf216bab6a1f825
7
+ data.tar.gz: 5efc6edf99af6535cef344c05ef5a5547e4f8d77549e2540c12f2bc57d714517f9fee4597a3ac86bf5e1d029b4622a0940c667d597c9e6352f04fa26de1cc173
data/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ wrnap
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build wrnap-0.5.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install wrnap-0.5.1.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.5.1 and build and push wrnap-0.5.1.gem to Rubygems" fullCmd="release" taksId="release" /></RakeGroup></Settings>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
data/.idea/misc.xml ADDED
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.0.0-p0" project-jdk-type="RUBY_SDK" />
4
+ </project>
5
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/wrnap.iml" filepath="$PROJECT_DIR$/.idea/wrnap.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
7
+
@@ -0,0 +1,169 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="f215766d-a45c-47cc-a7d7-9487868cd8b4" name="Default" comment="">
5
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/wrnap/package/base.rb" afterPath="$PROJECT_DIR$/lib/wrnap/package/base.rb" />
6
+ </list>
7
+ <ignored path="wrnap.iws" />
8
+ <ignored path=".idea/workspace.xml" />
9
+ <option name="TRACKING_ENABLED" value="true" />
10
+ <option name="SHOW_DIALOG" value="false" />
11
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
12
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
13
+ <option name="LAST_RESOLUTION" value="IGNORE" />
14
+ </component>
15
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
16
+ <component name="CreatePatchCommitExecutor">
17
+ <option name="PATCH_PATH" value="" />
18
+ </component>
19
+ <component name="DaemonCodeAnalyzer">
20
+ <disable_hints />
21
+ </component>
22
+ <component name="FavoritesManager">
23
+ <favorites_list name="wrnap" />
24
+ </component>
25
+ <component name="FileEditorManager">
26
+ <leaf>
27
+ <file leaf-file-name="wrnap.rb" pinned="false" current="true" current-in-tab="true">
28
+ <entry file="file://$PROJECT_DIR$/lib/wrnap.rb">
29
+ <provider selected="true" editor-type-id="text-editor">
30
+ <state vertical-scroll-proportion="-0.074179746" vertical-offset="52" max-vertical-offset="1183">
31
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
32
+ <folding />
33
+ </state>
34
+ </provider>
35
+ </entry>
36
+ </file>
37
+ </leaf>
38
+ </component>
39
+ <component name="FindManager">
40
+ <FindUsagesManager>
41
+ <setting name="OPEN_NEW_TAB" value="true" />
42
+ </FindUsagesManager>
43
+ </component>
44
+ <component name="Git.Settings">
45
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
46
+ </component>
47
+ <component name="ProjectFrameBounds">
48
+ <option name="y" value="22" />
49
+ <option name="width" value="1280" />
50
+ <option name="height" value="774" />
51
+ </component>
52
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
53
+ <OptionsSetting value="true" id="Add" />
54
+ <OptionsSetting value="true" id="Remove" />
55
+ <OptionsSetting value="true" id="Checkout" />
56
+ <OptionsSetting value="true" id="Update" />
57
+ <OptionsSetting value="true" id="Status" />
58
+ <OptionsSetting value="true" id="Edit" />
59
+ <ConfirmationsSetting value="0" id="Add" />
60
+ <ConfirmationsSetting value="0" id="Remove" />
61
+ </component>
62
+ <component name="ProjectReloadState">
63
+ <option name="STATE" value="0" />
64
+ </component>
65
+ <component name="ProjectView">
66
+ <navigator currentView="ProjectPane" proportions="" version="1">
67
+ <flattenPackages />
68
+ <showMembers />
69
+ <showModules />
70
+ <showLibraryContents />
71
+ <hideEmptyPackages />
72
+ <abbreviatePackageNames />
73
+ <autoscrollToSource />
74
+ <autoscrollFromSource />
75
+ <sortByType />
76
+ </navigator>
77
+ <panes>
78
+ <pane id="ProjectPane">
79
+ <subPane>
80
+ <PATH>
81
+ <PATH_ELEMENT>
82
+ <option name="myItemId" value="wrnap" />
83
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
84
+ </PATH_ELEMENT>
85
+ </PATH>
86
+ </subPane>
87
+ </pane>
88
+ <pane id="Scope" />
89
+ </panes>
90
+ </component>
91
+ <component name="PropertiesComponent">
92
+ <property name="WebServerToolWindowFactoryState" value="false" />
93
+ <property name="options.lastSelected" value="reference.settingsdialog.IDE.editor.colors.Font" />
94
+ <property name="options.splitter.main.proportions" value="0.3" />
95
+ <property name="options.splitter.details.proportions" value="0.2" />
96
+ <property name="options.searchVisible" value="true" />
97
+ <property name="FullScreen" value="false" />
98
+ </component>
99
+ <component name="RunManager">
100
+ <list size="0" />
101
+ </component>
102
+ <component name="ShelveChangesManager" show_recycled="false" />
103
+ <component name="SvnConfiguration">
104
+ <configuration />
105
+ </component>
106
+ <component name="TaskManager">
107
+ <task active="true" id="Default" summary="Default task">
108
+ <changelist id="f215766d-a45c-47cc-a7d7-9487868cd8b4" name="Default" comment="" />
109
+ <created>1399483991383</created>
110
+ <updated>1399483991383</updated>
111
+ </task>
112
+ <servers />
113
+ </component>
114
+ <component name="ToolWindowManager">
115
+ <frame x="0" y="22" width="1280" height="774" extended-state="6" />
116
+ <editor active="false" />
117
+ <layout>
118
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32968536" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
119
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
120
+ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
121
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
122
+ <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
123
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
124
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.16796875" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
125
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
126
+ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
127
+ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
128
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25307798" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
129
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
130
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
131
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
132
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
133
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
134
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
135
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
136
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
137
+ </layout>
138
+ </component>
139
+ <component name="Vcs.Log.UiProperties">
140
+ <option name="RECENTLY_FILTERED_USER_GROUPS">
141
+ <collection />
142
+ </option>
143
+ <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
144
+ <collection />
145
+ </option>
146
+ </component>
147
+ <component name="VcsContentAnnotationSettings">
148
+ <option name="myLimit" value="2678400000" />
149
+ </component>
150
+ <component name="VcsManagerConfiguration">
151
+ <option name="myTodoPanelSettings">
152
+ <TodoPanelSettings />
153
+ </option>
154
+ </component>
155
+ <component name="XDebuggerManager">
156
+ <breakpoint-manager />
157
+ </component>
158
+ <component name="editorHistoryManager">
159
+ <entry file="file://$PROJECT_DIR$/lib/wrnap.rb">
160
+ <provider selected="true" editor-type-id="text-editor">
161
+ <state vertical-scroll-proportion="-0.074179746" vertical-offset="52" max-vertical-offset="1183">
162
+ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
163
+ <folding />
164
+ </state>
165
+ </provider>
166
+ </entry>
167
+ </component>
168
+ </project>
169
+
data/.idea/wrnap.iml ADDED
@@ -0,0 +1,49 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="gem" name="Ruby Gem">
5
+ <configuration>
6
+ <option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
7
+ <option name="GEM_APP_TEST_PATH" value="" />
8
+ <option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
9
+ </configuration>
10
+ </facet>
11
+ </component>
12
+ <component name="NewModuleRootManager">
13
+ <content url="file://$MODULE_DIR$" />
14
+ <orderEntry type="inheritedJdk" />
15
+ <orderEntry type="sourceFolder" forTests="false" />
16
+ <orderEntry type="module-library">
17
+ <library name="wrnap (v0.5.1, /Users/evansenter/Source/wrnap) [path][gem]">
18
+ <CLASSES>
19
+ <root url="file://$MODULE_DIR$/lib" />
20
+ <root url="file://$MODULE_DIR$/pkg" />
21
+ <root url="file://$MODULE_DIR$/.idea" />
22
+ </CLASSES>
23
+ <SOURCES>
24
+ <root url="file://$MODULE_DIR$/lib" />
25
+ <root url="file://$MODULE_DIR$/pkg" />
26
+ <root url="file://$MODULE_DIR$/.idea" />
27
+ </SOURCES>
28
+ </library>
29
+ </orderEntry>
30
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v4.1.0, rbenv: 2.0.0-p0) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="bio (v1.4.3.0001, rbenv: 2.0.0-p0) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.6.2, rbenv: 2.0.0-p0) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="entrez (v0.5.8.1, rbenv: 2.0.0-p0) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="hoe (v3.12.0, rbenv: 2.0.0-p0) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="httparty (v0.13.1, rbenv: 2.0.0-p0) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v0.6.9, rbenv: 2.0.0-p0) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, rbenv: 2.0.0-p0) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.3.3, rbenv: 2.0.0-p0) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.5.5, rbenv: 2.0.0-p0) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.2.2, rbenv: 2.0.0-p0) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="rand (v0.9.1, rbenv: 2.0.0-p0) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="rinruby (v2.0.3, rbenv: 2.0.0-p0) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="rroc (v0.1.1, rbenv: 2.0.0-p0) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="shuffle (v0.1.1, rbenv: 2.0.0-p0) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.3, rbenv: 2.0.0-p0) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.1.0, rbenv: 2.0.0-p0) [gem]" level="application" />
47
+ </component>
48
+ </module>
49
+
@@ -39,11 +39,11 @@ module Wrnap
39
39
  data = [data] unless data.is_a?(Array)
40
40
 
41
41
  @data = case data.map(&:class)
42
- when [Wrnap::Global::Rna] then data.first
43
- when *(1..3).map { |i| [String] * i } then RNA.from_string(*data)
44
- when [Hash] then RNA.from_hash(*data)
45
- when [Array] then RNA.from_array(*data)
46
- when [NilClass] then Wrnap::Global::Rna.placeholder
42
+ when [Wrnap::Global::Rna], [Wrnap::Global::Rna::Context] then data.first
43
+ when *(1..3).map { |i| [String] * i } then RNA.from_string(*data)
44
+ when [Hash] then RNA.from_hash(*data)
45
+ when [Array] then RNA.from_array(*data)
46
+ when [NilClass] then Wrnap::Global::Rna.placeholder
47
47
  else raise TypeError.new("Unsupported Wrnap::Global::Rna#initialize format: #{data}")
48
48
  end
49
49
  else
@@ -0,0 +1,20 @@
1
+ module Wrnap
2
+ module Package
3
+ class FftEq < FftEqBase
4
+ attr_reader :equilibrium
5
+
6
+ self.default_flags = ->(context, flags) do
7
+ {
8
+ "-fftbor2d-i" => context.data.seq,
9
+ "-fftbor2d-j" => context.data.str_1,
10
+ "-fftbor2d-k" => context.data.str_2,
11
+ "-population-e" => 1e-4
12
+ }
13
+ end
14
+
15
+ def post_process
16
+ @equilibrium = (response.empty? || response =~ /Infinity/ ? -1 : 10 ** response.strip.to_f)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,22 @@
1
+ module Wrnap
2
+ module Package
3
+ class FftEqBase < Base
4
+ self.executable_name = "FFTeq"
5
+
6
+ self.default_flags = ->(context, flags) do
7
+ {
8
+ "-fftbor2d-i" => context.data.seq,
9
+ "-fftbor2d-j" => context.data.str_1,
10
+ "-fftbor2d-k" => context.data.str_2
11
+ }
12
+ end
13
+ self.quote_flag_params = %w|-fftbor2d-i -fftbor2d-j -fftbor2d-k|
14
+
15
+ def run_command(flags)
16
+ Wrnap.debugger { "Running #{exec_name} on #{data.inspect}" }
17
+
18
+ "%s %s" % [exec_name, stringify_flags(flags)]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,47 @@
1
+ module Wrnap
2
+ module Package
3
+ class FftPopulation < FftEqBase
4
+ THREE_COLUMN_REGEX = /^([+-]\d+\.\d+\t){2}[+-]\d+\.\d+$/
5
+
6
+ attr_reader :starting_population, :target_population
7
+
8
+ class PopulationProportion
9
+ include Enumerable
10
+
11
+ attr_reader :proportion_over_time
12
+
13
+ def initialize(time, proportion)
14
+ @proportion_over_time = time.zip(proportion)
15
+ end
16
+
17
+ def time_range(from, to)
18
+ proportion_over_time.select { |time, _| ((from.to_f)..(to.to_f)) === time }
19
+ end
20
+
21
+ def time_points; proportion_over_time.map(&:first); end
22
+ def proportion_points; proportion_over_time.map(&:last); end
23
+
24
+ def each
25
+ proportion_over_time.each { |_| yield _ }
26
+ end
27
+
28
+ def inspect
29
+ "#<Wrnap::Package::Population::PopulationProportion time: (%f..%f), proportion: (%f..%f)>" % [
30
+ time_points[0],
31
+ time_points[-1],
32
+ proportion_points[0],
33
+ proportion_points[-1],
34
+ ]
35
+ end
36
+ end
37
+
38
+ def post_process
39
+ unless response.empty?
40
+ time_points, target_population, starting_population = response.split(/\n/).select { |line| line =~ THREE_COLUMN_REGEX }.map { |line| line.split(/\t/).map(&:to_f) }.transpose
41
+ @starting_population = PopulationProportion.new(time_points, starting_population)
42
+ @target_population = PopulationProportion.new(time_points, target_population)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
data/lib/wrnap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wrnap
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Senter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-06 00:00:00.000000000 Z
11
+ date: 2014-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,6 +130,15 @@ extensions: []
130
130
  extra_rdoc_files: []
131
131
  files:
132
132
  - ".gitignore"
133
+ - ".idea/.name"
134
+ - ".idea/.rakeTasks"
135
+ - ".idea/encodings.xml"
136
+ - ".idea/misc.xml"
137
+ - ".idea/modules.xml"
138
+ - ".idea/scopes/scope_settings.xml"
139
+ - ".idea/vcs.xml"
140
+ - ".idea/workspace.xml"
141
+ - ".idea/wrnap.iml"
133
142
  - Gemfile
134
143
  - LICENSE.md
135
144
  - README.md
@@ -146,7 +155,10 @@ files:
146
155
  - lib/wrnap/package/base.rb
147
156
  - lib/wrnap/package/energy_grid_2d.rb
148
157
  - lib/wrnap/package/eval.rb
158
+ - lib/wrnap/package/fft_eq.rb
159
+ - lib/wrnap/package/fft_eq_base.rb
149
160
  - lib/wrnap/package/fft_mfpt.rb
161
+ - lib/wrnap/package/fft_population.rb
150
162
  - lib/wrnap/package/fftbor.rb
151
163
  - lib/wrnap/package/fftbor2d.rb
152
164
  - lib/wrnap/package/ffthairpin.rb
@@ -156,7 +168,6 @@ files:
156
168
  - lib/wrnap/package/kinwalker.rb
157
169
  - lib/wrnap/package/mfpt.rb
158
170
  - lib/wrnap/package/plot.rb
159
- - lib/wrnap/package/population.rb
160
171
  - lib/wrnap/package/rna2dfold.rb
161
172
  - lib/wrnap/package/rnabor.rb
162
173
  - lib/wrnap/package/spectral.rb
@@ -1,95 +0,0 @@
1
- module Wrnap
2
- module Package
3
- class Population < Base
4
- THREE_COLUMN_REGEX = /^([+-]\d+\.\d+\t){2}[+-]\d+\.\d+$/
5
-
6
- attr_reader :str_1_to_str_2, :str_1_to_str_1, :equilibrium
7
-
8
- self.default_flags = ->(context, flags) do
9
- {
10
- "-fftbor2d-i" => context.data.seq,
11
- "-fftbor2d-j" => context.data.str_1,
12
- "-fftbor2d-k" => context.data.str_2,
13
- "-spectral-i" => -10,
14
- "-spectral-j" => 10,
15
- "-spectral-p" => 1e-2,
16
- }
17
- end
18
- self.quote_flag_params = %w|-fftbor2d-i -fftbor2d-j -fftbor2d-k|
19
-
20
- class PopulationProportion
21
- include Enumerable
22
-
23
- attr_reader :proportion_over_time
24
-
25
- def initialize(time, proportion)
26
- @proportion_over_time = time.zip(proportion)
27
- end
28
-
29
- def time_range(from, to)
30
- proportion_over_time.select { |time, _| ((from.to_f)..(to.to_f)) === time }
31
- end
32
-
33
- def equilibrium(percentile: 95, window_size: 5, epsilon: 1e-4)
34
- start = proportion_points.first
35
- stop = proportion_points.last
36
-
37
- if start != stop
38
- sign = stop > start ? :increasing : :decreasing
39
- # If the population is increasing over time, we want the 95%, otherwise we want the 5%
40
- spread_100 = (start.zero? || stop.zero? ? [start, stop].max : (stop / start).abs) / 100
41
- # Look for the first index at the percentile we're interested in, and scan to the right from there.
42
- start_index = proportion_points.each_with_index.find do |proportion, i|
43
- case sign
44
- when :increasing then proportion > (stop - (spread_100 * (100 - percentile)))
45
- when :decreasing then proportion < (stop + (spread_100 * (100 - percentile)))
46
- end
47
- end.last
48
-
49
- # The first slice starting at x we find where abs(p(x + i), p(x)) < epslion for all 1 <= x < window_size is equilibrium,
50
- # and we return that time point.
51
- equilibrium_time = proportion_over_time[start_index..-1].each_cons(window_size).find do |proportion_slice|
52
- proportion_slice.all? { |time, proportion| (proportion - proportion_slice.first.last).abs < epsilon }
53
- end
54
-
55
- equilibrium_time ? 10 ** equilibrium_time.first.first : -1
56
- else
57
- -1
58
- end
59
- end
60
-
61
- def time_points; proportion_over_time.map(&:first); end
62
- def proportion_points; proportion_over_time.map(&:last); end
63
-
64
- def each
65
- proportion_over_time.each { |_| yield _ }
66
- end
67
-
68
- def inspect
69
- "#<Wrnap::Package::Population::PopulationProportion time: (%f..%f), proportion: (%f..%f)>" % [
70
- time_points[0],
71
- time_points[-1],
72
- proportion_points[0],
73
- proportion_points[-1],
74
- ]
75
- end
76
- end
77
-
78
- def run_command(flags)
79
- Wrnap.debugger { "Running #{exec_name} on #{data.inspect}" }
80
-
81
- "%s %s" % [exec_name, stringify_flags(flags)]
82
- end
83
-
84
- def post_process
85
- if flags.include?("-spectral-e")
86
- @equilibrium = 10 ** response.strip.to_f
87
- else
88
- time_points, str_1_to_str_2, str_1_to_str_1 = response.split(/\n/).select { |line| line =~ THREE_COLUMN_REGEX }.map { |line| line.split(/\t/).map(&:to_f) }.transpose
89
- @str_1_to_str_2 = PopulationProportion.new(time_points, str_1_to_str_2)
90
- @str_1_to_str_1 = PopulationProportion.new(time_points, str_1_to_str_1)
91
- end
92
- end
93
- end
94
- end
95
- end