Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
5b047bc
removing excess primer fetch function
cmaceves Feb 3, 2023
d0e2ad0
explicitly initializing primer variables
cmaceves Feb 3, 2023
f1ecf63
adding macos latest back to github actions
cmaceves Feb 6, 2023
cee84a3
removing unused variable cur_depth
cmaceves Feb 6, 2023
74257f4
Merge pull request #146 from andersen-lab/solving_compile_errors
cmaceves Feb 6, 2023
a74617e
Bump version number to 1.3.2
khyox Feb 14, 2023
a3a417c
Merge pull request #150 from khyox/master
cmaceves Feb 14, 2023
8759901
adding insertion sort to header file
cmaceves Feb 14, 2023
9bba261
adding insertion sort outside of get_overlapping_primers call
cmaceves Feb 14, 2023
965399e
moving insertionSort call outside of get_overlapping_primers call
cmaceves Feb 14, 2023
f0033f1
changing type of min_depth from uint8_t to uint32_t
cmaceves Feb 14, 2023
0c493ea
changing default min_length for ivar trim
cmaceves Feb 14, 2023
7f96ae0
calculating min length to be 50% the first read if no default is set
cmaceves Feb 14, 2023
17cbab9
Merge pull request #152 from andersen-lab/issue_145
cmaceves Feb 15, 2023
c6d1d42
Added option to read and write to stdcin.
gkarthik Feb 20, 2023
48207d3
Merge branch 'issue_147' of https://github.com/andersen-lab/ivar into…
gkarthik Feb 20, 2023
6e44fa0
Added back check on header from input. Switched to cerr for primers.
gkarthik Feb 20, 2023
7aabf49
updating the overlapping primers to approximate overlap with binary s…
cmaceves Feb 22, 2023
997f671
adding binary search for nearest neighbor search primers
cmaceves Feb 22, 2023
1420a54
update tests for proper input to trim primer change for stdin
cmaceves Feb 22, 2023
3cd07f1
change to pass by reference for performance gains
cmaceves Feb 23, 2023
f81356d
changing to averaging the length of the first 1000 reads to set min l…
cmaceves Feb 23, 2023
672c737
Merge branch 'trim_io' into issue_143
cmaceves Feb 23, 2023
c052acb
Merge pull request #156 from andersen-lab/issue_143
cmaceves Feb 23, 2023
af6798c
changing the sam_itr to match the new stdin code
cmaceves Feb 23, 2023
1732b5d
Merge pull request #155 from andersen-lab/trim_io
cmaceves Feb 23, 2023
ec36afe
manually bumping version
cmaceves Feb 23, 2023
e72b563
pushing index fix for runtime error on linux machines
cmaceves Feb 23, 2023
43cc9f0
changing primers to pass by reference for performance gains
cmaceves Feb 23, 2023
0f4a9b7
update doxygen docs
cmaceves Feb 24, 2023
e624260
updating all docs
cmaceves Feb 24, 2023
617fbdd
updating command line output
cmaceves Feb 24, 2023
4afbd10
updating docs to include more specific commands
cmaceves Feb 25, 2023
907ffe6
fixing error in docs bwa pipe to ivar trim
cmaceves Feb 25, 2023
10f8e01
editing input of ivar trim in docs
cmaceves Feb 25, 2023
6b8bbd5
updating ivar trim input and m params
cmaceves Feb 25, 2023
5e18fdb
updating the ivar trim input to be not required in docs
cmaceves Feb 25, 2023
c1eced4
adding -c parameter to docs for consensus
cmaceves Feb 25, 2023
a3ed2b4
adding fix for stdin and -m parameter calculation combination
cmaceves Mar 17, 2023
b551748
bumping version
cmaceves Mar 17, 2023
c9c7141
Untested code to iterate over alns
gkarthik Mar 17, 2023
977d382
Corrected syntax error with iterator
gkarthik Mar 18, 2023
8fd8afd
fixing iterate_reads value for while loop
cmaceves Mar 20, 2023
5159c7b
minor fix around bam_init in loop
cmaceves Mar 20, 2023
2e982a8
Fixes issue #157
gkarthik Mar 21, 2023
4257857
Merge pull request #158 from andersen-lab/issue_157
cmaceves Mar 21, 2023
84fe5a6
Bumped version
gkarthik Mar 21, 2023
bd4be6c
Merge branch 'issue_157'
gkarthik Mar 21, 2023
012db89
fixing continues to incrementing reads then continue
cmaceves Mar 24, 2023
4ac3db1
Single function for iterating through reads.
gkarthik Mar 27, 2023
4407dea
Merge pull request #160 from andersen-lab/issue_159
cmaceves Mar 28, 2023
7d6f3f3
update ubuntu images
cmaceves Mar 28, 2023
89f1990
removing ubuntu 22.04 workflow
cmaceves Mar 28, 2023
e100896
Merge pull request #161 from andersen-lab/remove_outdated_action
cmaceves Mar 28, 2023
2c43e0d
bumping version for release 1.4.2
cmaceves Mar 28, 2023
1fdad39
bump htsfile version and ubuntu version
cmaceves May 30, 2023
08aac33
Merge pull request #166 from andersen-lab/issue_165
cmaceves Jun 1, 2023
7e115a7
fix build failure with gcc-13
emollier Jul 20, 2023
9703e61
adding fix for case where unpaired reads have forward primers trimmed
cmaceves Apr 25, 2024
98b47a7
change the direction of codon and its translation to match the strand…
asereewit Jun 7, 2024
226e896
Take strand into account to get the right codon start position
gkarthik Jun 8, 2024
cc64510
Cited source
gkarthik Jun 8, 2024
14cf664
Added test for amino acid translation taking strand into account
gkarthik Jun 8, 2024
49079e2
Ignore empty lines that are usually present at end of file
gkarthik Jun 8, 2024
48cea74
Fixed condition to trim unpaired reverse reads
gkarthik Jun 13, 2024
051c571
Added test to quality unpaired reverse reads
gkarthik Jun 13, 2024
cfe4f2f
Merge branch 'master' into issue_175
gkarthik Jun 13, 2024
cccb744
Potentially fixes #102 and fixes #175;Renamed tests to test_*
gkarthik Jun 13, 2024
be4aabc
update dockerfile for macos and update github workflow for config aux…
cmaceves Jun 17, 2024
ed2de33
add more specific information about system to configure
cmaceves Jun 18, 2024
9e6b77f
attempt to suppress unsued variable warning in tests
cmaceves Jun 18, 2024
a72d378
adding in correct compile flag for tests only
cmaceves Jun 18, 2024
aa716fc
changing flag to be gcc compatible
cmaceves Jun 18, 2024
ad95851
version updated prior to 1.4.3 release
cmaceves Jun 18, 2024
94a9f24
Fixed ccpp workflow. Removed clang format check workflow.
gkarthik Jun 19, 2024
06138db
Added new argument -G to count gaps towards depth for variants.
gkarthik Feb 7, 2025
606d364
Merge pull request #169 from emollier/gcc-13
gkarthik Feb 25, 2025
755620a
Bumped version to 1.4.4
gkarthik Feb 25, 2025
f68b5f9
Merge remote-tracking branch 'alab/master'
gkarthik Feb 25, 2025
dc06630
Updated manual with -G option for variants
gkarthik Feb 25, 2025
29f196f
Fixed output directory path
gkarthik Feb 25, 2025
e666e4c
Updated docs.
gkarthik Feb 25, 2025
c23113f
Update README.md
MarkZeller Jun 6, 2025
076fdc7
fixing ubuntu version in workflow
cmaceves Aug 2, 2025
eb0bab1
bump gcc version to 11
cmaceves Aug 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ jobs:

strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
os: [ubuntu-22.04]

steps:
- uses: actions/checkout@master
- name: download htslib
run: |
wget https://github.com/samtools/htslib/archive/1.10.2.tar.gz
sudo apt-get install gcc-7
sudo apt-get install gcc-11
- name: untar
run: tar xf 1.10.2.tar.gz
- name: install htslib
env:
CC: gcc-7
CC: gcc-11
run: |
cd htslib-1.10.2/
autoheader
Expand All @@ -36,47 +36,42 @@ jobs:
sudo ldconfig
- name: autotools
env:
CC: gcc-7
CC: gcc-11
run: ./autogen.sh
- name: configure
env:
CC: gcc-7
CC: gcc-11
run: ./configure
- name: make
env:
CC: gcc-7
CC: gcc-11
run: make
- name: make check
env:
CC: gcc-7
CC: gcc-11
run: make check
- name: make install
env:
CC: gcc-7
CC: gcc-11
run: sudo make install

build-macos:

runs-on: [ macos-11 ]
runs-on: [ macos-14 ]

steps:
- uses: actions/checkout@master
- name: install GNU autotools
run: |
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make && sudo make install
brew install automake libtool
brew install autoconf automake libtool
- name: download htslib
run: wget https://github.com/samtools/htslib/archive/1.10.2.tar.gz
run: wget https://github.com/samtools/htslib/releases/download/1.12/htslib-1.12.tar.bz2
- name: untar
run: tar xf 1.10.2.tar.gz
run: tar xf htslib-1.12.tar.bz2
- name: install htslib
run: |
cd htslib-1.10.2/
autoheader
autoconf
cd htslib-1.12/
autoreconf -i
./configure
make
sudo make install
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/clang-format-check.yml

