Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into lr-giraffe
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnovak committed Jun 5, 2024
2 parents 4ee2592 + 4b1c72b commit 39a7462
Show file tree
Hide file tree
Showing 23 changed files with 1,614 additions and 652 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ before_script:
- sudo apt-get -q -y update
# Make sure we have some curl stuff for pycurl which we need for some Python stuff
# And the CI report upload needs uuidgen from uuid-runtime
- sudo apt-get -q -y install --no-upgrade docker.io python3-pip python3-virtualenv libcurl4-gnutls-dev python-dev npm nodejs node-gyp uuid-runtime libgnutls28-dev doxygen libzstd-dev
- sudo apt-get -q -y install --no-upgrade docker.io python3-pip python3-virtualenv libcurl4-gnutls-dev python-dev npm nodejs node-gyp uuid-runtime libgnutls28-dev doxygen libzstd-dev bcftools
- which junit-merge || sudo npm install -g junit-merge
# Configure Docker to use a mirror for Docker Hub and restart the daemon
- |
Expand Down
85 changes: 67 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,41 @@ The easiest way to get vg is to download one of our release builds for Linux. We

If you don't want to or can't use a pre-built release of vg, or if you want to become a vg developer, you can build it from source instead.

#### Linux: Clone VG

First, obtain the repo and its submodules:

git clone --recursive https://github.com/vgteam/vg.git
cd vg

#### Linux: Install Dependencies

Then, install VG's dependencies. You'll need the protobuf and jansson development libraries installed, and to run the tests you will need:
* `jq`, `bc`, `rs`, and `parallel`
* `hexdump` and `column` from `bsdmainutils`
* [`npm` for testing documentation examples](https://github.com/anko/txm)).
* `jq`, `bc`, `rs`, and `parallel`
* `hexdump` and `column` from `bsdmainutils`
* [`npm` for testing documentation examples](https://github.com/anko/txm)).

On Ubuntu, you should be able to do:

make get-deps

If you get complaints that `sudo` is not found, install it:

apt update
apt install sudo

If you get a bunch of errors like `E: Unable to locate package build-essential`, make sure your package index files are up to date by running:

sudo apt update

On other distros, you will need to perform the equivalent of:
On other distros, or if you do not have root access, you will need to perform the equivalent of:

sudo apt-get install build-essential git cmake pkg-config libncurses-dev libbz2-dev \
protobuf-compiler libprotoc-dev libprotobuf-dev libjansson-dev \
automake gettext autopoint libtool jq bsdmainutils bc rs parallel \
npm curl unzip redland-utils librdf-dev bison flex gawk lzma-dev \
liblzma-dev liblz4-dev libffi-dev libcairo-dev libboost-all-dev \
libzstd-devel pybind11-dev python3-pybind11
libzstd-dev pybind11-dev python3-pybind11
Note that **Ubuntu 16.04** does not ship a sufficiently new Protobuf; vg requires **Protobuf 3** which will have to be manually installed.

Expand All @@ -85,22 +99,47 @@ Other libraries may be required. Please report any build difficulties.

Note that a 64-bit OS is required. Ubuntu 20.04 should work.

When you are ready, build with `. ./source_me.sh && make`, and run with `./bin/vg`.
#### Linux: Build

When you are ready, build with `. ./source_me.sh && make`. You can use `make -j16` to run 16 build threads at a time, which greatly accelerates the process. If you have more CPU cores, you can use higher numbers.

Note that vg can take anywhere from 10 minutes to more than an hour to compile depending on your machine and the number of threads used.

You can also produce a static binary with `make static`, assuming you have static versions of all the dependencies installed on your system.

#### Linux: Run

Once vg is built, the binary will be at `bin/vg` inside the vg repository directory. You can run it with:

```
./bin/vg
```

You can also add its directory to your `PATH` enviornment variable, so that you can invoke `vg` from any directory. To do that on Bash, use this command from the vg repository directory:

```
echo 'export PATH="${PATH}:'"$(pwd)"'/bin"' >>~/.bashrc
```

Then close your terminal and open a new one. Run `vg` to make sure it worked.

If it did not work, make sure that you have a `.bash_profile` file in your home directory that will run your `.bashrc`:
```
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
```

### Building on MacOS

#### Clone VG
#### Mac: Clone VG

The first step is to clone the vg repository:

git clone --recursive https://github.com/vgteam/vg.git
cd vg

#### Install Dependencies
#### Mac: Install Dependencies

VG depends on a number of packages being installed on the system where it is being built. Dependencies can be installed using either [MacPorts](https://www.macports.org/install.php) or [Homebrew](http://brew.sh/).

Expand All @@ -118,17 +157,35 @@ Homebrew provides another package management solution for OSX, and may be prefer
# Install all the dependencies in the Brewfile
brew bundle

#### Build
#### Mac: Build

With dependencies installed, VG can now be built:

. ./source_me.sh && make

As with Linux, you can add `-j16` or other numbers at the end to run multiple build tasks at once, if your computer can handle them.

**Note that static binaries cannot yet be built for Mac.**

Our team has successfully built vg on Mac with GCC versions 4.9, 5.3, 6, 7, and 7.3, as well as Clang 9.0.

#### Migrating to ARM Macs
#### Mac: Run

Once vg is built, the binary will be at `bin/vg` inside the vg repository directory. You can run it with:

```
./bin/vg
```

You can also add its directory to your `PATH` enviornment variable, so that you can invoke `vg` from any directory. To do that on the default `zsh` Mac shell, use this command from the vg repository directory:

```
echo 'export PATH="${PATH}:'"$(pwd)"'/bin"' >>~/.zshrc
```

Then close your terminal and open a new one. Run `vg` to make sure it worked.

##### Migrate a VG installation from x86 to ARM

The Mac platform is moving to ARM, with Apple's M1, M1 Pro, M1 Max, and subsequent chip designs. The vg codebase supports ARM on Mac as well as on Linux. **The normal installation instructions work on a factory-fresh ARM Mac**.

Expand Down Expand Up @@ -396,14 +453,6 @@ vg index hla.vg -x hla.xg
vg deconstruct hla.xg -e -p "gi|568815592:29791752-29792749" > hla_variants.vcf
```

Variants can also be inferred strictly from topology by not using `-e`, though unlike the above example, cycles are not supported. "Deconstruct" the VCF variants that were used to construct the graph. The output will be similar but identical to `small/x.vcf.gz` as `vg construct` can add edges between adjacent alts and/or do some normalization:

<!-- !test check Deconstruct from construct -->
```sh
# using the same graph from the `map` example
vg deconstruct x.xg -p x > x.vcf
```

Haplotype paths from `.gbz` or `.gbwt` indexes input can be considered using `-z` and `-g', respectively.

As with `vg call`, it is best to compute snarls separately and pass them in with `-r` when working with large graphs.
Expand Down
2 changes: 1 addition & 1 deletion src/clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void visit_contained_snarls(const PathPositionHandleGraph* graph, const vector<R
}
path_name_set.clear();
graph_path_name_set.clear();
PathTraversalFinder trav_finder(*graph, snarl_manager, path_names);
PathTraversalFinder trav_finder(*graph, path_names);

// Do the top-level snarls, the recurse as needed (framework copied from deconstructor.cpp)
snarl_manager.for_each_top_level_snarl([&](const Snarl* snarl) {
Expand Down
Loading

0 comments on commit 39a7462

Please sign in to comment.