Arthor Documentation for Future Developer

From DISI
Jump to navigation Jump to search

Introduction

Here is the link to Arthor's manual

  • Username: ucsf@nextmovesoftware.com
  • Password: <Ask jjiteam@googlegroups.com>

Arthor configurations and the frontend files are consolidated in /nfs/soft2/arthor_configs/.

/nfs/soft2/arthor_configs/start_arthor_script.sh can start/restart Arthor instances on respective machines.

Launch the script to see the options available.

How To Download Arthor

  1. Ssh to nfs-soft2 and become root. Prepare directory
     mkdir /export/soft2/arthor_configs/arthor-<version> && cd /export/soft2/arthor_configs/arthor-<version>
  2. Download Software with this link
    • Username: ucsf@nextmovesoftware.com
    • Password: <Ask jjiteam@googlegroups.com>
  3. Go to releases. Look for smallworld-java-<version>.tar.gz and copy the link address.
  4. Download using wget
     wget --user ucsf@nextmovesoftware.com --password <Ask jjiteam@googlegroups.com> <link address>
  5. Decompress the file
    •  tar -xvf <file_name>

How To Launch Arthor For The First Time

Prepare Files and Directories

  1. Ssh to nfs-exc and become root
  2. Open a port in the firewall
    firewall-cmd --permanent --add-port=<port_number>/tcp 
    firewall-cmd --reload
  3. Go to Arthor Config directory
    cd /export/soft2/arthor_configs/arthor-<latest_version>
  4. Create an Arthor config file
    vim <name_of_file>.cfg
    • Add these lines in the file. Check the manual for more options.
    DataDir=/local2/public_arthor
    MaxConcurrentSearches=6
    MaxThreadsPerSearch=8
    AutomaticIndex=false
    AsyncHitCountMax=20000
    Depiction=./depict/bot/svg?w=%w&h=%h&svgunits=px&smi=%s&zoom=0.8&sma=%m&smalim=1
    Resolver=https://sw.docking.org/util/smi2mol?smi=%s

Start Arthor Instance

  1. Now ssh into a machine you wish to run an Arthor instance on and become root
  2. Change your shell to bash if you havn't already
    bash
  3. Create a screen
    screen -S <screen_name>
  4. Prepare Arthor Config Path
    export ARTHOR_CONFIG="/nfs/soft2/arthor_configs/arthor-<version>/<name_of_config_file>.cfg"
  5. Launch java
    java -jar -Dserver.port=<port_number> /nfs/soft2/arthor_configs/arthor-<version>/arthor-server-<version>.war

Configuration Details

  • DataDir: This is the directory where the Arthor data files live. Location where the index files will be created and loaded from.
  • MaxConcurrentSearches: Controls the maximum number of searches that can be run concurrently by setting the database pool size. When switching between a large number of databases it can be useful to have a larger pool size, the only trade off is keeping file pointers open.
  • MaxThreadsPerSearch: The number of threads to use for both ATDB and ATFP searches
  • Set AutomaticIndex to false if you don't want new smiles files added to the data directory to be indexed automatically
  • AsyncHitCountMax: The upper-bound for the number of hits to retrieve in background searches.
  • Resolver: Using Smallworld API, allows input box to take in a SMILE format and automatically draw on the board.

Check Arthor manual for more configuration options

How to Build Arthor Databases

We can build Arthor Databases anywhere. Consolidate smiles into one directory so you can index them all one by one.

Just use the script located at /nfs/home/jjg/scripts/arthor_index_script.sh at the directory where you c

Here is the content of the script:

#!/bin/bash

version="3.4.2"

export ARTHOR_DIR=/nfs/soft2/arthor_configs/arthor-$version/arthor-$version-centos7/
export PATH=$ARTHOR_DIR/bin/:$PATH

target="*.smi"

for j in $target
do
        echo 'smi2atdb -j 4 -p '$j' '${j}'.atdb'
        smi2atdb -j 4 -p $j ${j}.atdb
        echo 'atdb2fp -j 4 '$j'.atdb'
	atdb2fp -j 4 ${j}.atdb