This file was deleted.

20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FROM ubuntu:18.04
FROM ubuntu:20.04
MAINTAINER Karthik G <gkarthik@scripps.edu>

RUN apt-get update
RUN apt-get install -y build-essential autoconf zlib1g-dev python3 wget libbz2-dev liblzma-dev libncurses-dev git bedtools python3-pip vim nano
# HTSlib
RUN cd root/ &&\
wget https://github.com/samtools/htslib/releases/download/1.9/htslib-1.9.tar.bz2 &&\
tar xvf htslib-1.9.tar.bz2 &&\
cd htslib-1.9/ &&\
wget https://github.com/samtools/htslib/releases/download/1.10.2/htslib-1.10.2.tar.bz2 &&\
tar xvf htslib-1.10.2.tar.bz2 &&\
cd htslib-1.10.2/ &&\
./configure &&\
make &&\
make install &&\
cd ../ &&\
rm htslib-1.9.tar.bz2
rm htslib-1.10.2.tar.bz2
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
# SAMtools
RUN cd root &&\
Expand All @@ -34,12 +34,12 @@ RUN cd root/ &&\
make install
# bwa
RUN cd root/ &&\
wget https://github.com/lh3/bwa/archive/v0.7.17.tar.gz &&\
tar xvf v0.7.17.tar.gz &&\
cd bwa-0.7.17/ &&\
wget https://github.com/lh3/bwa/archive/v0.7.18.tar.gz &&\
tar xvf v0.7.18.tar.gz &&\
cd bwa-0.7.18/ &&\
make &&\
cd ../ &&\
rm v0.7.17.tar.gz
ENV PATH /root/bwa-0.7.17:$PATH
rm v0.7.18.tar.gz
ENV PATH /root/bwa-0.7.18:$PATH
# Snakemake
RUN pip3 install pandas snakemake
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.

OUTPUT_DIRECTORY = /Users/karthik/Documents/code/ivar/docs
OUTPUT_DIRECTORY = ./docs

# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bioRxiv doi: [https://doi.org/10.1101/383513](https://doi.org/10.1101/383513)

