Commit 2871c2f1 authored by Andreas Tille's avatar Andreas Tille
Browse files

New upstream version 4.2.2

parent 386753fc
Loading
Loading
Loading
Loading

.travis.yml

0 → 100644
+19 −0
Original line number Diff line number Diff line
language: python

python:
  - "3.5"
  - "3.6"

before_install:
  - sudo apt-get -qq update
  - sudo apt-get install -y ncbi-blast+ prodigal 
  - wget http://github.com/bbuchfink/diamond/releases/download/v0.8.36/diamond-linux64.tar.gz
  - tar xzf diamond-linux64.tar.gz
  - sudo mv diamond /usr/bin
 
install:
  - pip install -r requirements.txt
  - pip install .

script:
  - ./test.sh

Dockerfile

0 → 100644
+43 −0
Original line number Diff line number Diff line
# base image (stripped down ubuntu for Docker)
FROM phusion/baseimage

# metadata
LABEL base.image="ubuntu"
LABEL version="1"
LABEL software="RGI"
LABEL software.version="4.0.3"
LABEL description="Tool to identify resistance genes using the CARD database"
LABEL website="https://card.mcmaster.ca/"
LABEL documentation="https://github.com/arpcard/rgi/blob/master/README.rst"
LABEL license="https://github.com/arpcard/rgi/blob/master/LICENSE"
LABEL tags="Genomics"

# maintainer
MAINTAINER Finlay Maguire <finlaymaguire@gmail.com>

# install system dependencies
RUN \
    apt-get update && \
    apt-get install -y git python3 python3-dev python3-pip ncbi-blast+ prodigal wget && \
    wget http://github.com/bbuchfink/diamond/releases/download/v0.8.36/diamond-linux64.tar.gz && \
    tar xvf diamond-linux64.tar.gz && \
    mv diamond /usr/bin

# install and test rgi
RUN git clone https://github.com/arpcard/rgi
WORKDIR rgi/
RUN pip3 install -r requirements.txt && \
    pip3 install . && \
    bash test.sh

# sort the database path issue
RUN pwd
WORKDIR /usr
RUN cp /rgi/card_data/card.json /usr/local/lib/python3.5/dist-packages/app/_data/card.json

# move to workdir 
WORKDIR /data/

# set rgi executable as cmd to allow overriding
CMD ["rgi"]

LICENSE

0 → 100644
+104 −0
Original line number Diff line number Diff line
1. About the CARD, ARO, and RGI

The Comprehensive Antibiotic Resistance Database ("CARD") provides data, models, and 
algorithms relating to the molecular basis of antimicrobial resistance. The CARD provides 
curated reference sequences and SNPs organized via the Antibiotic Resistance Ontology 
("ARO"). These data can be browsed on the website or downloaded in a number of formats. 
These data are additionally associated with detection models, in the form of curated 
homology cut-offs and SNP maps, for prediction of resistome from molecular sequences. 
These models can be downloaded or can be used for analysis of genome sequences using the 
Resistance Gene Identifier ("RGI"), either online or as a stand-alone tool.

The CARD was designed and developed by the laboratories of Drs. Gerry Wright and Andrew G. 
McArthur of McMaster University's Department of Biochemistry & Biomedical Sciences 
(Hamilton, Ontario, Canada) with the help of a global team of collaborators. It is built 
entirely using open source software and tools. This research has been supported by funds 
from the Canadian Foundation for Innovation, Canadian Institutes of Health Research, 
Natural Sciences and Engineering Research Council of Canada, Medical Research Council 
(UK), and Ontario Research Fund, as well as a Cisco Research Chair in Bioinformatics 
supported by Cisco Systems Canada, Inc. (Dr. McArthur), Canada Research Chair (Dr. 
Wright), and Killam Research Fellowship (Dr. Wright).

2. Trade Marks and Official Marks

All trade marks used or displayed on the CARD (card.mcmaster.ca) website are registered or 
unregistered trade  marks or official marks of McMaster University. Nothing on the website 
should be interpreted to grant any license to use any trade mark or official mark without 
the express written permission of McMaster University.

3. Copyright and Discliamer