done

Command Details

smi2atdb creates the atdb files needed for Substructure searching.

  • -j is the amount of threads to use to index the smiles file
  • -p stores the position of the original file

atdb2fp makes substructure searching faster

Setting up Round Table

"Round Table allows you to serve and split chemical searches across multiple host machines. The implementation provides a lightweight proxy that forwards requests to other Arthor host servers that do the actual search. Communication is done using the existing Web APIs.

Setting up Host Server

  1. Ssh to nfs-soft2 and become root
  2. Open a port in the firewall
    firewall-cmd --permanent --add-port=<port_number>/tcp 
    firewall-cmd --reload
  3. Go to Arthor Config Directory
    cd /export/soft2/arthor_configs/arthor-<version>
  4. Create Round Table Head configuration file. Here is an example:
  5. [RoundTable]
    RemoteClient=http://10.20.0.41:8008
    RemoteClient=http://10.20.5.19:8008
    Resolver=https://sw.docking.org/util/smi2mol?smi=%s
  6. Now ssh into a machine you wish to run the round table head on and become root
  7. Change your shell to bash if you havn't already
    bash
  8. Create a screen
    screen -S <screen_name>
  9. Prepare Arthor Config Path
    export ARTHOR_CONFIG="/nfs/soft2/arthor_configs/arthor-<version>/<round_table_head>.cfg"
  10. Launch java
    java -jar /nfs/soft2/arthor_configs/arthor-<version>/arthor-<version>-centos7/java/arthor.jar --httpPort=<port_number>

Active Arthor Instances

Public Arthor

CentOS 7 Machine Port Round Table Data Directory Which Arthor
arthor 10.20.200.100:8080 /local2/public_arthor/ Public Arthor

Arthor Round Table Head

CentOS 7 Machine Port Round Table Data Directory Which Arthor
samekh 10.20.0.41:8080 /local2/arthor_database/ Private Arthor Round Table Head Node
nun 10.20.0.40:8080 /local2/arthor_database/ Super Private Arthor Round Table Head Node

Arthor Round Table Nodes

CentOS 7 Machine Port Round Table Data Directory Which Arthor
samekh 10.20.0.41:8008 /local2/arthor_database/ Private Arthor Database Node
nun 10.20.0.40:8008 /local2/arthor_database/ Super Private Arthor Database Node
nfs-exd 10.20.1.113:8008 /export/exd/arthor_database/ Super Private Arthor Database Node
nfs-exh 10.20.5.19:8008 /export/exh/arthor_database/ Private Arthor Database Node
nfs-exj 10.20.200.80:8008 /export/exj/arthor_database/ Private Arthor Database Node

Arthor BB and CC

CentOS 7 Machine Port Data Directory Which Arthor
epyc-A40 10.20.200.92:8081 /local2/arthorbb ArthorBB
epyc-A40 10.20.200.92:8082 /local2/arthorcc ArthorCC

Customizing Arthor Frontend To Our Needs (Arthor 3.4.7)

These instructions only worked and compiled for me in the machine called epyc which is running Rocky 8 Linux operating system.

Summary of changes in index.html:

  • Add download options
  • Add contact info
  • Advertise TLDR
  • Remove buttons for Similarity and Formula

Summary of changes in index.js:

  • Add download options
  • Hyperlink the results to zinc20

Summary of changes in sketcher.js:

  • Input box should be updated as user draws molecule

Summary of changes in arthor.js:

  • Change default search type to be 'Substructure'

Summary of changes in arthor-swagger.yaml.js:

  • Input box should be updated as user draws molecule