Manual for iVar is available [here](https://andersen-lab.github.io/ivar/html/).

## Insallation
## Installation

### Dependencies

Expand Down
26 changes: 14 additions & 12 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,23 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the `hts' library (-lhts). */
/* Define to 1 if you have the 'hts' library (-lhts). */
#undef HAVE_LIBHTS

/* Define to 1 if you have the `pthread' library (-lpthread). */
/* Define to 1 if you have the 'pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD

/* Define to 1 if you have the `z' library (-lz). */
/* Define to 1 if you have the 'z' library (-lz). */
#undef HAVE_LIBZ

/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
/* Define to 1 if your system has a GNU libc compatible 'malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC

/* Define to 1 if you have the `memmove' function. */
/* Define to 1 if you have the 'memmove' function. */
#undef HAVE_MEMMOVE

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if your system has a GNU libc compatible `realloc' function,
/* Define to 1 if your system has a GNU libc compatible 'realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC

Expand All @@ -32,6 +29,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

Expand All @@ -50,7 +50,7 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to 1 if the system has the type `_Bool'. */
/* Define to 1 if the system has the type '_Bool'. */
#undef HAVE__BOOL

/* Name of package */
Expand All @@ -74,7 +74,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C89 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS

/* Version number of package */
Expand All @@ -90,7 +92,7 @@
#define below would cause a syntax error. */
#undef _UINT8_T

/* Define to `__inline__' or `__inline' if that's what the C compiler
/* Define to '__inline__' or '__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.63])
AC_INIT([ivar], [1.3.1], [gkarthik@scripps.edu])
AC_INIT([ivar], [1.4.4], [gkarthik@scripps.edu])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_HEADERS([config.h])

Expand Down
20 changes: 20 additions & 0 deletions data/test.strand.pileup
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
test 1 G 20 GGGGGGGGGGGGGGGGGGGG ????????????????????
test 2 A 20 AAAAAAAAAAAAAAAAAAAA ????????????????????
test 3 G 20 GGGGGGGGGGGGGGGGGGGG ????????????????????
test 4 G 20 GGGGGGGGGGGGGGGGGGGG ????????????????????
test 5 C 20 CCCCCCCCCCTTTTTTTTTT ????????????????????
test 6 T 20 TTTTTTTTTTTTTTTTTTTT ????????????????????
test 7 G 20 GGGGGGGGGGGGGGGGGGGG ????????????????????
test 8 C 20 CCCCCCCCCCCCCCCCCCCC ????????????????????
test 9 C 20 CCCCCCCCCCCCCCCCCCCC ????????????????????
test 10 A 20 AAAAAAAAAAAAAAAAAAAA ????????????????????
test 11 G 20 GGGGGGGGGGGGGGGGGGGG ????????????????????
test 12 C 20 CCCCCCCCCCCCCCCCCCCC ????????????????????
test 13 C 20 CCCCCCCCCCCCCCCCCCCC ????????????????????
test 14 G 20 GGGGGGGGGGGGGGGGGGGG ????????????????????
test 15 G 20 GGGGGGGGGGCCCCCCCCCC ????????????????????
test 16 A 20 AAAAAAAAAAAAAAAAAAAA ????????????????????
test 17 C 20 CCCCCCCCCCCCCCCCCCCC ????????????????????
test 18 T 20 TTTTTTTTTTTTTTTTTTTT ????????????????????
test 19 T 20 TTTTTTTTTTTTTTTTTTTT ????????????????????
test 20 C 20 CCCCCCCCCCCCCCCCCCCC ????????????????????
3 changes: 3 additions & 0 deletions data/test_strand.gff
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## GFF3 file format
test Genbank CDS 1 9 . + . ID=test1;Note=positiveStrand;gene=A;
test Genbank CDS 11 20 . - . ID=test2;Note=negativeStrand;gene=B;
Binary file added data/test_unpaired.sorted.bam
Binary file not shown.
Binary file added data/test_unpaired.sorted.bam.bai
Binary file not shown.
18 changes: 14 additions & 4 deletions docs/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,39 @@ Command:
```
ivar trim

Usage: ivar trim -i <input.bam> -b <primers.bed> -p <prefix> [-m <min-length>] [-q <min-quality>] [-s <sliding-window-width>]
Usage: ivar trim -i [<input.bam>] -b <primers.bed> [-p <prefix>] [-m <min-length>] [-q <min-quality>] [-s <sliding-window-width>]

Input Options Description
-i (Required) Sorted bam file, with aligned reads, to trim primers and quality
-i Sorted bam file, with aligned reads, to trim primers and quality. If not specified will read from standard in
-b (Required) BED file with primer sequences and positions
-f Primer pair information file containing left and right primer names for the same amplicon separated by a tab
If provided, reads will be filtered based on their overlap with amplicons prior to trimming
-m Minimum length of read to retain after trimming (Default: 30)
-m Minimum length of read to retain after trimming (Default: 50% the average length of the first 1000 reads)
-q Minimum quality threshold for sliding window to pass (Default: 20)
-s Width of sliding window (Default: 4)
-e Include reads with no primers. By default, reads with no primers are excluded
-k Keep reads to allow for reanalysis: keep reads which would be dropped by
alignment length filter or primer requirements, but mark them QCFAIL

Output Options Description
-p (Required) Prefix for the output BAM file
-p Prefix for the output BAM file. If none is specified the output will write to standard out.
```

Example Usage:
```
ivar trim -b test_primers.bed -p test.trimmed -i test.bam -q 15 -m 50 -s 4
samtools view -h test.bam | ivar trim -b test_primers.bed -p test.trimmed
```

The command above will produce a trimmed BAM file test.trimmed.bam after trimming the aligned reads in test.bam using the primer positions specified in test_primers.bed and a minimum quality threshold of **15**, minimum read length of **50** and a sliding window of **4**.

Example Usage:
```
bwa mem -t 32 reference.fa 1.fq 2.fq | ivar trim -b test_primers.bed -x 3 -m 30 | samtools sort - | samtools mpileup -aa -A -Q 0 -d 0 - | ivar consensus -p test_consensus -m 10 -n N -t 0.5
```

The command above will allow you to go from alignment to consensus sequence in a single command using the bwa aligner.

Example BED file

```
Expand Down Expand Up @@ -112,6 +120,7 @@ Input Options Description
-q Minimum quality score threshold to count base (Default: 20)
-t Minimum frequency threshold(0 - 1) to call variants (Default: 0.03)
-m Minimum read depth to call variants (Default: 0)
-G Count gaps towards depth. By default, gaps are not counted
-r Reference file used for alignment. This is used to translate the nucleotide sequences and identify intra host single nucleotide variants
-g A GFF file in the GFF3 format can be supplied to specify coordinates of open reading frames (ORFs). In absence of GFF file, amino acid translation will not be done.

Expand Down Expand Up @@ -280,6 +289,7 @@ Note : samtools mpileup output must be piped into ivar consensus
Input Options Description
-q Minimum quality score threshold to count base (Default: 20)
-t Minimum frequency threshold(0 - 1) to call consensus. (Default: 0)
-c Minimum insertion frequency threshold(0 - 1) to call consensus. (Default: 0.8)
Frequently used thresholds | Description
---------------------------|------------
0 | Majority or most common base
Expand Down
Binary file added docs/html/bc_sd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading