report_html 0.4.3 → 0.4.6

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
- SHA1:
3
- metadata.gz: 1adce0447e51e4ea0e9f5e59dbbb3fb3df8676fd
4
- data.tar.gz: d573b07d21953e58f23f13656641f8070a7e8ab5
2
+ SHA256:
3
+ metadata.gz: 42b11e6f7cbc1b41650dec3d46300a4f81400582d19e443a31ada784d5a75876
4
+ data.tar.gz: 43a686a11355a8a15bd1b477f979f13039bd456237c53100583ca3b932188b6f
5
5
  SHA512:
6
- metadata.gz: 74092e520c4454244ba6dbaf290091938f8e723c83082452ee962cd0335230d8510f81319f172fa6ddc3c09bec1046a9b46d3340a652815f7714cbe1e80d4af6
7
- data.tar.gz: c9bdfe76cc85abc3eddaa16e388aff3d5a2add3af1f551f509a1ec388c66d1c312e52676b53934e89d2b6523c08b9d94c5c0b91ce55840cd9ffc96c9b1121205
6
+ metadata.gz: af4adc3696c16ae9912747388bc25e3792357a3565b304d809c1b4bf153e1bec81ada93edb6be73273121794ea55195ab5f74f42d5809be996b389dd5bf24f9d
7
+ data.tar.gz: 7e107643ea36da3a8a7c8257aa6cf481d20c0c08ae1721d347c108e63d3938ef1b71363ea51f03ba16ff53468731206a8a4402768aab82d73bc7a5b0c42abc9a
@@ -400,7 +400,9 @@ class Report_html
400
400
  end
401
401
  values = data_array
402
402
 
403
- yield(options, config, samples, vars, values, object_id)
403
+ x = {}
404
+ z = {}
405
+ yield(options, config, samples, vars, values, object_id, x, z)
404
406
  # Build JSON objects and Javascript code
405
407
  #-----------------------------------------------
406
408
  @count_objects += 1
@@ -409,7 +411,9 @@ class Report_html
409
411
  'vars' => vars,
410
412
  'smps' => samples,
411
413
  'data' => values
412
- }
414
+ },
415
+ 'x' => x,
416
+ 'z' => z
413
417
  }
414
418
  events = false
415
419
  info = false
@@ -442,7 +446,7 @@ class Report_html
442
446
  default_options = {
443
447
  row_names: true
444
448
  }.merge!(user_options)
445
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
449
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
446
450
  config['graphType'] = 'Line'
447
451
  end
448
452
  return html_string
@@ -452,7 +456,7 @@ class Report_html
452
456
  default_options = {
453
457
  row_names: true,
454
458
  }.merge!(user_options)
455
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
459
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
456
460
  config['graphType'] = 'Stacked'
457
461
  end
458
462
  return html_string
@@ -462,17 +466,33 @@ class Report_html
462
466
  default_options = {
463
467
  row_names: true
464
468
  }.merge!(user_options)
465
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
469
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
466
470
  config['graphType'] = 'Bar'
467
471
  end
468
472
  return html_string
469
473
  end
470
474
 
475
+ def dotplot(user_options = {}, &block)
476
+ default_options = {
477
+ row_names: true,
478
+ connect: false
479
+ }.merge!(user_options)
480
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
481
+ config['graphType'] = 'Dotplot'
482
+ if default_options[:connect]
483
+ config['dotplotType'] = "stacked"
484
+ config['connectBy'] = "Connect"
485
+ z[:Connect] = Array.new(vars.length, 1)
486
+ end
487
+ end
488
+ return html_string
489
+ end
490
+
471
491
  def heatmap(user_options = {}, &block)
472
492
  default_options = {
473
493
  row_names: true
474
494
  }.merge!(user_options)
475
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
495
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
476
496
  config['graphType'] = 'Heatmap'
477
497
  end
478
498
  return html_string
@@ -483,7 +503,7 @@ class Report_html
483
503
  row_names: true,
484
504
  header: true
485
505
  }.merge!(user_options)
486
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
506
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
487
507
  config['graphType'] = 'Boxplot'
488
508
  options[:mod_data_structure] = 'boxplot'
489
509
  if options[:extracode].nil?
