panacheextract 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/panacheextract.rb +92 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7c47ef9d287de51706ed3392b4cb172077b21f203dcda5df4f91249f1af85e2a
4
+ data.tar.gz: 8a36048fe0516f70386ff1f8031c8edf516fa3f178d2269c2595ea34a56da044
5
+ SHA512:
6
+ metadata.gz: 1654b6df0c0c3435ddef07ac440b55a21f4c5336d9bf80e885519245fc0db900714fa2106eb855c91696258b39a8dc4035cb3aefe13e68c39bca8d58a476c245
7
+ data.tar.gz: f86c07f3e77e30c4db796d01d3fdf700f0395edf822a2f8ab8e8dbcc36b466c3544d50e0b87dc694dd5b79b06278591261a72dd17803cf352711afc3ab6063cb
@@ -0,0 +1,92 @@
1
+ #!/usr/bin/ruby
2
+ =begin
3
+ Author Gaurav Sablok
4
+ Universitat Potsdam
5
+ Date: 2024-4-8
6
+ a block comment iterator for the taf files using the hash iterator.
7
+ for faster iterations, i implemented the alignment corrdinate as a key unique,
8
+ so that it can be called easily. Instead of iterating through the lines, i stored
9
+ the values in a hash and then implemented the hash search, so that it search for
10
+ those specific hashes rather than going line by line.
11
+ =end
12
+
13
+ CLASS READTAF
14
+ =begin
15
+ a class initator and use this with the input file
16
+ to initiate the class for the file reading and then
17
+ use the additional functions to make the taf file format
18
+ conversions.
19
+ =end
20
+ def inititalize(inputfile, outputfile, stringvalues, sequenceids)
21
+ =begin
22
+ stringvalues represent the column third of the MAF alignments
23
+ =end
24
+ @readfile = inputfile
25
+ @outputfile = outfile
26
+ end
27
+
28
+ def getspecific(ids, inputalignment, outalignmentfile)
29
+ readiter = File.open(inputalignment, "r").readlines
30
+ writefile = File.new(outalignmentfile, "w")
31
+ for i in 0..readiter.length
32
+ writefile.write(readiter[i]) if readiter[i].to_s.strip.split[0] == "s"
33
+ end
34
+ writefile.close
35
+ readopen = File.open(outalignmentfile, "r").readlines
36
+ idsequences = []
37
+ idstrings = []
38
+ for i in 0..readopen.length
39
+ idsequences.push(readopen[i].to_s.strip.split[6])
40
+ idstrings.push(readopen[i].to_s.strip.split[1])
41
+ end
42
+ select = []
43
+ for i in 0..idstrings.length
44
+ select.push([idstrings[i],idsequences[i]]) if idstrings[i] == ids
45
+ end
46
+ return(select)
47
+ end
48
+
49
+ def getspecific(ids, inputalignment, outalignmentfile, del = "None")
50
+ if del == "None"
51
+ readiter = File.open(inputalignment, "r").readlines
52
+ writefile = File.new(outalignmentfile, "w")
53
+ for i in 0..readiter.length
54
+ writefile.write(readiter[i]) if readiter[i].to_s.strip.split[0] == "s"
55
+ end
56
+ writefile.close
57
+ readopen = File.open(outalignmentfile, "r").readlines
58
+ idsequences = []
59
+ idstrings = []
60
+ for i in 0..readopen.length
61
+ idsequences.push(readopen[i].to_s.strip.split[6])
62
+ idstrings.push(readopen[i].to_s.strip.split[1])
63
+ end
64
+ select = []
65
+ for i in 0..idstrings.length
66
+ select.push([idstrings[i],idsequences[i]]) if idstrings[i] == ids
67
+ end
68
+ return(select)
69
+ end
70
+ if del != "None"
71
+ readiter = File.open(inputalignment, "r").readlines
72
+ writefile = File.new(outalignmentfile, "w")
73
+ for i in 0..readiter.length
74
+ writefile.write(readiter[i]) if readiter[i].to_s.strip.split[0] == "s"
75
+ end
76
+ writefile.close
77
+ readopen = File.open(outalignmentfile, "r").readlines
78
+ idsequences = []
79
+ idstrings = []
80
+ for i in 0..readopen.length
81
+ idsequences.push(readopen[i].to_s.strip.split[6])
82
+ idstrings.push(readopen[i].to_s.strip.split[1])
83
+ end
84
+ select = []
85
+ for i in 0..idstrings.length
86
+ select.push([idstrings[i],idsequences[i]]) if idstrings[i] == ids
87
+ end
88
+ delselect = []
89
+ select.each { | iter | delselect.push(iter) if iter[1].count("-") >= 1 }
90
+ return(delselect)
91
+ end
92
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: panacheextract
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gaurav Sablok
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-04-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/panacheextract.rb
20
+ homepage: https://github.com/sablokgaurav/maf-taf-panache
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.3.5
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: making handling of the maf and the taf files easier, extraction of the alignments,
43
+ alignments with deletions, specific ids, sequences associated with specific ids
44
+ test_files: []