Package: r2g
Reads to Genes (r2g)IntroductionImplementationPulling the Docker image (recommended)Installing with Conda channels for Linux usersInstalling with Homebrew for macOS usersManual installation for all platformsRequired third-party applicationsInstalling the r2g packageSetting up the environmentSystem requirementsUsageSpecific options for running the Docker imageAn example: finding the "non-existent"S6Kgene in a mosquito speciesRetrieve the sequence of a homologous gene from a well-studied speciesSelect a public SRA database for the species to be investigatedRun the r2g pipelineReview the resultIntroductionReads to Genes, orr2g, is a computationally lightweight and homology-based pipeline that allows rapid identification of genes or gene families from raw sequence databases in the absence of an assembly, by taking advantage of  over44.3 petabases of sequencing datafor all kinds of species deposited inSequence Read Archivehosted byNational Center for Biotechnology Information, which can be effectively run onmost common computers without high-end specs.ImplementationPulling the Docker image (recommended)Please follow the instructionhereto download and install Docker based on your operating system before running the Docker image.For Windows users, please checkhereto configure the Docker if it is your first time to use it.This installation method isrecommendedas it is compatible with most common operating systems including Linux, macOS and Windows.Then, pull the r2g Docker image with all required software packages installed and configured by one command as follows:docker pull yangwu91/r2g:latestNow, you are good to go.Installing with Conda channels for Linux usersFor Linux users, r2g can be installed by Conda as follows. Of courseminiconda3(recommended) oranacondaneeds to be installed first.# Install miniconda3:wgethttps://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
shMiniconda3-latest-Linux-x86_64.sh# Set up bioconda channel (or its mirrors):condaconfig--addchannelsdefaults
condaconfig--addchannelsbioconda
condaconfig--addchannelsconda-forge# Install r2g:condainstall-cyangwu91r2gAfter that,Google Chrome web browserand the corresponding version ofChromeDriver(orselenium/standalone-chromeDocker image) need to be installed.In the future, I plan to create a pull request to the Bioconda recipes.Installing with Homebrew for macOS usersProgress:Build Homebrew FormulaInit a pull request to thebrewsci/bioTap.Be permitted by thebrewsci/bioTap.Since the r2g formula is still waiting for the approval from the thebrewsci/bioTap, macOS users can download the r2g formula and add it manually on your local computer.# Install Homebrew and add the tap
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap brewsci/bio
# Download the r2g formula and put it in the correct directory:
/usr/local/Cellar/curl/7.72.0/bin/curl -o /usr/local/Homebrew/Library/Taps/brewsci/homebrew-bio/Formula/r2g.rb -fsSL https://raw.githubusercontent.com/yangwu91/r2g/master/brewsci-Formula/r2g.rb
# Install r2g:
brew install r2gAnd thenGoogle Chrome web browserand the corresponding version ofChromeDriver(orselenium/standalone-chromeDocker image) need to be installed.Manual installation for all platformsRequired third-party applicationsThe r2g required 3 third-party software packages includingNCBI SRA Toolkit,Trinity, andGoogle Chrome web browserwithChromeDriver(orselenium/standalone-chromeDocker image).NCBI SRA ToolkitDownload pre-built binaries forall platformshereor compile the source codehereby yourself.ForLinuxandmacOSusers, it also can be installed usingCondavia theBiocondachannel:condainstall-cbiocondasra-toolsIf the installed version of SRA Toolkit is above 2.10.3, before the first run you have to execute the follow command:vdb-config--interactiveThen pressxto set up the default configs. This is a known annoyingissuethat can't be avoided.TrinityFollow theinstructionto compile the source code. Please note that Trinity has its own dependencies, includingsamtools,Python 3withNumPy,bowtie2,jellyfish,salmon, andtrimmomatic. If you are a macOS user while compiling Trinity, please usegcccompiler instead of nativeclangcomplier on macOS to avoid raising errors.FormacOSusers, Trinity can be installed using Homebrew as well:brewtapbrewsci/bio
brewinstalltrinityForLinuxusers, Trinity can be installed easily using Conda, and you would never worry about other dependencies:condainstall-cbiocondatrinity=2.8.5numpysamtools=1.10The compatibility of TrinityVersion 2.8.5with r2g has been fully tested, and theoretically, the later versions should work too.Google Chrome web browser with ChromeDriverInstallGoogle Chrome web browserand then download the corresponding version ofChromeDriver.Or, you can simply runselenium/standalone-chromeDocker image in background (make sure you have the permission to bind the 4444 port on local host):dockerrun-d-p4444:4444-v/dev/shm:/dev/shmselenium/standalone-chromeInstalling the r2g packageThe r2g package has been deposited to PyPI, so it can be installed as follows:pip install r2gSetting up the environmentIf these required third-party applications above are installed using Conda, you don't need to take care of it.If these packages are compiled or downloaded by yourself, either include them in$PATHseparately by a command as follows:# Linux and macOS:
export PATH="$PATH:/path/to/fastq-dump:/path/to/Trinity:/path/to/chromedriver"
# Windows:
set PATH=%PATH%;DRIVER:\path\to\fastq-dump;DRIVER:\path\to\Trinity;DRIVER:\path\to\chromedriveror follow the prompts to set up the path to the executable files manually before the first run. And then, you are good to go.System requirementsThe recommended minimal hardware specifications are2-core CPUand4 Gb memory, which are satisfied for most common personal computers nowadays.UsageDetailed usage will be printed by the command:dockerrun-ityangwu91/r2g:latest--helpOr:r2g--helpOptional arguments:
  -h, --help            show this help message and exit
  -V, --version         Print the version.
  -v, --verbose         Print detailed log.
  -r [INT], --retry [INT]
                        Number of times to retry.Enabling it without any numbers will force it to keep retrying. Default: 5.
  --cleanup             Clean up all intermediate files and only retain the final assembled contig file in FASTA format.
  -o DIR, --outdir DIR  Specify an output directory. Default: current working directory.
  -W DIR, --browser DIR
                        Temporarily overwrite the local path or the remote address of the chrome webdriver. E.g., /path/to/chromedriver or http://127.0.0.1:4444/wd/hub
  -P SCHEME://IP:PORT, --proxy SCHEME://IP:PORT
                        Set up proxies. Http and socks are allowed, but authentication is not supported yet (still testing).

