Skip to content

Commit

Permalink
Merge branch 'lis' of https://github.com/legumeinfo/sequenceserver in…
Browse files Browse the repository at this point in the history
…to lis
  • Loading branch information
adf-ncgr committed Apr 4, 2022
2 parents 59164d7 + ba24088 commit 1413f40
Show file tree
Hide file tree
Showing 167 changed files with 105,830 additions and 3,813 deletions.
16 changes: 6 additions & 10 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,21 @@ checks:
method-count:
config:
threshold: 50
engines:
plugins:
rubocop:
enabled: true
eslint:
enabled: true
csslint:
stylelint:
enabled: true
ratings:
paths:
- "**.rb"
- "**.js"
- "**.css"
exclude_paths:
exclude_patterns:
- public/css/sequenceserver.min.css
- public/sequenceserver-*.min.js
- public/js/sequence.js
- public/sequenceserver.min.css
- public/sequenceserver.min.js
- public/js/kablammo/*
- public/vendor/**/*
- node_modules/**/*
- public/shims/**/*
- public/vendor/*
- spec/**/*
- coverage/
2 changes: 0 additions & 2 deletions .csslintrc

This file was deleted.

12 changes: 10 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"env": {
"browser": true,
"commonjs": true,
"es6": true
"es6": true,
"jquery": true
},
"extends": "eslint:recommended",
"parserOptions": {
Expand Down Expand Up @@ -31,6 +32,13 @@
"semi": [
"error",
"always"
],
"no-unused-vars": [
"error",
{"args": "none"}
]
},
"globals": {
"d3": true
}
}
}
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
push:
tags:
- '**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Add SSH key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
chmod 700 ${HOME}
mkdir -m 700 -p ${HOME}/.ssh
echo '${{ secrets.DOCKER_SSH_CONFIG }}' > ${HOME}/.ssh/config
echo '${{ secrets.DOCKER_SSH_KNOWN_HOSTS }}' >> ${HOME}/.ssh/known_hosts
chmod 400 ${HOME}/.ssh/*
ssh-agent -a ${SSH_AUTH_SOCK} > /dev/null
ssh-add - <<< '${{ secrets.DOCKER_HOST_SSH_PRIVATE_KEY }}'
- name: Build container image and deploy image
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
DOCKER_BUILDKIT: 1
DOCKER_HOST: ssh://docker
run: docker compose up --detach --build --force-recreate --renew-anon-volumes

7 changes: 7 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ Ben J Woodcroft <donttrustben@gmail.com> Ben Woodcroft <donttrustben@gmail.com>
Ben J Woodcroft <donttrustben@gmail.com> Ben J Woodcroft <donttrustben@gmail.com>
Ben J Woodcroft <donttrustben@gmail.com> Ben J Woodcroft <gmail.com after donttrustben>
Ben J Woodcroft <donttrustben@gmail.com> Ben J. Woodcroft <donttrustben near gmail.com>
Hiten Chowdhary <hiten.iitkgp@gmail.com> aniarya82 <hiten.iitkgp@gmail.com>
Esteban Gomez <eagomezc@unal.edu.co> eagomezc <eagomezc@unal.edu.co>
Iwo Pieniak <ivo.pieniak@gmail.com> ivopieniak <ivo.pieniak@gmail.com>
Iwo Pieniak <ivo.pieniak@gmail.com> ivopieniak <ivopieniak@gmail.com>
Emeline Favreau <emeline.favreau@qmul.ac.uk> EmelineAurore <emeline.favreau@qmul.ac.uk>
Lawrence <enjoyyourcopepods@gmx.com> emil <enjoyyourcopepods@gmx.com>
Neel Kamath <neelkamathonline@gmail.com> neelkamath <neelkamath@icloud.com>
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--color
--backtrace
--require spec_helper.rb
--pattern="spec/*_spec.rb","spec/blast_versions/blast_2.9.0/*.rb"
6 changes: 6 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "stylelint-config-standard",
"rules": {
"no-descending-specificity": null
}
}
44 changes: 22 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ language: ruby

rvm:
- 2.3
- 2.5
# - 2.5

branches:
only:
Expand All @@ -24,12 +24,12 @@ before_install:
- wget -c "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz" && tar xvf geckodriver-*.tar.gz -C bin
# Download codeclimate test reporter to bin and make it executable
- wget -c "https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64" -O bin/cc-test-reporter && chmod +x bin/cc-test-reporter
# Download and extract NCBI BLAST+ 2.10.0
- wget -c "ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.10.0/ncbi-blast-2.10.0+-x64-linux.tar.gz" && tar xvf ncbi-blast-*.tar.gz
# Download and extract NCBI BLAST+ 2.12.0
- wget -c "ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.12.0/ncbi-blast-2.12.0+-x64-linux.tar.gz" && tar xvf ncbi-blast-*.tar.gz
# Conclude installation by adding opt/bin/ containing codeclimate test reporter
# and geckodriver, and opt/ncbi-blast-2.10.0+/bin containing BLAST+ binaries to
# and geckodriver, and opt/ncbi-blast-2.12.0+/bin containing BLAST+ binaries to
# PATH.
- export PATH="$PWD/bin:$PWD/ncbi-blast-2.10.0+/bin:$PATH"
- export PATH="$PWD/bin:$PWD/ncbi-blast-2.12.0+/bin:$PATH"
# Reset working directory or subsequent steps may fail.
- cd ..
# Update bundler. Travis was using bundler 1.16.2 at the time of this writing
Expand All @@ -55,20 +55,20 @@ after_script:
cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT;
fi

jobs:
include:
# Each script listed below is automatically run by Travis in parallel, and only
# against Ruby 2.3 (because it is listed first in the rvm key), and after the
# main test stage. We use a glob pattern here instead of specifying just the
# directory name because capybara spec files in subfolders don't end with
# _spec.rb.
- stage: compatibility
script: bundle exec rspec spec/blast_versions/diamond_0.9.24/*
- script: bundle exec rspec spec/blast_versions/blast_2.2.30/*
- script: bundle exec rspec spec/blast_versions/blast_2.2.31/*
- script: bundle exec rspec spec/blast_versions/blast_2.3.0/*
- script: bundle exec rspec spec/blast_versions/blast_2.4.0/*
- script: bundle exec rspec spec/blast_versions/blast_2.5.0/*
- script: bundle exec rspec spec/blast_versions/blast_2.6.0/*
- script: bundle exec rspec spec/blast_versions/blast_2.7.1/*
- script: bundle exec rspec spec/blast_versions/blast_2.8.1/*
# jobs:
# include:
# # Each script listed below is automatically run by Travis in parallel, and only
# # against Ruby 2.3 (because it is listed first in the rvm key), and after the
# # main test stage. We use a glob pattern here instead of specifying just the
# # directory name because capybara spec files in subfolders don't end with
# # _spec.rb.
# - stage: compatibility
# script: bundle exec rspec spec/blast_versions/diamond_0.9.24/*
# - script: bundle exec rspec spec/blast_versions/blast_2.2.30/*
# - script: bundle exec rspec spec/blast_versions/blast_2.2.31/*
# - script: bundle exec rspec spec/blast_versions/blast_2.3.0/*
# - script: bundle exec rspec spec/blast_versions/blast_2.4.0/*
# - script: bundle exec rspec spec/blast_versions/blast_2.5.0/*
# - script: bundle exec rspec spec/blast_versions/blast_2.6.0/*
# - script: bundle exec rspec spec/blast_versions/blast_2.7.1/*
# - script: bundle exec rspec spec/blast_versions/blast_2.8.1/*
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build variables. These need to be declared befored the first FROM
# for the variables to be accessible in FROM instruction.
ARG BLAST_VERSION=2.10.0
ARG BLAST_VERSION=2.12.0

## Stage 1: gem dependencies.
FROM ruby:2.7-slim-buster AS builder
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[![gem version](https://img.shields.io/badge/version-1.0.x%20(old%20stable)-green.svg)](http://rubygems.org/gems/sequenceserver)
[![build status](https://secure.travis-ci.org/wurmlab/sequenceserver.png?branch=1.0.x)](https://travis-ci.org/wurmlab/sequenceserver)
[![build status](https://www.travis-ci.com/wurmlab/sequenceserver.svg?branch=1.0.x)](https://travis-ci.com/wurmlab/sequenceserver)
[![total downloads](http://ruby-gem-downloads-badge.herokuapp.com/sequenceserver?type=total&color=brightgreen)](http://rubygems.org/gems/sequenceserver)
[![gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/wurmlab/sequenceserver)

**Beta version:**
[![new gem version](https://img.shields.io/badge/version-2.0%20(beta)-yellowgreen.svg)](http://rubygems.org/gems/sequenceserver) **GitHub Master:** [![build status](https://secure.travis-ci.org/wurmlab/sequenceserver.png)](https://travis-ci.org/wurmlab/sequenceserver)
[![new gem version](https://img.shields.io/badge/version-2.0%20(beta)-yellowgreen.svg)](http://rubygems.org/gems/sequenceserver) **GitHub Master:** [![build status](https://www.travis-ci.com/wurmlab/sequenceserver.svg?branch=master)](https://travis-ci.com/wurmlab/sequenceserver)



Expand All @@ -24,10 +24,10 @@ If you use SequenceServer, please cite:
(2019).](https://doi.org/10.1093/molbev/msz185)


## Stable (version 1.0.11)
## Stable (version 1.0.14)

- Release date: June 2017
- Works with BLAST 2.2.30
- Release date: May 2020
- Works with BLAST 2.2.30 and higher

### Installation

Expand Down Expand Up @@ -120,7 +120,7 @@ To run all tests in a single file:

To run all tests:

bundle exec rspec spec/**/*spec*
bundle exec rspec

