Skip to content

Commit

Permalink
Merge pull request #15 from cokelaer/main
Browse files Browse the repository at this point in the history
automatically set the index algorithm
  • Loading branch information
cokelaer authored Jul 7, 2023
2 parents 3e4940b + e29ec91 commit db17112
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ Changelog
========= ======================================================================
Version Description
========= ======================================================================
1.0.1 * automatically fill the bwa index algorithm and fix bwa_index rule to
use the options in the config file (not the harcoded one)
1.0.0 * use last warppers and graphviz apptainer
0.12.0 * set all apptainers containers and add vcf to bcf conversions
* Update rule sambamba to use latest wrappers
Expand Down
22 changes: 17 additions & 5 deletions sequana_pipelines/variant_calling/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ def __init__(self, prog=NAME, epilog=None):
help="The annotation for snpeff"
)
pipeline_group.add_argument("--threads", dest="threads", default=4, type=int)
pipeline_group.add_argument("--do-coverage", dest="do_coverage",
action="store_true",
pipeline_group.add_argument("--do-coverage", dest="do_coverage",
action="store_true",
help="perform the coverage analysis using sequana_coverage")
pipeline_group.add_argument("--do-joint-calling", dest="do_joint_calling",
action="store_true",
pipeline_group.add_argument("--do-joint-calling", dest="do_joint_calling",
action="store_true",
help="do the joint calling analysise")

pipeline_group.add_argument("-o", "--circular", action="store_true")
Expand Down Expand Up @@ -136,12 +136,24 @@ def main(args=None):
cfg['sequana_coverage']["circular"] = options.circular
cfg['joint_freebayes']['do'] = options.do_joint_calling
cfg['bwa_mem']['threads'] = options.threads


cfg['freebayes']['ploidy'] = options.freebayes_ploidy

cfg.reference_file = os.path.abspath(options.reference)
manager.exists(cfg.reference_file)

# coverage
# Given the reference, let us compute its length and st the index algorithm
from sequana import FastA
f = FastA(options.reference)
N = f.get_stats()['total_length']

# seems to be a hardcoded values in bwa according to the documentation
if N >= 2000000000:
cfg['bwa_mem']['index_algorithm'] = "bwtsw"
else:
cfg['bwa_mem']['index_algorithm'] = "is"



# finalise the command and save it; copy the snakemake. update the config
Expand Down
4 changes: 2 additions & 2 deletions sequana_pipelines/variant_calling/variant_calling.rules
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ if not config["input_pattern"].endswith("bam"):
log:
"reference/build.log"
params:
options="",
index_algorithm="is"
options=config['bwa_mem'].get('index_options', ""),
index_algorithm=config['bwa_mem'].get('index_algorithm', "is")
container:
config['apptainers']['sequana_tools']
threads: 2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

_MAJOR = 1
_MINOR = 0
_MICRO = 0
_MICRO = 1

version = '%d.%d.%d' % (_MAJOR, _MINOR, _MICRO)
release = '%d.%d' % (_MAJOR, _MINOR)
Expand Down

0 comments on commit db17112

Please sign in to comment.