NCBI options:
  -s SRA, --sra SRA     Choose SRA accessions (comma-separated without blank space). E.g., "SRX885418" (an SRA experiment) or "SRR1812886,SRR1812887" (SRA runs)
  -q SEQUENCE, --query SEQUENCE
                        Submit either a FASTA file or nucleotide sequences.
  -p BLAST, --program BLAST
                        Specify a BLAST program: tblastn, tblastx, or blastn (including megablast, blastn, and discomegablast). Default: blastn.
  -m INT, --max_num_seq INT
                        Maximum number of aligned sequences to retrieve (the actual number of alignments may be greater than this). Default: 1000.
  -e FLOAT, --evalue FLOAT
                        Expected number of chance matches in a random model. Default: 1e-3.
  -c FRAGMENT,OVERLAP, --cut FRAGMENT,OVERLAP
                        Cut sequences and query them respectively to prevent weaker matches from being ignored. Default: 70,20 (nucleotides), or 24,7 (amino acids)

Trinity options:
  -t INT, --CPU INT     Number of CPU threads to use. Default: the total number of your computer.
  --max_memory RAM      Suggest max Gb of memory to use by Trinity. Default: 4G.
  --min_contig_length INT
                        Minimum assembled contig length to report. Default: 150.
  --trim [TRIM_PARAM]   Run Trimmomatic to qualify and trim reads. Using this option without any parameters will trigger preset settings in Trinity for Trimmomatic. See Trinity for more help. Default: disabled.
  --stage {no_trinity,jellyfish,inchworm,chrysalis,butterfly}
                        Stop Trinity after the stage you chose. Default: butterfly (the final stage).Specific options for running the Docker imageWhile executing the Docker image, some specific options are required:-v /dev/shm:/dev/shm,-v /path/to/your/workspace:/workspace, and-u $UID.The option-v /dev/shm:/dev/shmshares host's memory to avoid applications crashing inside a Docker container.The option-v /path/to/your/workspace:/workspacemounts the local directory/path/to/your/workspace(specify your own) to the working directory/workspace(don't change it) inside a Docker container,which is the input and output directory.The option-u $UIDsets the owner of the Docker outputs.Ignoring it will raise permission errors.Let's say there is a query file in FASTA format namedQUERY.fastain the folder/home/user/r2g_workspace/. As a result, the the simplest full command to run a Docker image should be:dockerrun-it-v/dev/shm:/dev/shm-v/home/user/r2g_workspace:/workspace-u$UIDyangwu91/r2g:latest-oOUTPUT-qQUERY.fasta-sSRXNNNNNNAfter that, you can check out the results in the folder/home/user/r2g_workspace/OUTPUT/.An example: finding the "non-existent"S6Kgene in a mosquito speciesWe applied the r2g pipeline to search the geneS6K(i.e.AAEL018120fromAedes aegypti, which is a well-studied species) inAedes albopictusSRA experimentSRX885420(https://www.ncbi.nlm.nih.gov/sra/SRX885420) using the engineblastn. Detailed workflow is described as follows.Retrieve the sequence of a homologous gene from a well-studied speciesDownload nucleotide/protein sequences ofAedes aegypti S6KfromVectorBase,Ensembl,NCBIor other online databases, and let’s say it was saved as the file/home/user/r2g_orkspace/AAEL018120-RE.S6K.fasta.Aedes aegyptiis a well-studied mosquito species.Select a public SRA database for the species to be investigatedSelect a proper SRA experiment forAedes albopictus(e.g.SRX885420). Some genes only express in specific tissues or at specific time. Make sure the gene you are interested in indeed expresses in the SRA experiment(s) you selected.Run the r2g pipelineRun the r2g pipeline. Here, we chopped the query (/home/user/r2g_workspace/AAEL018120-RE.S6K.fasta) into 80-base fragments overlapping 50 bases. The command line is as follows:dockerrun-it-v/dev/shm:/dev/shm-v/home/user/r2g_workspace:/workspace-u$UIDyangwu91/r2g:latest-o/workspace/S6K_q-aae_s-SRX885420_c-80.50_p-blastn-sSRX885420-q/workspace/AAEL018120-RE.S6K.fasta--cut80,50-pblastnOr,r2g-o/home/user/r2g_workspace/S6K_q-aae_s-SRX885420_c-80.50_p-blastn-sSRX885420-q/home/user/r2g_workspace/AAEL018120-RE.S6K.fasta--cut80,50-pblastnReview the resultThe sequence file in FASTA format of the predictedAedes albopictus S6Kis in the folder/home/user/r2g_workspace/S6K_q-aae_s-SRX885420_c-80.50_p-blastn/. Please verify the sequences by the PCR amplification or other methods if necessary.