COVID-19 PubSeq Public Sequence Workflow

public public 1yr ago Version: Version 1 0 bookmarks

COVID-19 PubSeq: Public Sequence uploader

This repository provides a sequence uploader for the COVID-19 Virtual Biohackathon's Public Sequence Resource project. There are two versions, one that runs on the command line and another that acts as web interface. You can use it to upload the genomes of SARS-CoV-2 samples to make them publicly and freely available to other researchers. For more information see the paper .

alt text

To get started, first install the uploader , and use the bh20-seq-uploader command to upload your data .

Installation

There are several ways to install the uploader. The most portable is with a virtualenv .

Installation with virtualenv

  1. Prepare your system. You need to make sure you have Python, and the ability to install modules such as pycurl and pyopenssl . On Ubuntu 18.04, you can run:
sudo apt update
sudo apt install -y virtualenv git libcurl4-openssl-dev build-essential python3-dev libssl-dev
  1. Create and enter your virtualenv. Go to some memorable directory and make and enter a virtualenv:
virtualenv --python python3 venv
. venv/bin/activate

Note that you will need to repeat the . venv/bin/activate step from this directory to enter your virtualenv whenever you want to use the installed tool.

  1. Install the tool. Once in your virtualenv, install this project:

Install from PyPi:

pip3 install bh20-seq-uploader

Install from git:

pip3 install git+https://github.com/arvados/bh20-seq-resource.git@master
  1. Test the tool. Try running:
bh20-seq-uploader --help

It should print some instructions about how to use the uploader.

Make sure you are in your virtualenv whenever you run the tool! If you ever can't run the tool, and your prompt doesn't say (venv) , try going to the directory where you put the virtualenv and running . venv/bin/activate . It only works for the current terminal window; you will need to run it again if you open a new terminal.

Installation with pip3 --user

If you don't want to have to enter a virtualenv every time you use the uploader, you can use the --user feature of pip3 to install the tool for your user.

  1. Prepare your system. Just as for the virtualenv method, you need to install some dependencies. On Ubuntu 18.04, you can run:
sudo apt update
sudo apt install -y virtualenv git libcurl4-openssl-dev build-essential python3-dev libssl-dev
  1. Install the tool. You can run:
pip3 install --user git+https://github.com/arvados/bh20-seq-resource.git@master
  1. Make sure the tool is on your PATH . The pip3 command will install the uploader in .local/bin inside your home directory. Your shell may not know to look for commands there by default. To fix this for the terminal you currently have open, run:
export PATH=$PATH:$HOME/.local/bin

To make this change permanent, assuming your shell is Bash, run:

echo 'export PATH=$PATH:$HOME/.local/bin' >>~/.bashrc
  1. Test the tool. Try running:
bh20-seq-uploader --help

It should print some instructions about how to use the uploader.

Installation from Source for Development

If you plan to contribute to the project, you may want to install an editable copy from source. With this method, changes to the source code are automatically reflected in the installed copy of the tool.

  1. Prepare your system. On Ubuntu 18.04, you can run:
sudo apt update
sudo apt install -y virtualenv git libcurl4-openssl-dev build-essential python3-dev libssl-dev
  1. Clone and enter the repository. You can run:
git clone https://github.com/arvados/bh20-seq-resource.git
cd bh20-seq-resource
  1. Create and enter a virtualenv. Go to some memorable directory and make and enter a virtualenv:
virtualenv --python python3 venv
. venv/bin/activate

Note that you will need to repeat the . venv/bin/activate step from this directory to enter your virtualenv whenever you want to use the installed tool.

  1. Install the checked-out repository in editable mode. Once in your virtualenv, install with this special pip command:
pip3 install -e .
  1. Test the tool. Try running:
bh20-seq-uploader --help

It should print some instructions about how to use the uploader.

Installation with GNU Guix

For running/developing the uploader with GNU Guix see INSTALL.md

Usage

Run the uploader with a FASTA or FASTQ file and accompanying metadata file in JSON or YAML:

bh20-seq-uploader example/metadata.yaml example/sequence.fasta

If the sample_id of your upload matches a sample already in PubSeq, it will be considered a new version and supercede the existing entry.

Workflow for Generating a Pangenome

All these uploaded sequences are being fed into a workflow to generate a pangenome for the virus. You can replicate this workflow yourself.

