Skip to content

Commit

Permalink
Merge pull request #10 from UMCUGenetics/release/v2.0.0
Browse files Browse the repository at this point in the history
Release/v2.0.0
  • Loading branch information
rernst authored Jun 9, 2023
2 parents c259673 + 40ee0cf commit 487e8ab
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 10 deletions.
10 changes: 10 additions & 0 deletions Kinship/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM --platform=linux/amd64 continuumio/miniconda3

LABEL base_image="continuumio/miniconda3"
LABEL version="1.0.0"
LABEL extra.binaries="vcftools, plink, king"

RUN conda config --add channels bioconda && \
conda config --add channels conda-forge && \
conda install -y vcftools=0.1.14 plink=1.90b4 king=2.2.7

10 changes: 5 additions & 5 deletions Utils/Kinship.nf → Kinship/Kinship.nf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
process Kinship {
// Custom process to run Kinship tools
tag {"Kinship ${analysis_id}"}
label 'Kinship'
container = 'docker.io/umcugenbioinf/kinship:1.0.0'
shell = ['/bin/bash', '-euo', 'pipefail']

input:
Expand All @@ -13,10 +13,10 @@ process Kinship {

script:
"""
${params.vcftools_path}/vcftools --vcf ${vcf_file} --plink
${params.plink_path}/plink --file out --make-bed --noweb
${params.king_path}/king -b plink.bed --kinship
vcftools --vcf ${vcf_file} --plink
plink --file out --make-bed --noweb
king -b plink.bed --kinship
cp king.kin0 ${analysis_id}.kinship
python ${baseDir}/CustomModules/Utils/check_kinship.py ${analysis_id}.kinship ${ped_file} > ${analysis_id}.kinship_check.out
python ${baseDir}/CustomModules/Kinship/check_kinship.py ${analysis_id}.kinship ${ped_file} > ${analysis_id}.kinship_check.out
"""
}
File renamed without changes.
2 changes: 1 addition & 1 deletion MipsTrimDedup/MipsTrimDedup.nf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ process MipsTrimDedup {
rg_id = "${sample_id}_MergedTrimmedDedup"

"""
python ${params.mips_trim_dedup_path}/mips_trim_dedup.py -d ${params.dxtracks_path}/${params.mips_design_file} -l ${params.mips_uuid_length} -ur ${params.mips_uuid_read} -r1 ${r1_args} -r2 ${r2_args}
python2 ${params.mips_trim_dedup_path}/mips_trim_dedup.py -d ${params.dxtracks_path}/${params.mips_design_file} -l ${params.mips_uuid_length} -ur ${params.mips_uuid_read} -r1 ${r1_args} -r2 ${r2_args}
"""
}
2 changes: 1 addition & 1 deletion Utils/CreateHSmetricsSummary.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ process CreateHSmetricsSummary {

script:
"""
python ${baseDir}/CustomModules/Utils/create_hsmetrics_summary.py ${hsmetrics_files} > HSMetrics_summary.txt
python2 ${baseDir}/CustomModules/Utils/create_hsmetrics_summary.py ${hsmetrics_files} > HSMetrics_summary.txt
"""
}
2 changes: 1 addition & 1 deletion Utils/GetStatsFromFlagstat.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ process GetStatsFromFlagstat {

script:
"""
python ${baseDir}/CustomModules/Utils/get_stats_from_flagstat.py ${flagstat_files} > run_stats.txt
python2 ${baseDir}/CustomModules/Utils/get_stats_from_flagstat.py ${flagstat_files} > run_stats.txt
"""
}
2 changes: 1 addition & 1 deletion Utils/ParseChildFromFullTrio.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ process ParseChildFromFullTrio {
script:
def sample_ids = sample_id.join(" ")
"""
python ${baseDir}/CustomModules/Utils/parse_child_from_fulltrio.py ${ped_file} ${sample_ids} | tr -d '\n'
python2 ${baseDir}/CustomModules/Utils/parse_child_from_fulltrio.py ${ped_file} ${sample_ids} | tr -d '\n'
"""
}
27 changes: 26 additions & 1 deletion Utils/parse_child_from_fulltrio.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
#! /usr/bin/env python
import argparse
from check_kinship import parse_ped


def parse_ped(ped_file):
samples = {} # 'sample_id': {'family': 'fam_id', 'parents': ['sample_id', 'sample_id']}

for line in ped_file:
ped_data = line.strip().split()
family, sample, father, mother, sex, phenotype = ped_data

# Create samples
if sample not in samples:
samples[sample] = {'family': family, 'parents': [], 'children': []}
if father != '0' and father not in samples:
samples[father] = {'family': family, 'parents': [], 'children': []}
if mother != '0' and mother not in samples:
samples[mother] = {'family': family, 'parents': [], 'children': []}

# Save sample relations
if father != '0':
samples[sample]['parents'].append(father)
samples[father]['children'].append(sample)
if mother != '0':
samples[sample]['parents'].append(mother)
samples[mother]['children'].append(sample)
return samples


if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Check kinship output based on ped file.')
Expand Down

0 comments on commit 487e8ab

Please sign in to comment.