#### Getting code merged

Expand Down
52 changes: 22 additions & 30 deletions bin/sequenceserver
Original file line number Diff line number Diff line change
Expand Up @@ -308,34 +308,6 @@ begin
exit! unless set?
end
end
rescue SequenceServer::INCOMPATIBLE_BLAST_DATABASES => e
unless list_databases? || make_blast_databases?
# Print error raised.
puts
puts e

# Offer user to format the FASTA files.
database_dir = SequenceServer.config[:database_dir]
puts
puts <<~MSG
Incompatible databases can cause BLAST searches and other features of
SequenceServer to fail unexpectedly.
You can view incompatible databases and choose to reformat them below.
Alternatively, please remove them from databases directory.
View incompatible databases? [y/n] (Default: y).
MSG
puts
print '>> '
response = STDIN.gets.to_s.strip
unless response =~ /^[n]$/i
reformatted = SequenceServer.makeblastdb.reformat
exit! if reformatted.empty? && !set?
redo unless set?
else
exit! unless set?
end
end
rescue SequenceServer::ENOENT,
SequenceServer::CONFIG_FILE_ERROR,
SequenceServer::BLAST_DATABASE_ERROR,
Expand Down Expand Up @@ -382,8 +354,28 @@ begin

if make_blast_databases?
if SequenceServer.makeblastdb.scan
SequenceServer.makeblastdb.run
else
puts
puts <<~MSG
SequenceServer has scanned your databases directory and will now offer
to convert FASTA files into BLAST databases. It will also offer to
reformat any old-format BLAST databases and those created without
the -parse_seqids option of makeblastdb (-parse_seqids option is
required for sequence retrieval to correctly work).
Note that reformatting process can be slow large BLAST databases and
fail if sequence identifiers are longer than 50 characters. While we
exepect the reformatting process to work in most other cases, things
can inevitably go wrong. Thus, please back up your databases before
reformatting and post any issues to our Google Group/GitHub so that
we can all learn from it.
Proceed? [y/n] (Default: y).
MSG
puts
print '>> '
response = STDIN.gets.to_s.strip
SequenceServer.makeblastdb.run unless response =~ /^[n]$/i
else
puts "All FASTA files in #{SequenceServer.config[:database_dir]} " \
'are formatted.'
end
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion db/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ncbi/blast:2.10.0
FROM ncbi/blast:2.12.0