@@ -497,7 +517,7 @@ class Report_html
497
517
  default_options = {
498
518
  transpose: false
499
519
  }.merge!(user_options)
500
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
520
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
501
521
  config['graphType'] = 'Pie'
502
522
  if samples.length > 1
503
523
  config['showPieGrid'] = true
@@ -514,7 +534,7 @@ class Report_html
514
534
  transpose: false,
515
535
  correlationAxis: 'samples'
516
536
  }.merge!(user_options)
517
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
537
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
518
538
  config['graphType'] = 'Correlation'
519
539
  config['correlationAxis'] = default_options[:correlationAxis]
520
540
  end
@@ -526,7 +546,7 @@ class Report_html
526
546
  row_names: false,
527
547
  transpose: false
528
548
  }.merge!(user_options)
529
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
549
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
530
550
  config['graphType'] = 'Scatter2D'
531
551
  config['xAxis'] = [samples.first] if config['xAxis'].nil?
532
552
  config['yAxis'] = samples[1..samples.length-1] if config['yAxis'].nil?
@@ -549,7 +569,7 @@ class Report_html
549
569
  row_names: true,
550
570
  transpose: false
551
571
  }.merge!(user_options)
552
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
572
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
553
573
  config['graphType'] = 'ScatterBubble2D'
554
574
  if options[:xAxis].nil?
555
575
  config['xAxis'] = [samples[0]]
@@ -591,7 +611,7 @@ class Report_html
591
611
  ringsType: [],
592
612
  ringsWeight: []
593
613
  }.merge!(user_options)
594
- html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id|
614
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
595
615
  options[:mod_data_structure] = 'circular'
596
616
  config['graphType'] = 'Circular'
597
617
  config['segregateVariablesBy'] = ['Ring']
@@ -643,6 +663,39 @@ class Report_html
643
663
  end
644
664
  end
645
665
 
666
+ def circular_genome(user_options = {}, &block)
667
+ default_options = {}.merge!(user_options)
668
+ coordinates = user_options[:genomic_coordinates]
669
+ html_string = canvasXpress_main(default_options, block) do |options, config, samples, vars, values, object_id, x, z|
670
+ config['graphType'] = 'Circular'
671
+ config["arcSegmentsSeparation"] = 3
672
+ config["colorScheme"] = "Tableau"
673
+ config["colors"] = ["#332288","#6699CC","#88CCEE","#44AA99","#117733","#999933","#DDCC77","#661100","#CC6677","#AA4466","#882255","#AA4499"]
674
+ config["showIdeogram"] = true
675
+ chr = []
676
+ pos = []
677
+ tags2remove = []
678
+ vars.each_with_index do |var, i|
679
+ coord = coordinates[var]
680
+ if !coord.nil?
681
+ tag = coord.first.gsub(/[^\dXY]/,'')
682
+ if tag == 'X' || tag == 'Y' || (tag.to_i > 0 && tag.to_i <= 22)
683
+ chr << coord.first.gsub(/[^\dXY]/,'')
684
+ pos << coord.last - 1
685
+ else
686
+ tags2remove << i
687
+ end
688
+ else
689
+ tags2remove << i
690
+ end
691
+ end
692
+ tags2remove.reverse_each{|i| ent = vars.delete_at(i); warn("Feature #{ent} has not valid coordinates")} # Remove entities with invalid coordinates
693
+ z['chr'] = chr
694
+ z['pos'] = pos
695
+ end
696
+ return html_string
697
+ end
698
+
646
699
  # EMBED FILES
647
700
  ###################################################################################
648
701
 
@@ -1,3 +1,3 @@
1
1
  module ReportHtml
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: report_html
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - seoanezonjic
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-09 00:00:00.000000000 Z
11
+ date: 2021-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,7 +72,7 @@ homepage: ''
72
72
  licenses:
73
73
  - MIT
74
74
  metadata: {}
75
- post_install_message:
75
+ post_install_message:
76
76
  rdoc_options: []
77
77
  require_paths:
78
78
  - lib
@@ -87,9 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
- rubyforge_project:
91
- rubygems_version: 2.6.14
92
- signing_key:
90
+ rubygems_version: 3.2.15
91
+ signing_key:
93
92
  specification_version: 4
94
93
  summary: Gem to build html interactive reports.
95
94
  test_files: []