An example is to get your SARS-CoV-2 sequences from GenBank in seqs.fa , and then run a series of commands

minimap2 -cx asm20 -X seqs.fa seqs.fa >seqs.paf
seqwish -s seqs.fa -p seqs.paf -g seqs.gfa
odgi build -g seqs.gfa -s -o seqs.odgi
odgi viz -i seqs.odgi -o seqs.png -x 4000 -y 500 -R -P 5

Here we convert such a pipeline into the Common Workflow Language (CWL) and sources can be found here .

For more information on building pangenome models, see this wiki page .

Web Interface

This project comes with a simple web server that lets you use the sequence uploader from a browser. It will work as long as you install the packager with the web extra.

To run it locally:

virtualenv --python python3 venv
. venv/bin/activate
pip install -e ".[web]"
env FLASK_APP=bh20simplewebuploader/main.py flask run

Then visit http://127.0.0.1:5000/ .

Production

For production deployment, you can use gunicorn :

pip3 install gunicorn
gunicorn bh20simplewebuploader.main:app

This runs on http://127.0.0.1:8000/ by default, but can be adjusted with various gunicorn options .

Code Snippets

20
21
22
23
24
25
26
baseCommand: abpoa
stdout: $(inputs.readsFA.nameroot).O0.gfa
arguments: [
    $(inputs.readsFA),
    -r 3,
    -O, '0'
]
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
baseCommand: python3
inputs:
  script:
    type: File
    default:
      class: File
      location: collect-seqs.py
    inputBinding: {position: 1}
  src_project:
    type: string
    inputBinding: {position: 2}
  metadataSchema:
    type: File
    inputBinding: {position: 3}
  exclude:
    type: File?
    inputBinding: {position: 4}
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
baseCommand: python
inputs:
  script:
    type: File
    default:
      class: File
      location: dups2metadata.py
    inputBinding: {position: 1}
  metadata:
    type: File
    inputBinding: {position: 2}
  dups:
    type: File?
    inputBinding: {position: 3}
30
arguments: [python3, $(inputs.script), $(inputs.metadata), $(inputs.fasta), $(inputs.query)]
41
42
entryname: "block"+b,
entry: JSON.stringify(block)
45
46
entryname: "subs"+b,
entry: JSON.stringify(sub)
52
baseCommand: python
24
25
26
arguments: [odgi, build, -g, $(inputs.inputGFA), -o, -,
            {shellQuote: false, valueFrom: "|"},
            odgi, sort, -i, -, -p, s, -o, $(inputs.inputGFA.nameroot).odgi]
24
25
26
27
28
29
arguments:
  - "sh"
  - "-c"
  - >-
    odgi build -g '$(inputs.inputGFA.path)' -o - | odgi unchop -i - -o - |
    odgi sort -i - -p s -o $(inputs.inputGFA.nameroot).unchop.sorted.odgi
18
19
20
21
arguments:
  [odgi_to_rdf.py, $(inputs.odgi), "-",
   {valueFrom: "|", shellQuote: false},
   xz, --stdout]
38
39
entryname: "block"+b,
entry: JSON.stringify(block)
42
43
entryname: "subs"+b,
entry: JSON.stringify(sub)
53
baseCommand: [python]
24
25
26
27
28
29
baseCommand: seqwish
arguments: [-t, $(runtime.cores),
            -k, $(inputs.kmerSize),
            -s, $(inputs.readsFA),
            -p, $(inputs.readsPAF),
            -g, $(inputs.readsPAF.nameroot).gfa]
29
baseCommand: [python]
20
21
22
23
24
25
26
baseCommand: spoa
stdout: $(inputs.readsFA.nameroot).g6.gfa
arguments: [
    $(inputs.readsFA),
    -G,
    -g, '-6'
]
ShowHide 12 more snippets with no or duplicated tags.

Login to post a comment if you would like to share your experience with this workflow.

Do you know this workflow well? If so, you can request seller status , and start supporting this workflow.

Free

Created: 1yr ago
Updated: 1yr ago
Maitainers: public
URL: https://github.com/arvados/bh20-seq-resource
Name: covid-19-pubseq-pangenome-generate
Version: Version 1
Badge:
workflow icon

Insert copied code into your website to add a link to this workflow.

Downloaded: 0
Copyright: Public Domain
License: Boost Software License 1.0
  • Future updates

Related Workflows

cellranger-snakemake-gke
snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...