Skip to content

Commit 158ea52

Browse files
committed
# work on external tools
1 parent 38e4356 commit 158ea52

83 files changed

Lines changed: 846 additions & 733 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ pkgdown/
1818
vignettes/V01*.png
1919
vignettes/V02*.png
2020
^\.github$
21+
^LICENSE\.md$

.github/workflows/check-bioc.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ jobs:
5555
matrix:
5656
config:
5757
#- { os: ubuntu-latest, r: '4.4', bioc: '3.19', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest" }
58-
- { os: ubuntu-latest, r: '4.4', bioc: '3.20', cont: "bioconductor/bioconductor_docker:RELEASE_3_20", rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest" }
58+
#- { os: ubuntu-latest, r: '4.4', bioc: '3.20', cont: "bioconductor/bioconductor_docker:RELEASE_3_20", rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest" }
59+
- { os: ubuntu-latest, r: '4.5', bioc: '3.21', cont: "bioconductor/bioconductor_docker:RELEASE_3_21", rspm: "https://packagemanager.rstudio.com/cran/__linux__/noble/latest" }
5960
#- { os: macOS-latest, r: '4.4', bioc: '3.19'}
6061
#- { os: windows-latest, r: '4.4', bioc: '3.19'}
6162
## Check https://github.com/r-lib/actions/tree/master/examples
@@ -109,19 +110,23 @@ jobs:
109110
with:
110111
path: ${{ env.R_LIBS_USER }}
111112
#key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-${{ hashFiles('.github/depends.Rds') }}
112-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-${{ hashFiles('.github/depends.Rds') }}
113+
#key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-${{ hashFiles('.github/depends.Rds') }}
114+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_21-r-4.5-${{ hashFiles('.github/depends.Rds') }}
113115
#restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-
114-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-
116+
#restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-
117+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_21-r-4.5-
115118

116119
- name: Cache R packages on Linux
117120
if: "!contains(github.event.head_commit.message, '/nocache') && runner.os == 'Linux' "
118121
uses: actions/cache@v3
119122
with:
120123
path: /home/runner/work/_temp/Library
121124
#key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-${{ hashFiles('.github/depends.Rds') }}
122-
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-${{ hashFiles('.github/depends.Rds') }}
125+
#key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-${{ hashFiles('.github/depends.Rds') }}
126+
key: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_21-r-4.5-${{ hashFiles('.github/depends.Rds') }}
123127
#restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-
124-
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-
128+
#restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-DEVEL-r-4.4-
129+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-biocversion-RELEASE_3_21-r-4.5-
125130

126131
- name: Install Linux system dependencies
127132
if: runner.os == 'Linux'
@@ -311,7 +316,8 @@ jobs:
311316
uses: actions/upload-artifact@master
312317
with:
313318
#name: ${{ runner.os }}-biocversion-RELEASE_3_19-r-4.4-results
314-
name: ${{ runner.os }}-biocversion-DEVEL-r-4.4-results
319+
#name: ${{ runner.os }}-biocversion-DEVEL-r-4.4-results
320+
name: ${{ runner.os }}-biocversion-RELEASE_3_21-r-4.5-results
315321
path: check
316322

317323

.gitlab-ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
image: rocker/r-ver:4.4.2
1+
image: rocker/r-ver:4.5.0
22

33
before_script:
44
- apt-get update
55
- apt-get -y install pandoc libcurl4-openssl-dev r-cran-devtools r-cran-testthat r-cran-curl
6-
- R -e "install.packages('BiocManager'); BiocManager::install(version = '3.20')"
6+
- R -e "install.packages('BiocManager'); BiocManager::install(version = '3.21')"
77
- R -e "dir(); getwd(); sessionInfo(); install.packages('devtools'); install.packages('pkgdown'); BiocManager::install('MSA2dist'); devtools::install()"
88
- R -e "setwd(paste0(find.package('CRBHits'), '/extdata/')); system(paste0('unzip last-1639.zip')); setwd(paste0(find.package('CRBHits'), '/extdata/last-1639/')); system('make')"
9-
- R -e "setwd(paste0(find.package('CRBHits'), '/extdata/')); system(paste0('tar -xvf KaKs_Calculator2.0_src.tar.gz')); setwd(paste0(find.package('CRBHits'), '/extdata/KaKs_Calculator2.0_src/src/')); system('make clean'); system('make')"
109
- R -e "setwd(paste0(find.package('CRBHits'), '/extdata/')); system(paste0('unzip dagchainer.zip')); setwd(paste0(find.package('CRBHits'), '/extdata/dagchainer/')); system('make')"
1110

1211
pages:

DESCRIPTION

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: CRBHits
22
Title: Conditional reciprocal best hits (CRBHits) in R
3-
Version: 0.0.9
3+
Version: 0.0.10
44
Authors@R:
55
person(given = "Kristian K",
66
family = "Ullrich",
@@ -14,10 +14,10 @@ License: MIT + file LICENSE
1414
Encoding: UTF-8
1515
LazyData: false
1616
Depends:
17-
R (>= 4.4.0)
17+
R (>= 4.5.0)
1818
Imports:
1919
Biostrings,
20-
MSA2dist (>= 1.9.0),
20+
MSA2dist (>= 1.12.0),
2121
curl,
2222
doParallel,
2323
dplyr,
@@ -49,6 +49,9 @@ NeedsCompilation: yes
4949
SystemRequirements:
5050
LAST (https://anaconda.org/bioconda/last),
5151
DAGchainer (https://anaconda.org/bioconda/dagchainer),
52+
DIAMOND (optional, https://anaconda.org/bioconda/diamond),
53+
MMSEQS2 (optiona, https://anaconda.org/bioconda/mmseqs2),
54+
LAMBDA (optional, https://anaconda.org/bioconda/lambda),
5255
GNU make,
5356
libcurl (deb: libcurl4-openssl-dev or CentOS: libcurl-devel),
5457
openssl (deb: libssl-dev or CentOS: openssl-devel),

LICENSE

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,2 @@
1-
YEAR: 2020
1+
YEAR: 2025
22
COPYRIGHT HOLDER: Kristian K Ullrich
3-
4-
Copyright (c) 2020, Kristian K Ullrich
5-
6-
Permission is hereby granted, free of charge, to any person obtaining
7-
a copy of this software and associated documentation files (the
8-
"Software"), to deal in the Software without restriction, including
9-
without limitation the rights to use, copy, modify, merge, publish,
10-
distribute, sublicense, and/or sell copies of the Software, and to
11-
permit persons to whom the Software is furnished to do so, subject to
12-
the following conditions:
13-
14-
The above copyright notice and this permission notice shall be
15-
included in all copies or substantial portions of the Software.
16-
17-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2025 Kristian K Ullrich
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export(cds2rbh)
1010
export(cdsdir2orthofinder)
1111
export(cdsfile2aafile)
1212
export(cdsfile2rbh)
13+
export(check_ext_install)
1314
export(col2transparent)
1415
export(filter_alnlen)
1516
export(filter_eval)
@@ -96,4 +97,5 @@ importFrom(tidyr,unite)
9697
importFrom(utils,combn)
9798
importFrom(utils,read.table)
9899
importFrom(utils,stack)
100+
importFrom(utils,unzip)
99101
importFrom(utils,write.table)

R/aa2rbh.R

Lines changed: 35 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ aa2rbh <- function(aa1, aa2,
128128
dbfile1=NULL,
129129
dbfile2=NULL,
130130
searchtool="last",
131-
lastpath=paste0(find.package("CRBHits"),
132-
"/extdata/last-1639/bin/"),
131+
lastpath=file.path(find.package("CRBHits"), "extdata", "last-1639", "bin"),
133132
lastD=1e6,
134133
lastm=10,
135134
mmseqs2path=NULL,
@@ -200,57 +199,32 @@ aa2rbh <- function(aa1, aa2,
200199
return(fitMatrixfun)
201200
}
202201
if(searchtool=="last"){
203-
if(!dir.exists(lastpath)){
204-
stop("Error: last PATH does not exist. Please specify correct
205-
PATH and/or look into package installation prerequisites.
206-
Try to use make_last() function.")
207-
}
208-
if(!file.exists(paste0(lastpath, "lastdb"))){
209-
stop("Error: lastdb binary does not exist. Please specify
210-
correct PATH and/or look into package installation
211-
prerequisites. Try to use make_last() function.")
212-
}
213-
if(!file.exists(paste0(lastpath, "lastal"))){
214-
stop("Error: lastal binary does not exist. Please specify
215-
correct PATH and/or look into package installation
216-
prerequisites. Try to use make_last() function.")
217-
}
202+
check_ext_install(
203+
ext_name="last",
204+
ext_dir=lastpath,
205+
binary_name="lastdb")
206+
check_ext_install(
207+
ext_name="last",
208+
ext_dir=lastpath,
209+
binary_name="lastal")
218210
}
219211
if(searchtool=="mmseqs2"){
220-
if(!dir.exists(mmseqs2path)){
221-
stop("Error: mmseqs2 PATH does not exist. Please specify
222-
correct PATH and/or look into package installation
223-
prerequisites.")
224-
}
225-
if(!file.exists(paste0(mmseqs2path, "mmseqs"))){
226-
stop("Error: mmseqs2 binary does not exist. Please specify
227-
correct PATH and/or look into package installation
228-
prerequisites.")
229-
}
212+
check_ext_install(
213+
ext_name="mmseqs2",
214+
ext_dir=mmseqs2path,
215+
binary_name="mmseqs")
230216
}
231217
if(searchtool=="diamond"){
232-
if(!dir.exists(diamondpath)){
233-
stop("Error: diamond PATH does not exist. Please specify
234-
correct PATH and/or look into package installation
235-
prerequisites.")
236-
}
237-
if(!file.exists(paste0(diamondpath, "diamond"))){
238-
stop("Error: diamond binary does not exist. Please specify
239-
correct PATH and/or look into package installation
240-
prerequisites.")
241-
}
218+
check_ext_install(
219+
ext_name="diamond",
220+
ext_dir=diamondpath,
221+
binary_name="diamond")
242222
}
243223
if(searchtool=="lambda3"){
244-
if(!dir.exists(lambda3path)){
245-
stop("Error: lambda3 PATH does not exist. Please specify
246-
correct PATH and/or look into package installation
247-
prerequisites.")
248-
}
249-
if(!file.exists(paste0(lambda3path, "lambda3"))){
250-
stop("Error: lambda3 binary does not exist. Please specify
251-
correct PATH and/or look into package installation
252-
prerequisites.")
253-
}
224+
check_ext_install(
225+
ext_name="lambda",
226+
ext_dir=lambda3path,
227+
binary_name="lambda3")
254228
}
255229
selfblast <- FALSE
256230
if(suppressWarnings(all(aa1==aa2))){
@@ -293,26 +267,26 @@ aa2rbh <- function(aa1, aa2,
293267
Biostrings::writeXStringSet(aa1, file=aa1file)
294268
Biostrings::writeXStringSet(aa2, file=aa2file)
295269
if(searchtool=="last"){
296-
system2(command=paste0(lastpath, "lastdb"),
270+
system2(command=file.path(lastpath, "lastdb"),
297271
args = c("-p", "-cR01", "-P", threads, aa1dbfile, aa1file))
298-
system2(command=paste0(lastpath, "lastdb"),
272+
system2(command=file.path(lastpath, "lastdb"),
299273
args = c("-p", "-cR01", "-P", threads, aa2dbfile, aa2file))
300-
system2(command=paste0(lastpath, "lastal"),
274+
system2(command=file.path(lastpath, "lastal"),
301275
args = c("-f", "BlastTab+", "-P", threads, "-D", lastD, "-m", lastm,
302276
aa1dbfile, aa2file, ">", aa2_aa1_lastout))
303-
system2(command=paste0(lastpath, "lastal"),
277+
system2(command=file.path(lastpath, "lastal"),
304278
args = c("-f", "BlastTab+", "-P", threads, "-D", lastD, "-m", lastm,
305279
aa2dbfile, aa1file, ">", aa1_aa2_lastout))
306280
}
307281
if(searchtool=="mmseqs2"){
308-
system2(command=paste0(mmseqs2path, "mmseqs"),
282+
system2(command=file.path(mmseqs2path, "mmseqs"),
309283
args = c("easy-search", aa1file, aa2file, aa1_aa2_lastout, outpath,
310284
"--threads", threads, "-s", mmseqs2sensitivity,
311285
"--max-seqs", mmseqs2maxseqs,
312286
"--format-output", paste0("query,target,fident,alnlen,",
313287
"mismatch,gapopen,qstart,qend,tstart,tend,evalue,bits,qlen,",
314288
"tlen,raw")))
315-
system2(command=paste0(mmseqs2path, "mmseqs"),
289+
system2(command=file.path(mmseqs2path, "mmseqs"),
316290
args = c("easy-search", aa2file, aa1file, aa2_aa1_lastout, outpath,
317291
"--threads", threads, "-s", mmseqs2sensitivity,
318292
"--max-seqs", mmseqs2maxseqs,
@@ -321,20 +295,20 @@ aa2rbh <- function(aa1, aa2,
321295
"tlen,raw")))
322296
}
323297
if(searchtool=="diamond"){
324-
system2(command=paste0(diamondpath, "diamond"),
298+
system2(command=file.path(diamondpath, "diamond"),
325299
args = c("makedb", "--in", aa1file,
326300
"-d", aa1dbfile))
327-
system2(command=paste0(diamondpath, "diamond"),
301+
system2(command=file.path(diamondpath, "diamond"),
328302
args = c("makedb", "--in", aa2file,
329303
"-d", aa2dbfile))
330-
system2(command=paste0(diamondpath, "diamond"),
304+
system2(command=file.path(diamondpath, "diamond"),
331305
args = c("blastp", "--ignore-warnings", "-d", aa2dbfile,
332306
"-q", aa1file, "-o", aa1_aa2_lastout, diamondsensitivity,
333307
"--max-target-seqs", diamondmaxtargetseqs,
334308
"-f", "6", "qseqid", "sseqid", "pident", "length", "mismatch",
335309
"gapopen", "qstart", "qend", "sstart", "send", "evalue",
336310
"bitscore", "qlen", "slen", "score", "--threads", threads))
337-
system2(command=paste0(diamondpath, "diamond"),
311+
system2(command=file.path(diamondpath, "diamond"),
338312
args = c("blastp", "--ignore-warnings", "-d", aa1dbfile,
339313
"-q", aa2file, "-o", aa2_aa1_lastout, diamondsensitivity,
340314
"--max-target-seqs", diamondmaxtargetseqs,
@@ -343,18 +317,18 @@ aa2rbh <- function(aa1, aa2,
343317
"bitscore", "qlen", "slen", "score", "--threads", threads))
344318
}
345319
if(searchtool=="lambda3"){
346-
system2(command=paste0(lambda3path, "lambda3"),
320+
system2(command=file.path(lambda3path, "lambda3"),
347321
args = c("mkindexp", "-d", aa1file, "-i", aa1dbfile,
348322
"--threads", threads))
349-
system2(command=paste0(lambda3path, "lambda3"),
323+
system2(command=file.path(lambda3path, "lambda3"),
350324
args = c("mkindexp", "-d", aa2file, "-i", aa2dbfile,
351325
"--threads", threads))
352-
system2(command=paste0(lambda3path, "lambda3"),
326+
system2(command=file.path(lambda3path, "lambda3"),
353327
args = c("searchp", "-i", aa2dbfile, "-q", aa1file,
354328
"-o", aa1_aa2_lastout, "-p", lambda3sensitivity,
355329
"--num-matches", lambda3nummatches, "--output-columns",
356330
"'std qlen slen score'", "--threads", threads))
357-
system2(command=paste0(lambda3path, "lambda3"),
331+
system2(command=file.path(lambda3path, "lambda3"),
358332
args = c("searchp", "-i", aa1dbfile, "-q", aa2file,
359333
"-o", aa2_aa1_lastout, "-p", lambda3sensitivity,
360334
"--num-matches", lambda3nummatches, "--output-columns",

0 commit comments

Comments
 (0)