Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom easyblock for CRISPR-DAV #2487

Merged
merged 5 commits into from
Aug 19, 2021
Merged
Changes from 2 commits
Commits
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
100 changes: 100 additions & 0 deletions easybuild/easyblocks/c/crisprdav.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
##
# Copyright 2020-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# https://github.com/easybuilders/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
EasyBuild support for building and installing Metagenome-Atlas, implemented as an easyblock.
deniskristak marked this conversation as resolved.
Show resolved Hide resolved

@author: Denis Kristak (INUITS)
"""
import os
from easybuild.tools.filetools import write_file
from easybuild.easyblocks.generic.binary import Binary


class EB_crisprdav(Binary):
deniskristak marked this conversation as resolved.
Show resolved Hide resolved
"""
Support for building/installing crispr-dav.
"""

def post_install_step(self):
"""Create config.txt files"""
crisprdav_installdir_ex = os.path.join(self.installdir, 'Examples/example1/')
deniskristak marked this conversation as resolved.
Show resolved Hide resolved
abra2_dir = os.environ['EBROOTABRA2']
prinseq_dir = os.environ['EBROOTPRINSEQ']
flash_dir = os.environ['EBROOTFLASH']
deniskristak marked this conversation as resolved.
Show resolved Hide resolved

config_file = os.path.join(self.installdir, 'conf.txt')
example_fastq_list_file = os.path.join(self.installdir, 'Examples/example1/fastq.list')

# writing to Example directory to run sanity checks
example_config_file = os.path.join(self.installdir, 'Examples/example1/conf.txt')

CONFIG_FILE_TEXT_FORMATTED = CONFIG_FILE_TEXT.format(crisprdav_installdir_ex=crisprdav_installdir_ex,
deniskristak marked this conversation as resolved.
Show resolved Hide resolved
abra2_dir=abra2_dir, prinseq_dir=prinseq_dir,
flash_dir=flash_dir)
FASTQ_LIST_FILE_TEXT_FORMATTED = FASTQ_LIST_FILE_TEXT.format(crisprdav_installdir_ex=crisprdav_installdir_ex)
# according to docs, we have to setup conf.txt so that it contains correct paths to dependencies
# https://github.com/pinetree1/crispr-dav/blob/master/Install-and-Run.md
# User then has to change conf.txt to include paths to genomes
write_file(config_file, CONFIG_FILE_TEXT_FORMATTED)
write_file(example_config_file, CONFIG_FILE_TEXT_FORMATTED)
# also used for sanity checking with Examples/ folder
write_file(example_fastq_list_file, FASTQ_LIST_FILE_TEXT_FORMATTED)


# obtained from
# https://github.com/pinetree1/crispr-dav/blob/master/conf.txt
# see the original file for detailed commentary
CONFIG_FILE_TEXT = """
deniskristak marked this conversation as resolved.
Show resolved Hide resolved
# change this part to contain paths to your genomes
[genomex]
ref_fasta = {crisprdav_installdir_ex}/genome/genomex.fa
bwa_idx = {crisprdav_installdir_ex}/genome/genomex.fa
refGene = {crisprdav_installdir_ex}/genome/refgenex.txt

[app]
abra = {abra2_dir}/abra2-2.23.jar
deniskristak marked this conversation as resolved.
Show resolved Hide resolved
prinseq = {prinseq_dir}/prinseq-lite.pl
flash = {flash_dir}/bin/flash2

[prinseq]
min_qual_mean = 30
min_len = 50
ns_max_p = 3

[other]
realign_flag = Y
min_mapq = 20
wing_length = 100
high_res = 0
parallel_env = orte
cores_per_job = 12
"""

FASTQ_LIST_FILE_TEXT = r"""
sample1 {crisprdav_installdir_ex}/rawfastq/sample1_R1.fastq.gz {crisprdav_installdir_ex}/rawfastq/sample1_R2.fastq.gz
deniskristak marked this conversation as resolved.
Show resolved Hide resolved
sample2 {crisprdav_installdir_ex}/rawfastq/sample2_R1.fastq.gz {crisprdav_installdir_ex}/rawfastq/sample2_R2.fastq.gz
sample3 {crisprdav_installdir_ex}/rawfastq/sample3_R1.fastq.gz {crisprdav_installdir_ex}/rawfastq/sample3_R2.fastq.gz
sample4 {crisprdav_installdir_ex}/rawfastq/sample4_R1.fastq.gz {crisprdav_installdir_ex}/rawfastq/sample4_R2.fastq.gz
"""