Install Prerequisite Packages

  1. Install Apache Maven
    • dnf install maven -y
  2. Install Node Package Manager (NPM)
    • dnf install npm -y
  3. In your home directory, create a new directory to hold the files for the upcoming procedures
    • mkdir /mnt/nfs/home/jjg/arthor_build_from_source
  4. Download these latest Arthors and store them in 'arthor_build_from_source/'. Here's how to download Arthor.
    • arthor-3.4.7-source.tar.gz
    • arthor-3.4.7-centos7.tar.gz
  5. Extract contents from the tar.gz files
    • tar -xvf arthor-3.4.7-source.tar.gz
      tar -xvf arthor-3.4.7-centos7.tar.gz
  6. Install Apache Maven Arthor dependencies through this script
    • #!/bin/bash
      
      export ARTHOR_DIR=/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7-centos7/java
      export OS=linux
      export VERSION=3.4.7
      
      mvn install:install-file -Dfile=$ARTHOR_DIR/arthor-jni-${OS}.jar \
                               -Dpackaging=jar \
                               -DgeneratePom=true \
                               -DartifactId=arthor-jni-${OS} \
                               -DgroupId=com.nextmovesoftware.arthor \
                               -Dversion=$VERSION
      mvn install:install-file -Dfile=$ARTHOR_DIR/arthor-jni.jar \
                               -Dpackaging=jar \
                               -DgeneratePom=true \
                               -DartifactId=arthor-jni \
                               -DgroupId=com.nextmovesoftware.arthor \
                               -Dversion=$VERSION

Customizing Index.html

Location: /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server/src/main/webapp/WEB-INF/static/index.html

Change download options

  1. vim /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server/src/main/webapp/WEB-INF/static/index.html
  2. Search for 'arthor_tsv_link'
    • ?arthor_tsv_link
  3. Delete original download links
    •               <a id="arthor_tsv_link" href="#"> TSV</a>
                    <a id="arthor_csv_link" href="#"> CSV</a>
                    <a id="arthor_sdf_link" href="#"> SDF</a>
  4. Add new download link options
    •               <a id="arthor_tsv_link_100" href="#"> TSV-100</a>
                    <a id="arthor_tsv_link_1k" href="#"> TSV-1,000</a>
                    <a id="arthor_tsv_link_10k" href="#"> TSV-10,000</a>
                    <a id="arthor_tsv_link_100k" href="#"> TSV-100,000</a>
                    <a id="arthor_tsv_link_200k" href="#"> TSV-200,000</a>
                    <a id="arthor_tsv_link_300k" href="#"> TSV-300,000</a>
                    <a id="arthor_csv_link_100" href="#"> CSV-100</a>
                    <a id="arthor_csv_link_1k" href="#"> CSV-1,000</a>
                    <a id="arthor_csv_link_10k" href="#"> CSV-10,000</a>
                    <a id="arthor_csv_link_100k" href="#"> CSV-100,000</a>
                    <a id="arthor_csv_link_200k" href="#"> CSV-200,000</a>
                    <a id="arthor_csv_link_300k" href="#"> CSV-300,000</a>
                    <a id="arthor_sdf_link_100" href="#"> SDF-100</a>
                    <a id="arthor_sdf_link_1k" href="#"> SDF-1,000</a>
                    <a id="arthor_sdf_link_10k" href="#"> SDF-10,000</a>
                    <a id="arthor_sdf_link_100k" href="#"> SDF-100,000</a>
                    <a id="arthor_sdf_link_200k" href="#"> SDF-200,000</a>
                    <a id="arthor_sdf_link_300k" href="#"> SDF-300,000</a>

Add contact info and tldr

  1. vim /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server/src/main/webapp/WEB-INF/static/index.html
  2. Search for 'arthor_table_list'
    • ?arthor_table_list
  3. Add contact info and a plug to tldr.docking.org after the div block where arthor_table_list is inside of. It should look like this
    •       <div class="opt-box-border">
              <label>Databases</label>
              <!-- This will be populated by available databases -->
              <ul id="arthor_table_list">
                <li class="placeholder">Please select a search type</li>
              </ul>
            </div>
            <div class="opt-box-border">
              <label>Ask Questions</label>
              Email us: jjiteam@googlegroups.com
            </div>
            <div class="opt-box-border">
              <label> To Download 100K+ Results</label>
              Sign up for <a href="http://tldr.docking.org/">tldr.docking.org</a> and use arthorbatch
            </div>

Remove Similarity and Formula Buttons

  1. vim /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server/src/main/webapp/WEB-INF/static/index.html
  2. Search for 'arthor_search_list'
    • ?arthor_search_list
  3. Delete and Replace the whole 'ul' element block with this
    •         <ul id="arthor_search_list">
                <li class="first" value="Substructure" onclick="setSearchType(this)">
                  Substructure
                </li><li value="SMARTS" onclick="setSearchType(this)" class="last">
                  SMARTS
                </li>
              </ul>

Customize Index.js

Location /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7-source/server-ui/src/index.js

Add download option logic

  1. vim /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7-source/server-ui/src/index.js
  2. Comment out these lines of code
    •              if (setDownloadLinks)
                     setDownloadLinks(hist_limit);
    •                          let limit = arthor.config.WebApp.DefaultDownloadLimit;
                               if (!limit)
                                 limit = 500;
  3. Search for 'setDownloadLinks(limit)', both the function call and the function call argument, and remove the argument 'limit'.
    • ?setDownloadLinks(limit)
  4. As for the function, add all the logic for the download sizes
    • function setDownloadLinks() {
        //100 Download Size
        var limit = 100;
        var params = $.param({
                      query:  arthor.query,
                      type:   arthor.type,
                      draw:   0,
                      start:  0,
                      length: limit,
                      flags:  arthor.flags
                     });
        var base_url = arthor.url + '/dt/' + normTableNames(arthor.table) + '/search';
        $('#arthor_sdf_link_100').attr('href', base_url + '?fmt=sdf&' + params);
        $('#arthor_tsv_link_100').attr('href', base_url + '?fmt=tsv&' + params);
        $('#arthor_csv_link_100').attr('href', base_url + '?fmt=csv&' + params);
      
        //1k Download Size
        var limit = 1000;
        var params = $.param({
                      query:  arthor.query,
                      type:   arthor.type,
                      draw:   0,
                      start:  0,
                      length: limit,
                      flags:  arthor.flags
                     });
        var base_url = arthor.url + '/dt/' + normTableNames(arthor.table) + '/search';
        $('#arthor_sdf_link_1k').attr('href', base_url + '?fmt=sdf&' + params);
        $('#arthor_tsv_link_1k').attr('href', base_url + '?fmt=tsv&' + params);
        $('#arthor_csv_link_1k').attr('href', base_url + '?fmt=csv&' + params);
        //10k Download Size
        var limit = 10000;
        var params = $.param({
                      query:  arthor.query,
                      type:   arthor.type,
                      draw:   0,
                      start:  0,
                      length: limit,
                      flags:  arthor.flags
                     });
        var base_url = arthor.url + '/dt/' + normTableNames(arthor.table) + '/search';
        $('#arthor_sdf_link_10k').attr('href', base_url + '?fmt=sdf&' + params);
        $('#arthor_tsv_link_10k').attr('href', base_url + '?fmt=tsv&' + params);
        $('#arthor_csv_link_10k').attr('href', base_url + '?fmt=csv&' + params);
      
        //100k Download Size
        var limit = 100000;
        var params = $.param({
                      query:  arthor.query,
                      type:   arthor.type,
                      draw:   0,
                      start:  0,
                      length: limit,
                      flags:  arthor.flags
                     });
        var base_url = arthor.url + '/dt/' + normTableNames(arthor.table) + '/search';
        $('#arthor_sdf_link_100k').attr('href', base_url + '?fmt=sdf&' + params);
        $('#arthor_tsv_link_100k').attr('href', base_url + '?fmt=tsv&' + params);
        $('#arthor_csv_link_100k').attr('href', base_url + '?fmt=csv&' + params);
      
        //200k Download Size
        var limit = 200000;
        var params = $.param({
                      query:  arthor.query,
                      type:   arthor.type,
                      draw:   0,
                      start:  0,
                      length: limit,
                      flags:  arthor.flags
                     });
        var base_url = arthor.url + '/dt/' + normTableNames(arthor.table) + '/search';
        $('#arthor_sdf_link_200k').attr('href', base_url + '?fmt=sdf&' + params);
        $('#arthor_tsv_link_200k').attr('href', base_url + '?fmt=tsv&' + params);
        $('#arthor_csv_link_200k').attr('href', base_url + '?fmt=csv&' + params);
        //300k Download Size
        var limit = 300000;
        var params = $.param({
                      query:  arthor.query,
                      type:   arthor.type,
                      draw:   0,
                      start:  0,
                      length: limit,
                      flags:  arthor.flags
                     });
        var base_url = arthor.url + '/dt/' + normTableNames(arthor.table) + '/search';
        $('#arthor_sdf_link_300k').attr('href', base_url + '?fmt=sdf&' + params);
        $('#arthor_tsv_link_300k').attr('href', base_url + '?fmt=tsv&' + params);
        $('#arthor_csv_link_300k').attr('href', base_url + '?fmt=csv&' + params);
      
      /*  var params = $.param({
                      query:  arthor.query,
                      type:   arthor.type,
                      draw:   0,
                      start:  0,
                      length: limit,
                      flags:  arthor.flags
                     });
        var base_url = arthor.url + '/dt/' + normTableNames(arthor.table) + '/search';
        $('#arthor_sdf_link').attr('href', base_url + '?fmt=sdf&' + params);
        $('#arthor_tsv_link').attr('href', base_url + '?fmt=tsv&' + params);
        $('#arthor_csv_link').attr('href', base_url + '?fmt=csv&' + params);
      */
      }
  5. Lastly, add the zinc20 hyperlink to the Arthor results. Search for this
    • "<b>" + id + "</b>"
  6. Delete that whole line and replace it with this
    • $('<td>').append("<b><a target='_blank' href='https://zinc20.docking.org/substances/"+id+"'>" + id + "</a></b>",

Customize Sketcher.js

Location: /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7-source/server-ui/src/sketcher.js

Input Box Updates as User Draws

  1. vim /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7-source/server-ui/src/sketcher.js
  2. Search for this line "var smiles = event.src.smiles();"
    • ?var smiles = event.src.smiles();
  3. Add this new line below it
    • $('#ar_text_input').val(smiles);

Customize Arthor.js

Location: /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server-ui/src/arthor.js

Make Substructure Default Search Type

  1. vim /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server-ui/src/arthor.js
  2. Search for "let DEFAULT_SEARCH_TYPE"
    • ?let DEFAULT_SEARCH_TYPE
  3. Change parameter to "Substructure"

Customize arthor-swagger.yaml

Location: /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server/src/main/webapp/WEB-INF/static/swagger/arthor-swagger.yaml

Change URL Base Path for API Call

  1. vim /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server/src/main/webapp/WEB-INF/static/swagger/arthor-swagger.yaml
  2. Search for "basePath"
    • ?basePath
  3. Remove "/arthor" and keep argument empty

Compile/Minify Code through NPM

  1. Install NPM packages and Minify Code
    • cd /nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server-ui
      npm install
      npx webpack-dev-server
      npx webpack --mode=production
  2. Build the war file
    • cd /nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server
      mvn install -Pbootable
  3. If it works, then the path to new war file is at /mnt/nfs/home/jjg/arthor_build_from_source/arthor-3.4.7/arthor-3.4.7-source/server/target/arthor-server-3.4.7.war

Restarting Arthor Instance(s) Instructions

  1. Ssh to machine with respective Arthor instance and become root
  2. execute run_arthors_on_reboot.sh to show restart all instances on the machine
    bash /root/run_arthors_on_reboot.sh
  3. execute start_arthor_script.sh to restart specific Arthor instance. It will show you options to choose from.
    bash /nfs/soft2/arthor_configs/start_arthor_script.sh