Skip to content

Commit

Permalink
Merge branch 'release-v0.8.0' into 'development'
Browse files Browse the repository at this point in the history
Release v0.8.0

See merge request ComPlat/chemotion_ELN!1392
  • Loading branch information
PiTrem committed May 3, 2021
2 parents 1e199cb + 29da15b commit 9b86adc
Show file tree
Hide file tree
Showing 27 changed files with 11,277 additions and 11,202 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: "complat/complat-ubuntu-runner:0.10.20"
image: "complat/complat-ubuntu-runner:0.12.20"

services:
- postgres:12-alpine
Expand Down Expand Up @@ -90,7 +90,7 @@ testrb:
stage: unit
script:
# - ln -s /home/gitlab-runner/shared/bundle vendor/bundle
- /bin/bash -l -c "source ~/.rvm/scripts/rvm && RAILS_ENV=test bundle exec rake db:schema:load && bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb"
- /bin/bash -l -c "source ~/.rvm/scripts/rvm && RAILS_ENV=test bundle exec rake db:test:prepare && bundle exec rspec --exclude-pattern spec/{features}/**/*_spec.rb"
except:
variables:
- $CI_COMMIT_MESSAGE =~ /skip[ _-]unitrb/i
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12.21.0
v12.22.1
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@

# Chemotion_ELN Changelog

## [v0.8.0]
> 2021-04-28
* Features
* option to decouple sample from molfile defined molecule - enable user custom MW input (Admin has to enable the feature)
* research-plan table: switch to using ag-grid - enable moving row/columns with d-n-d
* nmr_sim ELN plugin installed by default

* Fix
* Add configurable default profile for Element-Detail tab sortings
* slow opening of reaction panel: rm debounce
* green-chemistry: fix checkbox rerendering in table cell
* Analytics atom count scenari
* default favicon if none present


## [v0.7.1]
> 2021-03-26
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ ADD . $APP_HOME

RUN /bin/bash -c 'bundle install'
RUN /bin/bash -c 'source /usr/local/nvm/nvm.sh;\
nvm install 12.18.3;\
nvm use 12.18.3;\
nvm install 12.22.1;\
nvm use 12.22.1;\
npm install'

RUN echo '[ -s /usr/local/nvm/nvm.sh ] && . /usr/local/nvm/nvm.sh' >> /home/app/.bashrc
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile.focal.gitlab-ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:focal

ARG DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -44,19 +44,17 @@ RUN cat ~/.bash_profile
RUN mkdir -p shared/bundle/ruby
RUN mkdir -p shared/node_modules
RUN ln -s shared/node_modules node_modules
RUN echo $(ls -1 .)

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

COPY Gemfile /home/gitlab-runner/
COPY Gemfile.lock /home/gitlab-runner/
COPY package.json /home/gitlab-runner/
COPY package-lock.json /home/gitlab-runner/
RUN sudo chmod 666 Gemfile.lock
RUN sudo chmod 666 package-lock.json
RUN echo $(ls -1 .)

RUN /bin/bash -l -c "source ~/.nvm/nvm.sh && nvm install 12.21.0 && npm install -g npm@7.6.2 && npm install"
RUN /bin/bash -l -c "source ~/.nvm/nvm.sh && nvm install 12.22.1 && nvm use 12.22.1 && npm install -g npm && npm install"
RUN echo $(ls -1 shared/node_modules)
RUN /bin/bash -l -c "source ~/.rvm/scripts/rvm && rvm install 2.6.6 && gem install bundler -v 1.17.3 && bundle install --path shared/bundle"
# RUN /bin/bash -l -c "source ~/.rvm/scripts/rvm && chromedriver-update"
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ group :test do
gem 'rspec-repeat'
end

gem 'nmr_sim', git: 'https://github.com/ComPlat/nmr_sim', ref: 'e2f91776aafd8eb1fa9d88c8ec2291b02201f222', group: [:plugins,:development, :test, :production]

# Chemotion plugins: list your ELN specific plugin gems in the Gemfile.plugin
eln_plugin = File.join(File.dirname(__FILE__), "Gemfile.plugin")
if File.exists?(eln_plugin)
Expand Down
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ GIT
rails (~> 4.2.11)
sprite-factory (= 1.7.1)

GIT
remote: https://github.com/ComPlat/nmr_sim
revision: e2f91776aafd8eb1fa9d88c8ec2291b02201f222
ref: e2f91776aafd8eb1fa9d88c8ec2291b02201f222
specs:
nmr_sim (0.0.3)
rails (~> 4.2)

GIT
remote: https://github.com/ComPlat/openbabel-gem.git
revision: 3e25548fd95c2ac83c7fb5d9544ed2cf6ae1344b
Expand Down Expand Up @@ -716,6 +724,7 @@ DEPENDENCIES
meta_request
net-sftp
net-ssh
nmr_sim!
nokogiri
openbabel (= 2.4.90.3)!
pandoc-ruby
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.plugin.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# git: 'https://github.com/ComPlat/scifinding',
# group: [:plugins,:development,:production]
# # path: '../scifinding',
# gem 'nmr_sim', git: 'https://github.com/ComPlat/nmr_sim', ref: '104ac26879ede1f495dd5e90979d6f701a356c9f', group: [:plugins,:development,:production]
# gem 'nmr_sim', git: 'https://github.com/ComPlat/nmr_sim', ref: 'e2f91776aafd8eb1fa9d88c8ec2291b02201f222', group: [:plugins,:development,:production]
20 changes: 1 addition & 19 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,9 @@ NB:

## Using Docker

see online ![docs](https://www.chemotion.net/chemotionsaurus/docs/eln/docker_installation)


This is a setup for a 'pseudo' production stage using passenger and aimed for user testing.
(For the development environment, change 'RAILS_ENV' to 'development' in docker-compose.yml)
**Make sure you have finished the BASIC SETUP FIRST**

1. Build the image from Dockerfile `docker-compose build` or pull the image: `docker-compose pull`
2. Initialize database FIRST:
* `docker-compose run app bundle exec rake db:create`
* `docker-compose run app bundle exec rake db:migrate`
* `docker-compose run app bundle exec rake db:seed` (optional). A "seed"
user will be inserted into the db with the information as below: [email protected] - password: "@eln.edu"
* `docker-compose run app rake ketcherails:import:common_templates` (optional)
3. Precompile assets: `docker-compose run app bundle exec rake assets:precompile`
4. To start the server: `docker-compose up` or start server and detach: `docker-compose up -d`

* Start interactive shell with docker: `docker-compose run app /bin/bash`
* NOTE: In this Docker image, we disabled the email verification progress

* To enable email confirmation, uncomment ":confirmable" at line 5 of `app/models/user.rb`, stop the `docker-compose` by `docker-compose stop` and start `docker-compose`.


# Basic Development Setup

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ Copyright (C) 2015-current Nicole Jung (nicole.jung(at)kit.edu) of the Karlsruh



## Install
## Installation

see [INSTALL.md][INSTALL]

## User Documentation

see online ![docs](https://www.chemotion.net/chemotionsaurus/docs/eln/about)

## Code Status

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version: 0.7.1
version: 0.8.0-pre
base_revision: e8f0a99c4d6d024499cdef3feda77ec0d2c2e760
current_revision: 0
2 changes: 1 addition & 1 deletion app/assets/javascripts/components/SampleDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ export default class SampleDetails extends React.Component {
<Tab
eventKey={ind}
title={title}
key
key={key}
>
<ListGroupItem style={{ paddingBottom: 20 }}>
<ComputedPropsContainer sample={sample} />
Expand Down
5 changes: 0 additions & 5 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ class Application < Rails::Application

config.active_job.queue_adapter = :delayed_job

# copy favicon if not present in app
favicon_example_file = Rails.public_path.join('favicon.ico.example')
favicon_file = Rails.public_path.join('favicon.ico')
`cp #{favicon_example_file} #{favicon_file}` unless File.exist?(favicon_file)

# Chemotion Plugin configuration

# list of registered plugins (from the plugins group of the Gemfile):
Expand Down
4 changes: 2 additions & 2 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
set :bundle_jobs, 4 # parallel bundler

set :nvm_type, :user
set :nvm_node, File.exist?('.nvmrc') && File.read('.nvmrc').strip || 'v12.21.0'
set :npm_version, File.exist?('.npm-version') && File.read('.npm-version').strip || '7.6.2'
set :nvm_node, File.exist?('.nvmrc') && File.read('.nvmrc').strip || 'v12.22.1'
set :npm_version, File.exist?('.npm-version') && File.read('.npm-version').strip || '7.11.1'
set :nvm_map_bins, fetch(:nvm_map_bins, []).push('rake')
set :nvm_map_bins, fetch(:nvm_map_bins, []).push('bundle')
# Default value for :format is :pretty
Expand Down
2 changes: 1 addition & 1 deletion config/deploy/server.rb.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set :linked_files, fetch(:linked_files, []).push(
# '.ruby-gemset',
)

set :npm_version, '7.6.2'
set :npm_version, '7.11.1'
set :deploy_to, '/var/www/chemotion_ELN'
set :user, user
set :bundle_path, nil
Expand Down
14 changes: 14 additions & 0 deletions config/initializers/favicon.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# copy favicon if not present in app
favicon_example_file = Rails.public_path.join('favicon.ico.example')
begin
favicon_file = Rails.public_path.join('favicon.ico')
`cp #{favicon_example_file} #{favicon_file}` unless File.exist?(favicon_file)
favicon_file = Rails.public_path.join('images', 'favicon.ico')
`cp #{favicon_example_file} #{favicon_file}` unless File.exist?(favicon_file)
rescue
end



17 changes: 15 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20210303140000) do
ActiveRecord::Schema.define(version: 20210416075103) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -499,6 +499,19 @@
add_index "molecules", ["deleted_at"], name: "index_molecules_on_deleted_at", using: :btree
add_index "molecules", ["inchikey", "is_partial"], name: "index_molecules_on_inchikey_and_is_partial", unique: true, using: :btree

create_table "nmr_sim_nmr_simulations", force: :cascade do |t|
t.integer "molecule_id"
t.text "path_1h"
t.text "path_13c"
t.text "source"
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

add_index "nmr_sim_nmr_simulations", ["deleted_at"], name: "index_nmr_sim_nmr_simulations_on_deleted_at", using: :btree
add_index "nmr_sim_nmr_simulations", ["molecule_id", "source"], name: "index_nmr_sim_nmr_simulations_on_molecule_id_and_source", unique: true, using: :btree

create_table "notifications", force: :cascade do |t|
t.integer "message_id"
t.integer "user_id"
Expand Down Expand Up @@ -1121,7 +1134,7 @@
SQL

create_trigger :update_users_matrix_trg, sql_definition: <<-SQL
CREATE TRIGGER update_users_matrix_trg AFTER INSERT OR UPDATE ON public.matrices FOR EACH ROW EXECUTE PROCEDURE update_users_matrix()
CREATE TRIGGER update_users_matrix_trg AFTER INSERT OR UPDATE ON public.matrices FOR EACH ROW EXECUTE FUNCTION update_users_matrix()
SQL

create_view "v_samples_collections", sql_definition: <<-SQL
Expand Down
6 changes: 3 additions & 3 deletions lib/import/import_collections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ def import_samples
# look for the molecule for this sample and add the molecule name
# neither the Molecule or the MoleculeName are created if they already exist
molfile = fields.fetch('molfile')
molecule = fields.fetch('decoupled') && molfile.blank? ? Molecule.find_or_create_dummy : Molecule.find_or_create_by_molfile(molfile)
molecule.create_molecule_name_by_user(molecule_name_name, @current_user_id) unless fields.fetch('decoupled') && molfile.blank?
molecule = fields.fetch('decoupled', nil) && molfile.blank? ? Molecule.find_or_create_dummy : Molecule.find_or_create_by_molfile(molfile)
molecule.create_molecule_name_by_user(molecule_name_name, @current_user_id) unless fields.fetch('decoupled', nil) && molfile.blank?

# get the molecule_name from the list of molecule names in molecule
# this seems a bit cumbersome, but fits in with the methods of Molecule and MoleculeName
molecule_name = molecule.molecule_names.find_by(name: molecule_name_name) unless fields.fetch('decoupled') && molfile.blank?
molecule_name = molecule.molecule_names.find_by(name: molecule_name_name) unless fields.fetch('decoupled', nil) && molfile.blank?

# create the sample
sample = Sample.create!(fields.slice(
Expand Down
18 changes: 13 additions & 5 deletions lib/import/import_sdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Import::ImportSdf
:inchi_array, :raw_data, :rows, :custom_data_keys, :mapped_keys

SIZE_LIMIT = 40 # MB
MOLFILE_BLOCK_END_LINE = 'M END'

def initialize(args)
@raw_data = args[:raw_data] || []
Expand All @@ -30,7 +31,7 @@ def read_data
if file_path
size = File.size(file_path)
if size.to_f < SIZE_LIMIT * 10**6
@raw_data = File.read(file_path).split(/\${4}\r?\n/)
@raw_data = File.binread(file_path).encode('utf-8', universal_newline: true, invalid: :replace, undef: :replace).scrub.split(/\${4}\r?\n/)
else
@message[:error] << "File too large (over #{SIZE_LIMIT}MB). "
end
Expand All @@ -51,7 +52,7 @@ def find_or_create_mol_by_batch(batch_size = 50)
n = batch_size - 1
inchikeys = []
@processed_mol = []
data = raw_data.dup
data = raw_data.dup
until data.empty?
batch = data.slice!(0..n)
molecules = find_or_create_by_molfiles(batch)
Expand Down Expand Up @@ -102,14 +103,15 @@ def create_samples
next unless row

molfile = row['molfile']
babel_info = Chemotion::OpenBabelService.molecule_info_from_molfile(molfile)
san_molfile = sanitize_molfile(molfile)
babel_info = Chemotion::OpenBabelService.molecule_info_from_molfile(san_molfile)
inchikey = babel_info[:inchikey]
is_partial = babel_info[:is_partial]
next unless inchikey.presence && (molecule = Molecule.find_by(inchikey: inchikey, is_partial: is_partial))

sample = Sample.new(
created_by: current_user_id,
molfile: molfile,
molfile: san_molfile,
molfile_version: babel_info[:molfile_version],
molecule_id: molecule.id
)
Expand Down Expand Up @@ -150,7 +152,7 @@ def find_or_create_by_molfiles(molfiles)
babel_info_array = Chemotion::OpenBabelService.molecule_info_from_molfiles(molfiles)

babel_info_array.map.with_index do |babel_info, i|
if babel_info[:inchikey]
if babel_info[:inchikey].present?
mf = molfiles[i]
m = Molecule.find_or_create_by_molfile(mf, babel_info)
process_molfile_opt_data(mf).merge(
Expand All @@ -171,4 +173,10 @@ def process_molfile_opt_data(molfile)
[k, value.strip]
end]
end

def sanitize_molfile(mf)
#TODO check for residue polymer thingy
mf.encode('utf-8', universal_newline: true, invalid: :replace, undef: :replace).scrub.split(/^(#{MOLFILE_BLOCK_END_LINE}(\r?\n)?)/).first.concat(MOLFILE_BLOCK_END_LINE)

end
end
Loading

0 comments on commit 9b86adc

Please sign in to comment.