viral_seq 1.2.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbcddd0679b712b28592875aa18e38269ccbac5b85113f53873d4cedc5572b04
4
- data.tar.gz: 7268e596a2c40f7cdd2c815ccf5cdb40663c096c709aba6ee2e0dc4bc9a07542
3
+ metadata.gz: f3316ff7e72ca84c6eb2fa861a9fdad14fbcb3ab3c0053ade843ee13cc9ce82e
4
+ data.tar.gz: df1035ea5934b794ef8c64a04085f407bcd4dffc0888bf81a569a7ccfba3560a
5
5
  SHA512:
6
- metadata.gz: a689ed94201b19ee258fb07f73dd89ed2c8fd297b9580ba720d85ef2a16c5a38fdfed326dbdcc987f0913b4c9ab2aa060683a770df48baa4b1d657d63de35152
7
- data.tar.gz: 0b8065ae813f66b88fda3d7788c20718aa0db1a4f723d6831e948157b682a81fd1ae44a1d9043ebfb046df91c072bbc16db41ddd42e272d3f6c74a13fa473836
6
+ metadata.gz: a3ec35b3a40ee9cf66131416a1c20eda38bf8bde818aa41af285c099ddd2b49e4f31fe1d011c95def77fd5c6653d96f4295142fd543444f249242154bb2b671b
7
+ data.tar.gz: daa6e694a841cc615cfde850bf2d98ca7467cb1d27502daf398ab0204e55c4d477f34aafce0149c765a931755fc3a3f7dbdf425964904d0199efb0651b9a09a6
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ViralSeq
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/viral_seq.svg)](https://rubygems.org/gems/viral_seq)
3
+ [![Gem Version](https://img.shields.io/gem/v/viral_seq?color=%2300e673&style=flat-square)](https://rubygems.org/gems/viral_seq)
4
4
  ![GitHub](https://img.shields.io/github/license/viralseq/viral_seq)
5
5
  ![Gem](https://img.shields.io/gem/dt/viral_seq?color=%23E9967A)
6
6
  ![GitHub last commit](https://img.shields.io/github/last-commit/viralseq/viral_seq?color=%2300BFFF)
@@ -69,6 +69,44 @@ Example command:
69
69
  $ tcs_log batch_tcs_jobs
70
70
  ```
71
71
 
72
+ ---
73
+ ### `tcs_sdrm`
74
+
75
+ Use `tcs_sdrm` pipeline for HIV-1 drug resistance mutation and recency.
76
+
77
+ Example command:
78
+ ```bash
79
+ $ tcs_sdrm libs_dir
80
+ ```
81
+
82
+ lib_dir file structure:
83
+ ```
84
+ libs_dir/
85
+ ├── lib1
86
+ ├── lib1_RT
87
+ ├── lib1_PR
88
+ ├── lib1_IN
89
+ ├── lib1_V1V3
90
+ ├── lib2
91
+ ├── lib1_RT
92
+ ├── lib1_PR
93
+ ├── lib1_IN
94
+ ├── lib1_V1V3
95
+ ├── ...
96
+ ```
97
+
98
+ Output data in a new dir as 'libs_dir_SDRM'
99
+
100
+
101
+ **Note: [R](https://www.r-project.org/) and the following R libraries are required:**
102
+ - phangorn
103
+ - ape
104
+ - scales
105
+ - ggforce
106
+ - cowplot
107
+ - magrittr
108
+ - gridExtra
109
+
72
110
  ---
73
111
 
74
112
  ### `locator`
@@ -137,6 +175,10 @@ qc_seqhash.sdrm_hiv_pr(cut_off)
137
175
 
138
176
  ## Updates
139
177
 
178
+ ### Version 1.2.1-05172021
179
+
180
+ 1. Added a function in R to check and install missing R packages for `tcs_sdrm` pipeline.
181
+
140
182
  ### Version 1.2.0-05102021
141
183
 
142
184
  1. Added `tcs_sdrm` pipeline as an excutable.
data/bin/tcs_sdrm CHANGED
@@ -32,6 +32,14 @@ unless ARGV[0] && File.directory?(ARGV[0])
32
32
  abort "No sequence data provided. `tcs_sdrm` pipeline aborted. "
33
33
  end
34
34
 
35
+ begin
36
+ r_version = `R --version`.split("\n")[0]
37
+ r_check = `R -e '#{ViralSeq::R_SCRIPT_CHECK_PACKAGES}' > /dev/null 2>&1`
38
+ rescue Errno::ENOENT
39
+ abort '"R" is not installed. Install R at https://www.r-project.org/' +
40
+ "\n`tcs_sdrm` pipeline aborted."
41
+ end
42
+
35
43
  def abstract_line(data)
36
44
  return_data = data[3] + data[2] + data[4] + ":" +
37
45
  (data[6].to_f * 100).round(2).to_s + "(" +
@@ -45,7 +53,6 @@ log = []
45
53
  log << { time: Time.now }
46
54
  log << { viral_seq_version: ViralSeq::VERSION }
47
55
  log << { tcs_version: ViralSeq::TCS_VERSION }
48
- r_version = `R --version`.split("\n")[0]
49
56
  log << { R_version: r_version}
50
57
  sdrm_list = {}
51
58
  sdrm_list[:nrti] = ViralSeq::DRMs.sdrm_json(:nrti)
@@ -395,7 +402,7 @@ libs.each do |lib|
395
402
  end
396
403
  end
397
404
 
398
- log_file = indir + "_sdrm_log.json"
405
+ log_file = File.join(File.dirname(indir), "sdrm_log.json")
399
406
 
400
407
  File.open(log_file, 'w') { |f| f.puts JSON.pretty_generate(log) }
401
408
 
@@ -3,6 +3,13 @@ module ViralSeq
3
3
  # array for all amino acid one letter abbreviations
4
4
  AMINO_ACID_LIST = ["A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y", "*"]
5
5
 
6
+ # R script to check if the required libraries are installed, if not, install the missing libraries
7
+
8
+ R_SCRIPT_CHECK_PACKAGES = 'dir.create(path = Sys.getenv("R_LIBS_USER"), showWarnings = FALSE, recursive = TRUE);' +
9
+ 'packages <- c("ggplot2", "phangorn", "ape", "scales", "ggforce", "cowplot", "magrittr", "gridExtra");' +
10
+ 'install.packages(setdiff(packages, rownames(installed.packages())), lib = Sys.getenv("R_LIBS_USER"), repos = "https://cran.rstudio.com/")'
11
+
12
+
6
13
  # R script for tcs_sdrm script
7
14
 
8
15
  R_SCRIPT = 'setwd("PATH_TO_FASTA")
@@ -2,6 +2,6 @@
2
2
  # version info and histroy
3
3
 
4
4
  module ViralSeq
5
- VERSION = "1.2.0"
5
+ VERSION = "1.2.1"
6
6
  TCS_VERSION = "2.3.1"
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viral_seq
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuntai Zhou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-11 00:00:00.000000000 Z
12
+ date: 2021-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler