bio-samtools 2.0.3 → 2.0.4

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: f0608dfce24db2fd3c26be69e04123961209e855
4
- data.tar.gz: b79cd69ebe66928a53ca9d45f122b1e9538e8c51
3
+ metadata.gz: f871729e2c0ab8ac18082913e4d6897620e87c32
4
+ data.tar.gz: 8080e5cb42c5fe72a75ca6d884c5751a25225d26
5
5
  SHA512:
6
- metadata.gz: 60c24c8f5288fc92004b9c96af57d3821d220e2c79cceb7b6283480ac37735e9b7af70ac3129779ac13602599e45afb81ba35480461630c3f9669f788ebd1759
7
- data.tar.gz: 716ff9d093fc0ad485ae2dc687dca44aeaa30da77c3e38b32856c194306f5b6f01e8bffe1d5a3da81506d50633cb014bd68b814dd8b518f6559bf0f9c617b7ba
6
+ metadata.gz: 9a03afb21028e6fdd1b0f1ef3693d4cf6695be8f490c06a93e2dea3983a9c110fa6a3f128cfdf7d2aff29ababbf0ad0e57f4469d9a9cc67aee218582bc2aa6f4
7
+ data.tar.gz: dd42a06d8c8d3ac22de82ece17ee25a7c663475b5fb3283a35f190953f67eafb2ae2ba1390f1de6cfc042b7b05b30675d26a2953985363184a48dc24faf11027
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.3
1
+ 2.0.4
data/bio-samtools.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: bio-samtools 2.0.3 ruby lib
5
+ # stub: bio-samtools 2.0.4 ruby lib
6
6
  # stub: ext/mkrf_conf.rb
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "bio-samtools"
10
- s.version = "2.0.3"
10
+ s.version = "2.0.4"
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.require_paths = ["lib"]
14
14
  s.authors = ["Ricardo Ramirez-Gonzalez", "Dan MacLean", "Raoul J.P. Bonnal"]
15
- s.date = "2014-04-18"
15
+ s.date = "2014-04-28"
16
16
  s.description = "Binder of samtools for ruby, on the top of FFI. \n\n This project was born from the need to add support of BAM files to \n the gee_fu genome browser (http://github.com/danmaclean/gee_fu)."
17
17
  s.email = "ilpuccio.febo@gmail.com"
18
18
  s.extensions = ["ext/mkrf_conf.rb"]
data/lib/bio-samtools.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'open3'
1
2
  require 'bio-svgenes'
2
3
  require 'bio'
3
4
  require 'bio/db/sam'
@@ -5,5 +6,4 @@ require 'bio/db/pileup'
5
6
  require 'bio/db/vcf'
6
7
  require 'bio/db/alignment'
7
8
  require 'bio/db/fastadb'
8
- require 'open3'
9
9
  require 'bio/BIOExtensions'
@@ -18,11 +18,12 @@ module Bio
18
18
  class Alignment
19
19
  attr_accessor :qname, :flag, :rname,:pos,:mapq,:cigar, :mrnm, :mpos, :isize, :seq, :qual, :tags, :al, :samstr, :calend, :qlen
20
20
 
21
- attr_accessor :is_paired, :is_mapped, :query_unmapped, :mate_unmapped, :query_strand, :mate_strand, :first_in_pair,:second_in_pair, :primary, :failed_quality, :is_duplicate
21
+ attr_accessor :sam_string, :is_paired, :is_mapped, :query_unmapped, :mate_unmapped, :query_strand, :mate_strand, :first_in_pair,:second_in_pair, :primary, :failed_quality, :is_duplicate
22
22
 
23
23
  #parses the SAM string into its constituents and set its attributes
24
24
  def initialize(sam_string)
25
25
  s = sam_string.chomp.split("\t")
26
+ @sam_string = sam_string
26
27
  @qname = s[0]
27
28
  @flag = s[1].to_i
28
29
  @rname = s[2]
@@ -214,7 +214,7 @@ module Bio::DB::Fasta
214
214
  query = region.to_s
215
215
  query = region.to_region.to_s if region.respond_to?(:to_region)
216
216
  command = "#{@samtools} faidx #{@fasta_path} '#{query}'"
217
- puts command
217
+ puts command if $VERBOSE
218
218
  @last_command = command
219
219
  seq = ""
220
220
  yield_from_pipe(command, String, :text ) {|line| seq = seq + line unless line =~ /^>/}
data/lib/bio/db/sam.rb CHANGED
@@ -356,6 +356,26 @@ module Bio
356
356
  end
357
357
 
358
358
  alias_method :idxstats, :index_stats
359
+
360
+ #Retrive a hash with all the regions, with the region id as index or runs the function on each region
361
+ def each_region
362
+ stats=index_stats unless @stats
363
+ if @regions
364
+ return @regionss unless block_given?
365
+ else
366
+ @regions = Hash.new
367
+ end
368
+ stats.each do |k,v|
369
+ reg = Bio::DB::Fasta::Region
370
+ reg.entry = k
371
+ reg.start = 1
372
+ reg.end = v[:length]
373
+ reg.orientation = :forward
374
+
375
+ yield reg if block_given?
376
+ end
377
+ @regions
378
+ end
359
379
 
360
380
  #Merge multiple sorted alignments
361
381
  #* n - sort by read names
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bio-samtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Ramirez-Gonzalez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-18 00:00:00.000000000 Z
13
+ date: 2014-04-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bio-svgenes