WORKDIR /db
VOLUME ["/db"]
Expand Down
26 changes: 15 additions & 11 deletions lib/sequenceserver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
# Top level module / namespace.
module SequenceServer
# The default version of BLAST that will be downloaded and configured for use.
BLAST_VERSION = '2.10.0+'.freeze
# The minimum version of BLAST that SequenceServer is happy to run with. This
# is for compatiblity with older database formats. Users will download BLAST
# themselves.
MIN_BLAST_VERSION = '2.9.0+'.freeze
BLAST_VERSION = '2.12.0+'.freeze

# Default location of configuration file.
DEFAULT_CONFIG_FILE = '~/.sequenceserver.conf'.freeze
Expand Down Expand Up @@ -78,9 +74,9 @@ def init(config = {})
Thread.abort_on_exception = true if development?

# Now locate binaries, scan databases directory, require any plugin files.
load_extension
init_binaries
init_database
load_extension

# The above methods validate bin dir, database dir, and path to plugin
# files. Port and host settings don't need to be validated: if running
Expand Down Expand Up @@ -141,7 +137,8 @@ def on_start
puts " - http://#{ip_address}:#{config[:port]}"
puts " - http://#{hostname}:#{config[:port]}" if hostname
puts ' To share your setup with anyone in the world, ask your IT team'
puts ' for a public IP address.'
puts ' for a public IP address or consider the SequenceServer cloud'
puts ' hosting service: https://sequenceserver.com/cloud'
puts ' To disable sharing, set :host: key in config file to 127.0.0.1'
puts ' and restart server.'
end
Expand Down Expand Up @@ -205,12 +202,19 @@ def init_database

