Skip to content

Commit

Permalink
Merge pull request #63 from pdimens/dev
Browse files Browse the repository at this point in the history
stage release of version 0.9
  • Loading branch information
pdimens authored Apr 2, 2024
2 parents e86e1b6 + 5a870d7 commit 96e0617
Show file tree
Hide file tree
Showing 31 changed files with 81,032 additions and 119 deletions.
32 changes: 30 additions & 2 deletions .github/workflows/align.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
shell: micromamba-shell {0}
- name: test bwa
shell: micromamba-shell {0}
run: harpy align bwa -g test/genome/genome.fasta.gz -s "--show-failed-logs" test/fastq
run: harpy align bwa -g test/genome/genome.fasta.gz -s "--show-failed-logs" -x "-A 2" test/fastq
test_ema:
name: ema
runs-on: ubuntu-latest
Expand Down Expand Up @@ -108,4 +108,32 @@ jobs:
shell: micromamba-shell {0}
- name: test ema
shell: micromamba-shell {0}
run: harpy align ema --ema-bins 20 -g test/genome/genome.fasta.gz -s "--show-failed-logs" test/fastq
run: harpy align ema --ema-bins 20 -g test/genome/genome.fasta.gz -s "--show-failed-logs" -x "-d" test/fastq
test_minimap:
name: minimap
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: setup mamba
uses: mamba-org/setup-micromamba@v1
env:
ACTIONS_STEP_DEBUG: true
with:
init-shell: bash
generate-run-shell: true
environment-file: workflow/envs/harpy.yaml
cache-environment: true
post-cleanup: 'all'
log-level: error
- name: Install harpy
run: |
python3 -m pip install --upgrade build && python3 -m build
pip install dist/*.whl
resources/buildforCI.sh
shell: micromamba-shell {0}
- name: test minimap
shell: micromamba-shell {0}
run: harpy align minimap -g test/genome/genome.fasta.gz -s "--show-failed-logs" -x "--seed 13" test/fastq
2 changes: 1 addition & 1 deletion .github/workflows/phase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:

- name: phase
shell: micromamba-shell {0}
run: harpy phase --vcf test/vcf/test.bcf -s "--show-failed-logs" test/bam
run: harpy phase --vcf test/vcf/test.bcf -s "--show-failed-logs" -x "--max_iter 10001" test/bam

- name: phase with indels
shell: micromamba-shell {0}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ jobs:
- name: harpy qc
shell: micromamba-shell {0}
run: harpy qc test/fastq
run: harpy qc test/fastq -x "--trim_poly_g"

- name: harpy qc skip adapter trimming
if: always()
shell: micromamba-shell {0}
run: harpy qc test/fastq -a
run: harpy qc -a test/fastq
87 changes: 87 additions & 0 deletions .github/workflows/simulate_variants.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Test Simulate Variants

on:
push:
branches:
- 'dev'
paths:
- 'simulate**.smk'
- 'workflow/envs/harpy.yaml'
- '**helperfunctions.py'
- '**printfunctions.py'
- '**fileparsers.py'
- 'test/vcf/test.bcf'
- 'workflow/scripts/simuG.pl'
- '**__main__.py'

pull_request:
branches:
- 'dev'
paths:
- 'simulate**.smk'
- 'workflow/envs/harpy.yaml'
- '**helperfunctions.py'
- '**printfunctions.py'
- '**fileparsers.py'
- 'test/vcf/test.bcf'
- 'workflow/scripts/simuG.pl'
- '**__main__.py'

env:
CACHE_NUMBER: 0 # increase to reset cache manually

jobs:
build:
name: test simulations
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: setup mamba
uses: mamba-org/setup-micromamba@v1
env:
ACTIONS_STEP_DEBUG: true
with:
init-shell: bash
generate-run-shell: true
environment-file: workflow/envs/harpy.yaml
cache-environment: true
post-cleanup: 'all'
log-level: error
- name: Install harpy
shell: micromamba-shell {0}
run: |
python3 -m pip install --upgrade build && python3 -m build
pip install dist/*.whl
resources/buildforCI.sh
- name: simulate random snps/indels
shell: micromamba-shell {0}
run: |
harpy simulate snpindel --snp-count 10 --indel-count 10 -z 0.5 test/genome/genome.fasta.gz
harpy simulate snpindel --prefix Simulate/snpvcf --snp-vcf Simulate/snpindel/sim.snpindel.snp.hap1.vcf --indel-vcf Simulate/snpindel/sim.snpindel.indel.hap1.vcf test/genome/genome.fasta.gz
- name: simulate inversions
shell: micromamba-shell {0}
if: always()
run: |
harpy simulate inversion --count 10 -z 0.5 test/genome/genome.fasta.gz
harpy simulate inversion --prefix Simulate/invvcf --vcf Simulate/inversion/sim.inversion.hap1.vcf test/genome/genome.fasta.gz
- name: simulate cnv
shell: micromamba-shell {0}
if: always()
run: |
harpy simulate cnv --count 10 -z 0.5 test/genome/genome.fasta.gz
harpy simulate cnv --prefix Simulate/cnvvcf --vcf Simulate/cnv/sim.cnv.hap1.vcf test/genome/genome.fasta.gz
- name: simulate translocations
shell: micromamba-shell {0}
if: always()
run: |
harpy simulate translocation --count 10 -z 0.5 test/genome/genome.fasta.gz
harpy simulate translocation --prefix Simulate/transvcf --vcf Simulate/translocation/sim.translocation.hap1.vcf test/genome/genome.fasta.gz
4 changes: 2 additions & 2 deletions .github/workflows/variants_snp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
resources/buildforCI.sh
- name: snp mpileup
shell: micromamba-shell {0}
run: harpy snp mpileup -w 150000 -g test/genome/genome.fasta.gz -q test/bam
run: harpy snp mpileup -w 150000 -g test/genome/genome.fasta.gz -q -x "--ignore-RG" test/bam
- name: snp mpileup-pop
shell: micromamba-shell {0}
run: harpy snp mpileup -w 150000 -g test/genome/genome.fasta.gz -p test/samples.groups -q test/bam
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
resources/buildforCI.sh
- name: snp freebayes
shell: micromamba-shell {0}
run: harpy snp freebayes -w 150000 -g test/genome/genome.fasta.gz -q test/bam
run: harpy snp freebayes -w 150000 -g test/genome/genome.fasta.gz -q -x "-g 200" test/bam
- name: snp freebayes-pop
shell: micromamba-shell {0}
run: harpy snp freebayes -w 150000 -g test/genome/genome.fasta.gz -p test/samples.groups -q test/bam
4 changes: 2 additions & 2 deletions .github/workflows/variants_sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
resources/buildforCI.sh
- name: leviathan
shell: micromamba-shell {0}
run: harpy sv leviathan -g test/genome/genome.fasta.gz -q -s "--show-failed-logs" test/bam
run: harpy sv leviathan -g test/genome/genome.fasta.gz -q -s "--show-failed-logs" -x "-M 2002" test/bam
continue-on-error: true
- name: leviathan-pop
if: always()
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
resources/buildforCI.sh
- name: naibr
shell: micromamba-shell {0}
run: harpy sv naibr -g test/genome/genome.fasta.gz -o SV/naibr -s "--show-failed-logs" test/bam_phased
run: harpy sv naibr -g test/genome/genome.fasta.gz -o SV/naibr -s "--show-failed-logs" -x "-min_sv 5000" test/bam_phased
- name: naibr pop
if: always()
shell: micromamba-shell {0}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Genome/
Align/
SNP/
SV/
Simulate/
Impute/
Preflight/
Phase/
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "harpy"
version = "0.8.0"
version = "0.9.0"
authors = [
{name = "Pavel Dimens"}
]
Expand Down
File renamed without changes.
38 changes: 38 additions & 0 deletions resources/DEPRECATED/makewindows.fai.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#! /usr/bin/env python3
import argparse
parser = argparse.ArgumentParser(
prog='makewindows.py',
description='Create a BED file of fixed intervals from a fasta.fai file (generated with samtools faidx). Nearly identical to bedtools makewindows, except the intervals are nonoverlapping.'
)
parser.add_argument("-i", dest = "infile", required = True, type=str, metavar = "<input.fasta.fai>", help="input fasta.fai file")
parser.add_argument("-o", dest = "outfile", required = True, type=str, metavar = "<output.bed>", help="output BED file name")
parser.add_argument("-w", dest = "window", type=int, metavar = "<window_size>", default = "10000", help="interval size (default: %(default)s)")
args = parser.parse_args()

with open(args.infile, "r") as fai:
outbed = open(args.outfile, "w")
while True:
# Get next line from file
line = fai.readline()
# if line is empty
# end of file is reached
if not line:
break
# split the line by tabs
lsplit = line.split("\t")
contig = lsplit[0]
c_len = int(lsplit[1])
start = 1
end = args.window
starts = [1]
ends = [args.window]
while end < c_len:
end = end + args.window if (end + args.window) < c_len else c_len
ends.append(end)
start += args.window
starts.append(start)

# write to output file
for (startpos, endpos) in zip (starts,ends):
outbed.write(f"{contig}\t{startpos}\t{endpos}\n")
outbed.close()
Loading

0 comments on commit 96e0617

Please sign in to comment.