All of the materials on the website, including but not limited to the CARD, the RGI, and 
the underlying HTML, text, illustration, designs, icons, audio clips, video clips, 
documents, products, software and all other content (the "Materials") are protected by 
copyright and are either owned by McMaster University, provided by the creator for free 
use by the scientific community, or McMaster University has obtained a license to use the 
Materials for their website. Except as noted in the Terms of Use below, specifically 
sections 4 and 5 below, none of the Materials may be copied, reproduced, distributed, 
republished, downloaded, displayed, posted or transmitted in any form or by any means, 
without the prior written consent of McMaster University, or the original creator, where 
applicable. 

The only exception is the distribution of the Resistance Gene Identifier (RGI) software on
the Conda open source, cross-platform, language-agnostic package manager and environment 
management system (https://conda.io/). Conda users are still required to abid by the Terms 
of Use listed, specifically sections 4 and 5 below.

To obtain permission to reproduce material on the CARD website, please send a request to:

McMaster University
c/o McMaster Industry Liaison Office
305 – 175 Longwood Rd South
Hamilton, Ontario L8P 0A1
Attention: Copyright Advisor
E: milodsk@mcmaster.ca

4. Terms of Use for Non-Commercial, Research or Academic Reproduction

All information and the Materials at CARD has been posted to provide the public with 
direct access to information about Antibiotic Resistance. The information and the 
Materials have been posted with the intent that it be readily available for personal and 
public non-commercial, research or academic use by individuals at academic institutions 
only and except where otherwise prohibited, may be reproduced, in part or in whole and by 
any means, without charge or further permission from McMaster University. Any other 
organization must seek to obtain a license described in section 5 below.

We only ask that:

4.1 The Materials not be modified and used "as is"

4.2 Users exercise due diligence in ensuring the accuracy of the Materials

4.3 McMaster University be identified as the source of the Materials

4.4 The reproduction is not represented as an official version of the Materials 
reproduced, nor as having been made in affiliation with or without the endorsement of 
McMaster University

5. Terms of Use for Commercial or Non-Academic Organizations

Use or reproduction of Materials on the site, in whole or in part, by any non-academic 
organization whether or not for non-commercial (including research) or commercial purposes 
is prohibited, except with written permission of McMaster University. Commercial uses of 
the Materials on the site are offered only pursuant to a written license and user fee. To 
obtain permission and begin the licensing process, please contact McMaster University 
using the address in section 3.

6. Disclaimer

The Materials on this site are provided "as is" without warranties or conditions of any 
kind either expressed or implied. To the fullest extent possible under applicable law, 
McMaster University disclaims all warranties and conditions, expressed or implied, 
including but not limited to, implied warranties or conditions of merchantability and 
fitness for a particular purpose, non-infringement or other violation of rights. McMaster 
University does not warrant or make any other representations regarding the use, accuracy,
timelines, applicability, performance, security, availability or reliability of this 
website or any of the sites linked to this website, or the results from the use of this
website or any sites linked to this website, or otherwise respecting the Materials on this 
website or any sites linked to this website.

7. Limitation of Liability

Under no circumstances, including but not limited to negligence, shall McMaster University 
be liable for any direct, indirect, special, punitive, incidental or consequential damages 
arising out of the use of, or the inability to use, the website or the Materials.

README.rst

0 → 100644
+380 −0
Original line number Diff line number Diff line
Resistance Gene Identifier (RGI) 
--------------------------------------------

This application is used to predict resistome(s) from protein or nucleotide data based on homology and SNP models. The application uses data from `CARD database <https://card.mcmaster.ca/>`_.

.. image:: https://travis-ci.org/arpcard/rgi.svg?branch=master
    :target: https://travis-ci.org/arpcard/rgi

Table of Contents
-------------------------------------

- `License`_
- `Requirements`_
- `Install dependencies`_
- `Install RGI from project root`_
- `Running RGI tests`_
- `Help menu`_
- `Usage`_
- `Load card.json`_
- `Check database version`_
- `Run RGI`_
- `Run RGI using GNU parallel`_
- `Running RGI with short contigs to predict partial genes`_
- `Clean previous or old databases`_
- `RGI Heatmap`_
- `Run RGI from docker`_
- `Tab-delimited results file`_
- `Support & Bug Reports`_



License
--------
Use or reproduction of these materials, in whole or in part, by any non-academic organization whether or not for non-commercial (including research) or commercial purposes is prohibited, except with written permission of McMaster University. Commercial uses are offered only pursuant to a written license and user fee. To obtain permission and begin the licensing process, see `CARD website <https://card.mcmaster.ca/about>`_

Requirements
--------------------

- `Prodigal v2.6.3 <https://github.com/hyattpd/prodigal/wiki/Installation>`_
- `NCBI BLAST v2.6.0+ <https://blast.ncbi.nlm.nih.gov/Blast.cgi>`_
- `DIAMOND v0.8.36 <https://ab.inf.uni-tuebingen.de/software/diamond>`_
- `Python 3.6 <https://www.python.org/>`_

Install dependencies
--------------------

- pip3 install biopython
- pip3 install filetype
- pip3 install pandas
- pip3 install pytest
- pip3 install mock

Install RGI from project root
-----------------------------

.. code-block:: sh

   pip3 install .

or

.. code-block:: sh

   python3 setup.py build
   python3 setup.py test
   python3 setup.py install

Running RGI tests
-------------------
.. code-block:: sh
   
   cd tests
   pytest -v -rxs

Help menu
-------------------

.. code-block:: sh

   rgi --help

Usage
-------------------

.. code-block:: sh

      usage: rgi <command> [<args>]
                  commands are:
                  main     Runs rgi application
                  tab      Creates a Tab-delimited from rgi results
                  parser   Creates categorical JSON files RGI wheel visualization
                  load     Loads CARD database JSON file
                  clean    Removes BLAST databases and temporary files
                  galaxy   Galaxy project wrapper
                  database Information on installed card database
                  heatmap  Heatmap for multiple analysis
                  ---------------------------------------------------------------------------------------
                  bwt                   Metagenomics resistomes (Experimental)
                  card_annotation       Create fasta files with annotations from card.json (Experimental)
                  wildcard_annotation   Create fasta files with annotations from variants (Experimental)
                  baits_annotation      Create fasta files with annotations from baits (Experimental)
                  remove_duplicates     Removes duplicate sequences (Experimental)
                  kmer_build            Build CARD*kmer database (Experimental)
                  kmer_query            Query sequences through CARD*kmers (Experimental)

   Resistance Gene Identifier - <version_number>

   positional arguments:
   command     Subcommand to run

   optional arguments:
   -h, --help  show this help message and exit

   Use the Resistance Gene Identifier to predict resistome(s) from protein or
   nucleotide data based on homology and SNP models. Check
   https://card.mcmaster.ca/download for software and data updates. Receive email
   notification of monthly CARD updates via the CARD Mailing List
   (https://mailman.mcmaster.ca/mailman/listinfo/card-l)


Load card.json 
-------------------

- local or working directory

   .. code-block:: sh
   
      rgi load --afile /path/to/card.json --local

- system wide 

   .. code-block:: sh

      rgi load --afile /path/to/card.json

Check database version
-----------------------

- local or working directory

   .. code-block:: sh
   
      rgi database --version --local

- system wide 

   .. code-block:: sh

      rgi database --version

Run RGI 
----------------------

- local or working directory

   .. code-block:: sh
   
      rgi main --input_sequence /path/to/protein_input.fasta --output_file /path/to/output_file --input_type protein --local 

- system wide 

   .. code-block:: sh
   
      rgi main --input_sequence /path/to/nucleotide_input.fasta --output_file /path/to/output_file --input_type contig

Run RGI using GNU parallel
--------------------------------------------

- system wide and writing log files for each input file. (Note add code below to script.sh then run with `./script.sh /path/to/input_files`)

   .. code-block:: sh

      #!/bin/bash
      DIR=`find . -mindepth 1 -type d`
      for D in $DIR; do
            NAME=$(basename $D);
            parallel --no-notice --progress -j+0 'rgi main -i {} -o {.} -n 16 -a diamond --clean --debug > {.}.log 2>&1' ::: $NAME/*.{fa,fasta};
      done



Running RGI with short contigs to predict partial genes 
--------------------------------------------------------

- local or working directory

   .. code-block:: sh
   
      rgi main --input_sequence /path/to/nucleotide_input.fasta --output_file /path/to/output_file --local --low_quality 

- system wide 

   .. code-block:: sh
   
      rgi main --input_sequence /path/to/nucleotide_input.fasta --output_file /path/to/output_file --low_quality


Clean previous or old databases
--------------------------------

- local or working directory

   .. code-block:: sh

      rgi clean --local

- system wide 

   .. code-block:: sh 
   
      rgi clean      

RGI Heatmap
------------

- Default Heatmap

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/
       
- Heatmap with `AMR Gene Family` categorization

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/ --category gene_family

- Heatmap with `AMR Gene Family` categorization and fill display

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/ --category gene_family --display fill

- Heatmap with `AMR Gene Family` categorization and coloured y-axis labels display

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/ --category gene_family --display text


- Heatmap with frequency display enabled

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/ --frequency

- Heatmap with drug class category and frequency enabled

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/ --category drug_class --frequency --display text

- Heatmap with samples and genes clustered

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/ --cluster both

- Heatmap with resistance mechanism categorization and clustered samples

      .. code-block:: sh

            rgi heatmap --input /path/to/rgi_results_json_files_directory/ --cluster samples --category resistance_mechanism --display fill


Run RGI from docker
-------------------

- First you you must either pull the docker container from dockerhub (latest CARD version automatically installed)

  .. code-block:: sh

        docker pull finlaymaguire/rgi

- Or Alternatively, build it locally from the Dockerfile (latest CARD version automatically installed)

  .. code-block:: sh

        git clone https://github.com/arpcard/rgi
        docker build -t arpcard/rgi rgi

- Then you can either run interactively (mounting a local directory called `rgi_data` in your current directory
  to `/data/` within the container

  .. code-block:: sh

        docker run -i -v $PWD/rgi_data:/data -t arpcard/rgi bash

- Or you can directly run the container as an executable with `$RGI_ARGS` being any of the commands described above. Remember paths to input and outputs files are relative to the container (i.e. `/data/` if mounted as above).

  .. code-block:: sh
        
        docker run -v $PWD/rgi_data:/data arpcard/rgi $RGI_ARGS
       
Tab-delimited results file
---------------------------

+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    ORF_ID                                                | Open Reading Frame identifier (internal to RGI)|
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Contig                                                | Source Sequence                                |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Start                                                 | Start co-ordinate of ORF                       |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Stop                                                  | End co-ordinate of ORF                         |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Orientation                                           | Strand of ORF                                  |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Cut_Off                                               | RGI Detection Paradigm                         |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Pass_Bitscore                                         | STRICT detection model bitscore value cut-off  |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Best_Hit_Bitscore                                     | Bitscore value of match to top hit in CARD     |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Best_Hit_ARO                                          | ARO term of top hit in CARD                    |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Best_Identities                                       | Percent identity of match to top hit in CARD   |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    ARO                                                   | ARO accession of top hit in CARD               |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Model_type                                            | CARD detection model type                      |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|                                                          | Mutations observed in the ARO term of top hit  |
|    SNPs_in_Best_Hit_ARO                                  | in CARD (if applicable)                        |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|                                                          | Mutations observed in ARO terms of other hits  |
|    Other_SNPs                                            | indicated by model id (if applicable)          |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Drug Class                                            | ARO Categorization                             |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Resistance Mechanism                                  | ARO Categorization                             |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    AMR Gene Family                                       | ARO Categorization                             |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Predicted_DNA                                         | ORF predicted nucleotide sequence              |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Predicted_Protein                                     | ORF predicted protein sequence                 |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    CARD_Protein_Sequence                                 | Protein sequence of top hit in CARD            |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       | Calculated as percentage                       |
|                                                          | (length of ORF protein /                       |
|    Percentage Length of Reference Sequence               | length of CARD reference protein)              |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    ID                                                    | HSP identifier (internal to RGI)               |
+----------------------------------------------------------+------------------------------------------------+
| ::                                                       |                                                |
|    Model_id                                              | CARD detection model id                        |
+----------------------------------------------------------+------------------------------------------------+



Support & Bug Reports
----------------------

Please log an issue on `github issue <https://github.com/arpcard/rgi/issues>`_.

You can email the CARD curators or developers directly at `card@mcmaster.ca <mailto:card@mcmaster.ca>`_, via Twitter at `@arpcard <http://www.twitter.com/arpcard>`_.

_data/.gitignore

deleted100644 → 0
+0 −1
Original line number Diff line number Diff line
card.json
 No newline at end of file
Loading