makeblastdb.scan
fail NO_BLAST_DATABASE_FOUND, config[:database_dir] if !makeblastdb.any_formatted?
fail INCOMPATIBLE_BLAST_DATABASES, config[:database_dir] if makeblastdb.any_incompatible?

Database.collection = makeblastdb.formatted_fastas
Database.each do |database|
logger.debug("Found #{database.type} database '#{database.title}'" \
" at '#{database.name}'")
logger.debug "Found #{database.type} database '#{database.title}' at '#{database.path}'"
if database.non_parse_seqids?
logger.warn "Database '#{database.title}' was created without using the" \
' -parse_seqids option of makeblastdb. FASTA download will' \
" not work correctly (path: '#{database.path}')."
elsif database.v4?
logger.warn "Database '#{database.title}' is of older format. Mixing" \
' old and new format databases can be problematic' \
"(path: '#{database.path}')."
end
end
end

Expand Down Expand Up @@ -245,7 +249,7 @@ def assert_blast_installed_and_compatible
end
version = out.split[1]
fail BLAST_NOT_INSTALLED_OR_NOT_EXECUTABLE if version.empty?
fail BLAST_NOT_COMPATIBLE, version unless is_compatible(version, MIN_BLAST_VERSION)
fail BLAST_NOT_COMPATIBLE, version unless is_compatible(version, BLAST_VERSION)
end

def server_url
Expand Down
6 changes: 5 additions & 1 deletion lib/sequenceserver/api_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ def title
def message
<<~MSG
Looks like there's a problem with one of the query sequences, selected
databases, or advanced parameters.
databases, or advanced parameters. Details of the error are included
below. Please ask on our
<a href="https://github.com/wurmlab/sequenceserver/issues" target="_blank">issue tracker</a>
or on our <a href="https://groups.google.com/g/sequenceserver">forum</a> if you are
not sure what the error message means, or if the error message is just a number.
MSG
end

Expand Down
2 changes: 1 addition & 1 deletion lib/sequenceserver/blast/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module SequenceServer
# Define constanst used by BLAST module.
module BLAST
ERROR_LINE = /Error:\s(.*)/
ERROR_LINE = /Error:\s(.*)/i

ALGORITHMS = %w[blastn blastp blastx tblastn tblastx].freeze

Expand Down
Loading

0 comments on commit 1413f40

Please sign in to comment.