gfa 0.5.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gfa-add-gaf +7 -5
- data/bin/gfa-mean-depth +37 -0
- data/bin/gfa-merge +34 -0
- data/bin/gfa-paths-to-fasta +29 -0
- data/lib/gfa/common.rb +13 -0
- data/lib/gfa/graph.rb +1 -1
- data/lib/gfa/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf18e4a80f49fc9c0ae4574c5c7bbc3c97fd41eaf5c7aff9fdd7991b7d562ccf
|
4
|
+
data.tar.gz: ac6999ffbbbeba45f9b81c6081ac16339ce4bb55502a77b116c77f91870af991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8ae1b273166574d8520aa1f747ac0dbd08e8f31846754ca6c3fa7f0432d5f31583aa915fcebb04a220e90fe14aeeb4f06dec2a5c23527571c9bb337de0ef9a5
|
7
|
+
data.tar.gz: f5fce0959cace1fe961d92fab2946bf8b67571ee6ceef3cd6e7047d8c46f0855b28e6b703ffbfe327ef8d09e1174b94ee98423ae36bb858bab76615849e0bd94
|
data/bin/gfa-add-gaf
CHANGED
@@ -18,11 +18,13 @@ unless degree
|
|
18
18
|
<input-gaf> Input GAF file to read
|
19
19
|
<output> Output GFA file to write
|
20
20
|
<degree> Maximum degree of separation between the segment set in the GAF
|
21
|
-
and any other
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
and any other segments included in the output GFA.
|
22
|
+
- -1: include the complete original GAF without subsetting.
|
23
|
+
- 0: only segments in the GAF are included.
|
24
|
+
- 1: only the target segments in the GAF, records linking to
|
25
|
+
them, and segments linked by those records are included.
|
26
|
+
- Any integer > 1: include additional expansion rounds for
|
27
|
+
those linked segments.
|
26
28
|
<pref> A prefix to name all recorded paths
|
27
29
|
By default: Based on the GAF file name
|
28
30
|
<threads> If passed, parallelize process with these many threads
|
data/bin/gfa-mean-depth
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# @package MiGA
|
4
|
+
# @license Artistic-2.0
|
5
|
+
|
6
|
+
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
7
|
+
$LOAD_PATH.push File.expand_path('../../lib', File.realpath(__FILE__))
|
8
|
+
|
9
|
+
require 'gfa'
|
10
|
+
|
11
|
+
input, threads = ARGV
|
12
|
+
|
13
|
+
unless input
|
14
|
+
$stderr.puts <<~HELP
|
15
|
+
Calculate the average sequencing depth of all segments in the GFA
|
16
|
+
weighted by the segment lengths
|
17
|
+
|
18
|
+
gfa-mean-depth <input> [<threads>]
|
19
|
+
|
20
|
+
<input> Input GFA file to read
|
21
|
+
<threads> If passed, parallelize process with these many threads
|
22
|
+
HELP
|
23
|
+
exit(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
$stderr.puts "Loading GFA: #{input}"
|
27
|
+
gfa = GFA.load_parallel(input, (threads || 1).to_i)
|
28
|
+
|
29
|
+
$stderr.puts 'Calculating average depth'
|
30
|
+
n = gfa.total_length
|
31
|
+
avg =
|
32
|
+
gfa.segments.set.map do |segment|
|
33
|
+
raise "Some segments are missing depth data" unless segment.DP
|
34
|
+
segment.DP.value * segment.length / n
|
35
|
+
end.inject(:+)
|
36
|
+
puts avg
|
37
|
+
|
data/bin/gfa-merge
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# @package MiGA
|
4
|
+
# @license Artistic-2.0
|
5
|
+
|
6
|
+
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
7
|
+
$LOAD_PATH.push File.expand_path('../../lib', File.realpath(__FILE__))
|
8
|
+
|
9
|
+
require 'gfa'
|
10
|
+
|
11
|
+
output = ARGV.shift
|
12
|
+
input = ARGV
|
13
|
+
|
14
|
+
if input.empty?
|
15
|
+
$stderr.puts <<~HELP
|
16
|
+
Combine several GFAs into a single GFA. Requires uniqueness of element names
|
17
|
+
|
18
|
+
gfa-merge <output> <input...>
|
19
|
+
|
20
|
+
<output> Output GFA file to be created
|
21
|
+
<input...> List of input GFA files to read
|
22
|
+
HELP
|
23
|
+
exit(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
gfa = GFA.new
|
27
|
+
input.each do |i|
|
28
|
+
$stderr.puts "Merging GFA: #{i}"
|
29
|
+
gfa.merge! GFA.load(i)
|
30
|
+
end
|
31
|
+
|
32
|
+
$stderr.puts "Saving GFA: #{output}"
|
33
|
+
gfa.save(output)
|
34
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# @package MiGA
|
4
|
+
# @license Artistic-2.0
|
5
|
+
|
6
|
+
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
7
|
+
$LOAD_PATH.push File.expand_path('../../lib', File.realpath(__FILE__))
|
8
|
+
|
9
|
+
require 'gfa'
|
10
|
+
|
11
|
+
input, output, threads = ARGV
|
12
|
+
|
13
|
+
unless output
|
14
|
+
$stderr.puts <<~HELP
|
15
|
+
Extract the sequences of the paths from a GFA to FastA file
|
16
|
+
|
17
|
+
gfa-merge <input> <output> [<threads>]
|
18
|
+
|
19
|
+
<input> Input GFA file to read
|
20
|
+
<output> Output FastA file to be created
|
21
|
+
<threads> If passed, parallelize process with these many threads
|
22
|
+
HELP
|
23
|
+
exit(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
$stderr.puts "Loading GFA: #{input}"
|
27
|
+
gfa = GFA.load_parallel(input, (threads || 1).to_i)
|
28
|
+
|
29
|
+
|
data/lib/gfa/common.rb
CHANGED
@@ -67,4 +67,17 @@ class GFA
|
|
67
67
|
def total_length
|
68
68
|
segments.total_length
|
69
69
|
end
|
70
|
+
|
71
|
+
##
|
72
|
+
# Adds the entrie of +gfa+ to itself
|
73
|
+
def merge!(gfa)
|
74
|
+
records.each { |k, v| v.merge!(gfa.records[k]) }
|
75
|
+
self
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# Creates a new GFA based on itself and appends all entries in +gfa+
|
80
|
+
def merge(gfa)
|
81
|
+
GFA.new(opts).merge!(self).merge!(gfa)
|
82
|
+
end
|
70
83
|
end
|
data/lib/gfa/graph.rb
CHANGED
@@ -146,7 +146,7 @@ class GFA
|
|
146
146
|
|
147
147
|
def internally_linking_records(segments, edges)
|
148
148
|
$stderr.puts '- Gathering internally linking records'
|
149
|
-
segments = Hash[segments.
|
149
|
+
segments = Hash[segments.map { |i| [i.name.value, true]}]
|
150
150
|
edges.select { |record| record.segment_names_a.all? { |s| segments[s] } }
|
151
151
|
end
|
152
152
|
|
data/lib/gfa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gfa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis M. Rodriguez-R
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rgl
|
@@ -65,6 +65,9 @@ files:
|
|
65
65
|
- Rakefile
|
66
66
|
- bin/gfa-add-gaf
|
67
67
|
- bin/gfa-greedy-modules
|
68
|
+
- bin/gfa-mean-depth
|
69
|
+
- bin/gfa-merge
|
70
|
+
- bin/gfa-paths-to-fasta
|
68
71
|
- bin/gfa-subgraph
|
69
72
|
- lib/gfa.rb
|
70
73
|
- lib/gfa/common.rb
|