diff --git a/.ci_stuff/ChIP.sample_broad_config.yaml b/.ci_stuff/ChIP.sample_broad_config.yaml new file mode 100644 index 000000000..924e4f709 --- /dev/null +++ b/.ci_stuff/ChIP.sample_broad_config.yaml @@ -0,0 +1,19 @@ +chip_dict: + sample1: + control: sample7 + broad: True + sample2: + control: sample7 + broad: True + sample3: + control: sample8 + broad: True + sample4: + control: sample8 + broad: True + sample5: + control: sample9 + broad: True + sample6: + control: sample9 + broad: True diff --git a/.ci_stuff/ChIP.sample_config.yaml b/.ci_stuff/ChIP.sample_config.yaml index f2ff5b5ee..c48354d34 100644 --- a/.ci_stuff/ChIP.sample_config.yaml +++ b/.ci_stuff/ChIP.sample_config.yaml @@ -1,13 +1,19 @@ chip_dict: sample1: - control: sample3 + control: sample7 broad: False sample2: - control: sample3 + control: sample7 + broad: False + sample3: + control: sample8 broad: False sample4: - control: sample6 + control: sample8 broad: False sample5: - control: sample6 + control: sample9 + broad: False + sample6: + control: sample9 broad: False diff --git a/.ci_stuff/ChIP.sample_noControl_config.yaml b/.ci_stuff/ChIP.sample_noControl_config.yaml new file mode 100644 index 000000000..6c1927dd3 --- /dev/null +++ b/.ci_stuff/ChIP.sample_noControl_config.yaml @@ -0,0 +1,19 @@ +chip_dict: + sample1: + control: + broad: False + sample2: + control: + broad: False + sample3: + control: + broad: False + sample4: + control: + broad: False + sample5: + control: + broad: False + sample6: + control: + broad: False diff --git a/.ci_stuff/ChIP.sample_short_config.yaml b/.ci_stuff/ChIP.sample_short_config.yaml new file mode 100644 index 000000000..f2ff5b5ee --- /dev/null +++ b/.ci_stuff/ChIP.sample_short_config.yaml @@ -0,0 +1,13 @@ +chip_dict: + sample1: + control: sample3 + broad: False + sample2: + control: sample3 + broad: False + sample4: + control: sample6 + broad: False + sample5: + control: sample6 + broad: False diff --git a/.ci_stuff/test_dag.sh b/.ci_stuff/test_dag.sh index a6e0e7c5b..2f3c4c3c7 100755 --- a/.ci_stuff/test_dag.sh +++ b/.ci_stuff/test_dag.sh @@ -13,14 +13,20 @@ touch PE_input/sample1_R1.fastq.gz PE_input/sample1_R2.fastq.gz \ PE_input/sample3_R1.fastq.gz PE_input/sample3_R2.fastq.gz \ PE_input/sample4_R1.fastq.gz PE_input/sample4_R2.fastq.gz \ PE_input/sample5_R1.fastq.gz PE_input/sample5_R2.fastq.gz \ - PE_input/sample6_R1.fastq.gz PE_input/sample6_R2.fastq.gz + PE_input/sample6_R1.fastq.gz PE_input/sample6_R2.fastq.gz \ + PE_input/sample7_R1.fastq.gz PE_input/sample7_R2.fastq.gz \ + PE_input/sample8_R1.fastq.gz PE_input/sample8_R2.fastq.gz \ + PE_input/sample9_R1.fastq.gz PE_input/sample9_R2.fastq.gz mkdir -p SE_input touch SE_input/sample1_R1.fastq.gz \ SE_input/sample2_R1.fastq.gz \ SE_input/sample3_R1.fastq.gz \ SE_input/sample4_R1.fastq.gz \ SE_input/sample5_R1.fastq.gz \ - SE_input/sample6_R1.fastq.gz + SE_input/sample6_R1.fastq.gz \ + SE_input/sample7_R1.fastq.gz \ + SE_input/sample8_R1.fastq.gz \ + SE_input/sample9_R1.fastq.gz # Needed by ChIP and ATAC workflows mkdir -p BAM_input/deepTools_qc/bamPEFragmentSize BAM_input/filtered_bam BAM_input/Sambamba BAM_input/bamCoverage touch BAM_input/sample1.bam \ @@ -29,31 +35,46 @@ touch BAM_input/sample1.bam \ BAM_input/sample4.bam \ BAM_input/sample5.bam \ BAM_input/sample6.bam \ + BAM_input/sample7.bam \ + BAM_input/sample8.bam \ + BAM_input/sample9.bam \ BAM_input/filtered_bam/sample1.filtered.bam \ BAM_input/filtered_bam/sample2.filtered.bam \ BAM_input/filtered_bam/sample3.filtered.bam \ BAM_input/filtered_bam/sample4.filtered.bam \ BAM_input/filtered_bam/sample5.filtered.bam \ BAM_input/filtered_bam/sample6.filtered.bam \ + BAM_input/filtered_bam/sample7.filtered.bam \ + BAM_input/filtered_bam/sample8.filtered.bam \ + BAM_input/filtered_bam/sample9.filtered.bam \ BAM_input/filtered_bam/sample1.filtered.bam.bai \ BAM_input/filtered_bam/sample2.filtered.bam.bai \ BAM_input/filtered_bam/sample3.filtered.bam.bai \ BAM_input/filtered_bam/sample4.filtered.bam.bai \ BAM_input/filtered_bam/sample5.filtered.bam.bai \ BAM_input/filtered_bam/sample6.filtered.bam.bai \ + BAM_input/filtered_bam/sample7.filtered.bam.bai \ + BAM_input/filtered_bam/sample8.filtered.bam.bai \ + BAM_input/filtered_bam/sample9.filtered.bam.bai \ BAM_input/Sambamba/sample1.markdup.txt \ BAM_input/Sambamba/sample2.markdup.txt \ BAM_input/Sambamba/sample3.markdup.txt \ BAM_input/Sambamba/sample4.markdup.txt \ BAM_input/Sambamba/sample5.markdup.txt \ BAM_input/Sambamba/sample6.markdup.txt \ + BAM_input/Sambamba/sample7.markdup.txt \ + BAM_input/Sambamba/sample8.markdup.txt \ + BAM_input/Sambamba/sample9.markdup.txt \ BAM_input/deepTools_qc/bamPEFragmentSize/fragmentSize.metric.tsv \ BAM_input/bamCoverage/sample1.filtered.seq_depth_norm.bw \ BAM_input/bamCoverage/sample2.filtered.seq_depth_norm.bw \ BAM_input/bamCoverage/sample3.filtered.seq_depth_norm.bw \ BAM_input/bamCoverage/sample4.filtered.seq_depth_norm.bw \ BAM_input/bamCoverage/sample5.filtered.seq_depth_norm.bw \ - BAM_input/bamCoverage/sample6.filtered.seq_depth_norm.bw + BAM_input/bamCoverage/sample6.filtered.seq_depth_norm.bw \ + BAM_input/bamCoverage/sample7.filtered.seq_depth_norm.bw \ + BAM_input/bamCoverage/sample8.filtered.seq_depth_norm.bw \ + BAM_input/bamCoverage/sample9.filtered.seq_depth_norm.bw mkdir -p allelic_BAM_input/allelic_bams allelic_BAM_input/filtered_bam allelic_BAM_input/deepTools_qc/bamPEFragmentSize allelic_BAM_input/Sambamba allelic_BAM_input/bamCoverage/allele_specific touch allelic_BAM_input/allelic_bams/sample1.genome1.sorted.bam \ @@ -133,121 +154,165 @@ if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 284 ]; then exit 1 ; fi # DNA mapping WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp " | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 991 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1420 ]; then exit 1 ; fi WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim --mapq 20 --dedup --properPairs | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1059 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1521 ]; then exit 1 ; fi WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim --mapq 20 --dedup --properPairs --bcExtract | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1015 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1456 ]; then exit 1 ; fi WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim --mapq 20 --UMIDedup --properPairs --bcExtract | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1083 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1557 ]; then exit 1 ; fi WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim --mapq 20 --UMIDedup --properPairs | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1127 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1622 ]; then exit 1 ; fi WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --DAG --trim --mapq 20 --UMIDedup --properPairs | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1127 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1622 ]; then exit 1 ; fi WC=`DNA-mapping -i SE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 891 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1272 ]; then exit 1 ; fi WC=`DNA-mapping -i SE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim --mapq 20 --dedup --properPairs | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 959 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1373 ]; then exit 1 ; fi WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --DAG --trim --aligner bwa | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 979 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1402 ]; then exit 1 ; fi WC=`DNA-mapping -i PE_input -o output .ci_stuff/organism.yaml --snakemakeOptions " --dryrun --conda-prefix /tmp" --DAG --trim --aligner bwa-mem2 | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 979 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1402 ]; then exit 1 ; fi #allelic WC=`DNA-mapping -m allelic-mapping -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --VCFfile allelic_input/file.vcf.gz --strains strain1,strain2 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1713 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2466 ]; then exit 1 ; fi WC=`DNA-mapping -m allelic-mapping -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --SNPfile allelic_input/snpfile.txt --NMaskedIndex allelic_input/Ngenome .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1692 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2445 ]; then exit 1 ; fi WC=`DNA-mapping -m allelic-mapping -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --VCFfile allelic_input/file.vcf.gz --strains strain1 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1713 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2466 ]; then exit 1 ; fi # ChIP-seq WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 516 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 630 ]; then exit 1 ; fi +WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_broad_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 840 ]; then exit 1 ; fi WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 522 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 609 ]; then exit 1 ; fi WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --singleEnd .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 514 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 628 ]; then exit 1 ; fi WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --bigWigType log2ratio .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 470 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 562 ]; then exit 1 ; fi +#noInput +WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 403 ]; then exit 1 ; fi +WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich .ci_stuff/organism.yaml .ci_stuff/ChIP.sample__noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` # fromBAM WC=`ChIP-seq -d outdir --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 914 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1187 ]; then exit 1 ; fi +# fromBam and noInput +WC=`ChIP-seq -d outdir --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 801 ]; then exit 1 ; fi # spikein WC=`ChIP-seq -d BAM_input --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 838 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1142 ]; then exit 1 ; fi +# spikein and noInput +WC=`ChIP-seq -d BAM_input --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 698 ]; then exit 1 ; fi # fromBAM and spikein WC=`ChIP-seq -d outdir --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1044 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1447 ]; then exit 1 ; fi WC=`ChIP-seq -d outdir --useSpikeInForNorm --getSizeFactorsFrom TSS --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 802 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1178 ]; then exit 1 ; fi WC=`ChIP-seq -d outdir --useSpikeInForNorm --getSizeFactorsFrom input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 786 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1149 ]; then exit 1 ; fi # allelic -WC=`ChIP-seq -d allelic_BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 421 ]; then exit 1 ; fi +WC=`ChIP-seq -d allelic_BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_short_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 423 ]; then exit 1 ; fi +#multiComp +WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 842 ]; then exit 1 ; fi +WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 861 ]; then exit 1 ; fi +WC=`ChIP-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_broad_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1052 ]; then exit 1 ; fi +#multiComp and fromBam +WC=`ChIP-seq -d outdir --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1399 ]; then exit 1 ; fi +WC=`ChIP-seq -d outdir --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich --fromBAM BAM_input/filtered_bam/ .ci_stuff/organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1418 ]; then exit 1 ; fi +#multiComp and spikein +WC=`ChIP-seq -d BAM_input --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1255 ]; then exit 1 ; fi +WC=`ChIP-seq -d BAM_input --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1274 ]; then exit 1 ; fi +#multiComp and spikein and noInput +WC=`ChIP-seq -d BAM_input --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 853 ]; then exit 1 ; fi +WC=`ChIP-seq -d BAM_input --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 839 ]; then exit 1 ; fi +#multiComp and spikein and fromBam +WC=`ChIP-seq -d outdir --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1560 ]; then exit 1 ; fi +WC=`ChIP-seq -d outdir --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich --fromBAM BAM_input/filtered_bam/ .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1045 ]; then exit 1 ; fi +#multiComp and spikein and fromBam and noInput +WC=`ChIP-seq -d outdir --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1059 ]; then exit 1 ; fi +WC=`ChIP-seq -d outdir --useSpikeInForNorm --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich --fromBAM BAM_input/filtered_bam/ .ci_stuff/spikein_organism.yaml .ci_stuff/ChIP.sample_noControl_config.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1045 ]; then exit 1 ; fi # mRNA-seq WC=`mRNA-seq -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1181 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1673 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1193 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1685 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --rMats --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1213 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1705 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 841 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1201 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment,deepTools_qc" --trim .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1261 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1786 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment-free,deepTools_qc" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1330 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1876 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment,deepTools_qc" --bcExtract --trim .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1217 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1721 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment,deepTools_qc" --bcExtract --UMIDedup --trim .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1279 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1813 ]; then exit 1 ; fi WC=`mRNA-seq -i SE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1082 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1526 ]; then exit 1 ; fi WC=`mRNA-seq -i SE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 741 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1053 ]; then exit 1 ; fi WC=`mRNA-seq -i SE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment,deepTools_qc" --trim .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1150 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1627 ]; then exit 1 ; fi WC=`mRNA-seq -i SE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" -m "alignment-free,deepTools_qc" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1219 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1717 ]; then exit 1 ; fi WC=`mRNA-seq -i SE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim --fastqc .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1286 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1829 ]; then exit 1 ; fi WC=`mRNA-seq -i BAM_input/filtered_bam -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 833 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1151 ]; then exit 1 ; fi #multiple comparison groups WC=`mRNA-seq --mode alignment,alignment-free -i PE_input -o output --rMats --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1154 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1598 ]; then exit 1 ; fi # three prime sequencing WC=`mRNA-seq -i PE_input -o output --mode three-prime-seq --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1259 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1775 ]; then exit 1 ; fi WC=`mRNA-seq -i PE_input -o output --mode three-prime-seq,deepTools_qc --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1611 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2259 ]; then exit 1 ; fi #allelic WC=`mRNA-seq -m allelic-mapping,deepTools_qc -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --VCFfile allelic_input/file.vcf.gz --strains strain1,strain2 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1771 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2527 ]; then exit 1 ; fi WC=`mRNA-seq -m allelic-mapping,deepTools_qc -i allelic_BAM_input/filtered_bam --fromBAM --bamExt '.filtered.bam' -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --SNPfile allelic_input/snpfile.txt --NMaskedIndex allelic_input/Ngenome .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1408 ]; then exit 1 ; fi WC=`mRNA-seq -m allelic-mapping,deepTools_qc -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --VCFfile allelic_input/file.vcf.gz --strains strain1,strain2 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1783 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2539 ]; then exit 1 ; fi WC=`mRNA-seq -m allelic-mapping,deepTools_qc -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --SNPfile allelic_input/snpfile.txt --NMaskedIndex allelic_input/Ngenome .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1762 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2518 ]; then exit 1 ; fi WC=`mRNA-seq -m allelic-mapping,deepTools_qc -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --VCFfile allelic_input/file.vcf.gz --strains strain1 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1783 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2539 ]; then exit 1 ; fi WC=`mRNA-seq -m allelic-mapping,deepTools_qc,alignment-free -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --VCFfile allelic_input/file.vcf.gz --strains strain1 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 2304 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 3294 ]; then exit 1 ; fi WC=`noncoding-RNA-seq -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 968 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1370 ]; then exit 1 ; fi WC=`noncoding-RNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 988 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1390 ]; then exit 1 ; fi WC=`noncoding-RNA-seq -i SE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 877 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1231 ]; then exit 1 ; fi WC=`noncoding-RNA-seq -i BAM_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 714 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 984 ]; then exit 1 ; fi #multiple comparison groups WC=`noncoding-RNA-seq -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1016 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1418 ]; then exit 1 ; fi # scRNA-seq #WC=`scRNAseq -i PE_input -o output --mode Gruen --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` @@ -255,58 +320,70 @@ if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1016 ]; then exit 1 ; fi #WC=`scRNAseq -i PE_input -o output --mode Gruen --snakemakeOptions " --dryrun --conda-prefix /tmp" --skipRaceID --splitLib .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` #if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1015 ]; then exit 1 ; fi WC=`scRNAseq -i PE_input -o output --mode STARsolo --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1277 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1808 ]; then exit 1 ; fi WC=`scRNAseq -i PE_input -o output --mode STARsolo --skipVelocyto --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1143 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1614 ]; then exit 1 ; fi WC=`scRNAseq -i PE_input -o output --mode Alevin --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 536 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 761 ]; then exit 1 ; fi WC=`scRNAseq -i PE_input -o output --mode Alevin --skipVelocyto --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 446 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 641 ]; then exit 1 ; fi # WGBS WC=`WGBS -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1034 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1475 ]; then exit 1 ; fi WC=`WGBS -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --aligner bwameth2 --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1034 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1475 ]; then exit 1 ; fi WC=`WGBS -i PE_input -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim --GCbias .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1045 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1486 ]; then exit 1 ; fi WC=`WGBS -i BAM_input/filtered_bam -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --fromBAM --snakemakeOptions " --dryrun --conda-prefix /tmp" --GCbias .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 759 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1062 ]; then exit 1 ; fi WC=`WGBS -i BAM_input/filtered_bam -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --fromBAM --fastqc --snakemakeOptions " --dryrun --conda-prefix /tmp" --GCbias .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 759 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1062 ]; then exit 1 ; fi WC=`WGBS -i BAM_input/filtered_bam -o output --sampleSheet .ci_stuff/test_sampleSheet.tsv --fromBAM --skipBamQC --snakemakeOptions " --dryrun --conda-prefix /tmp" --GCbias .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 400 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 559 ]; then exit 1 ; fi # ATAC-seq WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 527 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 686 ]; then exit 1 ; fi WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 615 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 807 ]; then exit 1 ; fi WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller HMMRATAC .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 600 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 789 ]; then exit 1 ; fi WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --maxFragmentSize 120 --qval 0.1 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 527 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 686 ]; then exit 1 ; fi WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 869 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1160 ]; then exit 1 ; fi +#multicomp +WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 841 ]; then exit 1 ; fi +WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller Genrich .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 980 ]; then exit 1 ; fi +WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --peakCaller HMMRATAC .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 944 ]; then exit 1 ; fi +WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --maxFragmentSize 120 --qval 0.1 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 841 ]; then exit 1 ; fi +WC=`ATAC-seq -d BAM_input --sampleSheet .ci_stuff/test_sampleSheet_multiComp.tsv --snakemakeOptions " --dryrun --conda-prefix /tmp" --fromBAM BAM_input/filtered_bam/ .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1315 ]; then exit 1 ; fi + # HiC WC=`HiC -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --correctionMethod ICE .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 697 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1012 ]; then exit 1 ; fi WC=`HiC -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 653 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 947 ]; then exit 1 ; fi WC=`HiC -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --trim .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 721 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 1048 ]; then exit 1 ; fi WC=`HiC -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --enzyme DpnII .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 653 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 947 ]; then exit 1 ; fi WC=`HiC -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --noTAD .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 591 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 855 ]; then exit 1 ; fi WC=`HiC -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --aligner bwa-mem2 .ci_stuff/organism.yaml | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 653 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 947 ]; then exit 1 ; fi # preprocessing WC=`preprocessing -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --fastqc --optDedupDist 2500 | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 558 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 807 ]; then exit 1 ; fi WC=`preprocessing -i PE_input -o output --snakemakeOptions " --dryrun --conda-prefix /tmp" --DAG --fastqc --optDedupDist 2500 | tee >(cat 1>&2) | grep -v "conda installation\|Conda environment" | sed '/^\s*$/d' | wc -l` -if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 558 ]; then exit 1 ; fi +if [ ${PIPESTATUS[0]} -ne 0 ] || [ $WC -ne 807 ]; then exit 1 ; fi rm -rf SE_input PE_input BAM_input output allelic_input allelic_BAM_input /tmp/genes.gtf /tmp/genome.fa /tmp/genome.fa.fai /tmp/rmsk.txt /tmp/genes.bed /tmp/spikein_genes.gtf diff --git a/.gitignore b/.gitignore index 885fecaa6..6f7383ced 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ runRNAseq.sh *.pyc dist build +*.swp # sphinx build folder _build @@ -28,4 +29,4 @@ output snakePipes.egg-info # misc -.vscode/ \ No newline at end of file +.vscode/ diff --git a/docs/content/News.rst b/docs/content/News.rst index 8900f8f0f..6ba7a3ec6 100644 --- a/docs/content/News.rst +++ b/docs/content/News.rst @@ -8,7 +8,11 @@ snakePipes x.x.x * Changed the behaviour of snakePipes createEnvs - it is no longer possible to set condaEnvDir with this function. It is required to set it with snakePipes config beforhand, instead. To ingore what's in the defaults.yaml and overwrite the condaEnvDir value with default system conda prefix, use '--autodetectCondaEnvDir'. * Snakemake options in the defaults.yaml are now an empty string. The required arguments '--use-conda --conda-prefix' have been directly added to the command string. condaEnvDir is parsed from defaults.yaml, requiring running snakePipes config first. * Added a 'three-prime-seq' mode to mRNAseq (David Koppstein and Katarzyna Sikora). +* Added support for multiple comparison groups to ChIPseq and ATAC-seq. * Fixes #819 +* Fixes #947 +* Fixes #945 +* Fixes #941 * fastq files are checked for validity * an 'on success' file is touched in the output directory when a workflow is finished successfully * fuzzywuzzy deprecated in favor for thefuzz diff --git a/snakePipes/common_functions.py b/snakePipes/common_functions.py index b5944f624..068664d9c 100644 --- a/snakePipes/common_functions.py +++ b/snakePipes/common_functions.py @@ -354,13 +354,14 @@ def returnComparisonGroups(sampleSheet): return d.keys() -def sampleSheetGroups(sampleSheet): +def sampleSheetGroups(sampleSheet, multipleComp): """ Parse a sampleSheet and return a dictionary with keys the group and values the sample names """ f = open(sampleSheet) conditionCol = None nameCol = None + groupCol = None nCols = None d = dict() for idx, line in enumerate(f): @@ -370,6 +371,8 @@ def sampleSheetGroups(sampleSheet): sys.exit("ERROR: Please use 'name' and 'condition' as column headers in the sample info file ({})!\n".format(sampleSheet)) conditionCol = cols.index("condition") nameCol = cols.index("name") + if multipleComp: + groupCol = cols.index("group") nCols = len(cols) continue elif idx == 1: @@ -379,10 +382,27 @@ def sampleSheetGroups(sampleSheet): if len(cols) - 1 == nCols: conditionCol += 1 nameCol += 1 + if multipleComp: + groupCol += 1 if not len(line.strip()) == 0: - if cols[conditionCol] not in d: - d[cols[conditionCol]] = [] - d[cols[conditionCol]].append(cols[nameCol]) + if not multipleComp: + if cols[conditionCol] not in d: + d[cols[conditionCol]] = [] + d[cols[conditionCol]].append(cols[nameCol]) + else: + if cols[groupCol] not in d: + d[cols[groupCol]] = {} + if cols[conditionCol] not in d[cols[groupCol]]: + d[cols[groupCol]][cols[conditionCol]] = [] + d[cols[groupCol]][cols[conditionCol]].append(cols[nameCol]) + if "All" in d.keys(): + for k in d.keys(): + if k not in "All": + d[k][list(d["All"].keys())[0]] = [] + for x in d["All"].values(): + # don't use append as this results in a list of lists and causes issues downstream + d[k][list(d["All"].keys())[0]] += x + del d['All'] f.close() return d diff --git a/snakePipes/shared/rules/ATAC.snakefile b/snakePipes/shared/rules/ATAC.snakefile index 7d79f9a7f..e72d2f714 100755 --- a/snakePipes/shared/rules/ATAC.snakefile +++ b/snakePipes/shared/rules/ATAC.snakefile @@ -159,16 +159,32 @@ rule namesort_bams: # Requires PE data # Should be run once per-group! -rule Genrich_peaks: - input: - bams=lambda wildcards: expand(short_bams + "{sample}.short.namesorted.bam", sample=genrichDict[wildcards.group]) - output: - "Genrich/{group}.narrowPeak" - log: "Genrich/logs/{group}.Genrich_peaks.log" - params: - bams = lambda wildcards: ",".join(expand(short_bams + "{sample}.short.namesorted.bam", sample=genrichDict[wildcards.group])), - blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "" - conda: CONDA_ATAC_ENV - shell: """ - Genrich -t {params.bams} -o {output} -r {params.blacklist} -j -y 2> {log} - """ +if not isMultipleComparison: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(short_bams + "{sample}.short.namesorted.bam", sample=genrichDict[wildcards.group]) + output: + "Genrich/{group}.narrowPeak" + log: "Genrich/logs/{group}.Genrich_peaks.log" + params: + bams = lambda wildcards: ",".join(expand(short_bams + "{sample}.short.namesorted.bam", sample=genrichDict[wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "" + conda: CONDA_ATAC_ENV + shell: """ + Genrich -t {params.bams} -o {output} -r {params.blacklist} -j -y 2> {log} + """ + +else: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(short_bams + "{sample}.short.namesorted.bam", sample=genrichDict[wildcards.compGroup][wildcards.group]), + output: + "Genrich/{group}.{compGroup}.narrowPeak" + log: "Genrich/logs/{group}.{compGroup}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join(short_bams, "{sample}.short.namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + conda: CONDA_ATAC_ENV + shell: """ + Genrich -t {params.bams} -o {output} -r {params.blacklist} -j -y 2> {log} + """ diff --git a/snakePipes/shared/rules/CSAW.multiComp.snakefile b/snakePipes/shared/rules/CSAW.multiComp.snakefile new file mode 100644 index 000000000..d3f8f2585 --- /dev/null +++ b/snakePipes/shared/rules/CSAW.multiComp.snakefile @@ -0,0 +1,224 @@ +#sample_name = os.path.splitext(os.path.basename(sampleSheet))[0] +change_direction = ["UP", "DOWN", "MIXED"] +#compGroup = cf.returnComparisonGroups(sampleSheet) + +def get_outdir(peak_caller,sampleSheet): + sample_name = os.path.splitext(os.path.basename(str(sampleSheet)))[0] + + return("CSAW_{}_{}".format(peak_caller, sample_name)) + +def getInputPeaks(peakCaller, chip_samples, genrichDict,comp_group): + if peakCaller == "MACS2": + if pipeline in 'ATAC-seq': + return expand("MACS2/{chip_sample}.filtered.short.BAM_peaks.xls", chip_sample = chip_samples) + elif pipeline == "chip-seq" and useSpikeInForNorm: + return expand("MACS2/{chip_sample}_host.BAM_peaks.xls", chip_sample = chip_samples) + else: + return expand("MACS2/{chip_sample}.filtered.BAM_peaks.xls", chip_sample = chip_samples) + elif peakCaller == "HMMRATAC": + return expand("HMMRATAC/{chip_sample}_peaks.gappedPeak", chip_sample = chip_samples) + else: + return expand("Genrich/{genrichGroup}.{{compGroup}}.narrowPeak", genrichGroup = genrichDict[comp_group].keys()) + + +def getSizeMetrics(): + if pairedEnd: + if not useSpikeInForNorm: + return "deepTools_qc/bamPEFragmentSize/fragmentSize.metric.tsv" + else: + return "split_deepTools_qc/bamPEFragmentSize/host.fragmentSize.metric.tsv" + else: + return [] + +def getScaleFactors(): + if getSizeFactorsFrom=="genome": + return "split_deepTools_qc/multiBamSummary/spikein.ChIP.scaling_factors.txt" + elif getSizeFactorsFrom=="TSS": + return "split_deepTools_qc/multiBamSummary_BED/spikein.ChIP.scaling_factors.txt" + elif getSizeFactorsFrom=="input": + return "split_deepTools_qc/multiBamSummary/spikein.input.scaling_factors.txt" + else: + return [] + +def getBamCoverage(comp_group): + if getSizeFactorsFrom=="genome": + return expand("bamCoverage/{chip_sample}.host_scaled.BYspikein.bw", chip_sample=reordered_dict[comp_group].keys()) + elif getSizeFactorsFrom=="TSS": + return expand("bamCoverage_TSS/{chip_sample}.host_scaled.BYspikein.bw", chip_sample=reordered_dict[comp_group].keys()) + elif getSizeFactorsFrom=="input": + return expand("bamCoverage_input/{chip_sample}.host_scaled.BYspikein.bw", chip_sample=reordered_dict[comp_group].keys()) + else: + return [] + +def getHeatmapInput(): + if pipeline in 'ATAC-seq': + return(expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{{compGroup}}") + "/CSAW.{change_dir}.cov.heatmap.png", change_dir=['UP','DOWN'])) + elif pipeline in 'chip-seq': + if not useSpikeInForNorm: + return(expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{{compGroup}}") + "/CSAW.{change_dir}.cov.heatmap.png", change_dir=['UP','DOWN']) + expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{{compGroup}}") + "/CSAW.{change_dir}.log2r.heatmap.png", change_dir=['UP', 'DOWN'])) + else: + return(expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{{compGroup}}") + "/CSAW.{change_dir}.cov.heatmap.png", change_dir=['UP','DOWN'])) + +checkpoint split_sampleSheet: + input: + sampleSheet = sampleSheet + output: + splitSheets = os.path.join("splitSampleSheets",os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv") + params: + splitSheetPfx = os.path.join("splitSampleSheets",os.path.splitext(os.path.basename(str(sampleSheet)))[0]) + run: + if isMultipleComparison: + cf.splitSampleSheet(input.sampleSheet,params.splitSheetPfx) + +## CSAW for differential binding / allele-specific binding analysis +rule CSAW: + input: + peaks = lambda wildcards: getInputPeaks(peakCaller, chip_samples, genrichDict, comp_group=wildcards.compGroup), + sampleSheet = lambda wildcards: checkpoints.split_sampleSheet.get(compGroup=wildcards.compGroup).output, + insert_size_metrics = getSizeMetrics(), + scale_factors = getScaleFactors() if useSpikeInForNorm else [] + output: + "{}/CSAW.session_info.txt".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")), + "{}/DiffBinding_analysis.Rdata".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")), + expand("{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{{compGroup}}.tsv")) + "/Filtered.results.{change_dir}.bed", change_dir=change_direction) + benchmark: + "{}/.benchmark/CSAW.benchmark".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + params: + outdir=lambda wildcards,input: get_outdir(peakCaller,input.sampleSheet), + peakCaller=peakCaller, + fdr = fdr, + absBestLFC=absBestLFC, + pairedEnd = pairedEnd, + fragmentLength = fragmentLength, + windowSize = windowSize, + importfunc = os.path.join("shared", "rscripts", "DB_functions.R"), + allele_info = allele_info, + yaml_path=lambda wildcards: samples_config if pipeline in 'chip-seq' else "", + insert_size_metrics = lambda wildcards,input: os.path.join(outdir, input.insert_size_metrics) if pairedEnd else [], + pipeline = pipeline, + useSpikeInForNorm = useSpikeInForNorm, + scale_factors = lambda wildcards, input: os.path.join(outdir, input.scale_factors) if input.scale_factors else "" + log: + out = os.path.join(outdir, "{}/logs/CSAW.out".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv"))), + err = os.path.join(outdir, "{}/logs/CSAW.err".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv"))) + conda: CONDA_ATAC_ENV + script: "../rscripts/CSAW.R" + + +rule calc_matrix_log2r_CSAW: + input: + csaw_in = "{}/CSAW.session_info.txt".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")), + bigwigs = lambda wildcards: expand("split_deepTools_ChIP/bamCompare/{chip_sample}.log2ratio.over_{control_name}.scaledBYspikein.bw", zip, chip_sample=reordered_dict[wildcards.compGroup].keys(), control_name=reordered_dict[wildcards.compGroup].values()) if useSpikeInForNorm else expand("deepTools_ChIP/bamCompare/{chip_sample}.filtered.log2ratio.over_{control_name}.bw", zip, chip_sample=reordered_dict[wildcards.compGroup].keys(), control_name=reordered_dict[wildcards.compGroup].values()), + sampleSheet = sampleSheet + output: + matrix = touch("{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv"))+"/CSAW.{change_dir}.log2r.matrix") + params: + bed_in = "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv"))+"/Filtered.results.{change_dir}.bed" + log: + out = os.path.join(outdir, "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_matrix.log2r.{change_dir}.out"), + err = os.path.join(outdir, "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_matrix.log2r.{change_dir}.err") + threads: 8 + conda: CONDA_SHARED_ENV + shell: """ + touch {log.out} + touch {log.err} + if [[ -s {params.bed_in} ]]; then + computeMatrix scale-regions -S {input.bigwigs} -R {params.bed_in} -m 1000 -b 200 -a 200 -o {output.matrix} -p {threads} > {log.out} 2> {log.err} + fi + """ + + +rule plot_heatmap_log2r_CSAW: + input: + matrix = "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/CSAW.{change_dir}.log2r.matrix" + output: + image = touch("{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/CSAW.{change_dir}.log2r.heatmap.png"), + sorted_regions = touch("{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/CSAW.{change_dir}.log2r.sortedRegions.bed") + params: + smpl_label = lambda wildcards: ' '.join(reordered_dict[wildcards.compGroup].keys()) + log: + out = os.path.join(outdir, "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_heatmap.log2r.{change_dir}.out"), + err = os.path.join(outdir, "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_heatmap.log2r.{change_dir}.err") + conda: CONDA_SHARED_ENV + shell: """ + touch {log.out} + touch {log.err} + if [[ -s {input.matrix} ]]; then + plotHeatmap --matrixFile {input.matrix} \ + --outFileSortedRegions {output.sorted_regions} \ + --outFileName {output.image} \ + --startLabel Start --endLabel End \ + --legendLocation lower-center \ + -x 'Scaled peak length' --labelRotation 90 \ + --samplesLabel {params.smpl_label} --colorMap "coolwarm" > {log.out} 2> {log.err} + fi + """ + + +rule calc_matrix_cov_CSAW: + input: + csaw_in = "{}/CSAW.session_info.txt".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")), + bigwigs = lambda wildcards: getBamCoverage(wildcards.compGroup) if useSpikeInForNorm else expand("bamCoverage/{chip_sample}.filtered.seq_depth_norm.bw", chip_sample=reordered_dict[wildcards.compGroup].keys()), + sampleSheet = sampleSheet + output: + matrix = touch("{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/CSAW.{change_dir}.cov.matrix") + params: + bed_in = "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/Filtered.results.{change_dir}.bed" + log: + out = os.path.join(outdir, "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_matrix.cov.{change_dir}.out"), + err = os.path.join(outdir, "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_matrix.cov.{change_dir}.err") + threads: 8 + conda: CONDA_SHARED_ENV + shell: """ + touch {log.out} + touch {log.err} + if [[ -s {params.bed_in} ]]; then + computeMatrix scale-regions -S {input.bigwigs} -R {params.bed_in} \ + -m 1000 -b 200 -a 200 -o {output.matrix} -p {threads} > {log.out} 2> {log.err} + fi + """ + + +rule plot_heatmap_cov_CSAW: + input: + matrix = "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/CSAW.{change_dir}.cov.matrix" + output: + image = touch("{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/CSAW.{change_dir}.cov.heatmap.png"), + sorted_regions = touch("{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/CSAW.{change_dir}.cov.sortedRegions.bed") + params: + smpl_label = lambda wildcards: ' '.join(reordered_dict[wildcards.compGroup].keys()) + log: + out = os.path.join(outdir,"{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_heatmap.cov.{change_dir}.out"), + err = os.path.join(outdir,"{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + "/logs/deeptools_heatmap.cov.{change_dir}.err") + conda: CONDA_SHARED_ENV + shell: """ + touch {log.out} + touch {log.err} + if [[ -s {input.matrix} ]]; then + plotHeatmap --matrixFile {input.matrix} \ + --outFileSortedRegions {output.sorted_regions} \ + --outFileName {output.image} --startLabel Start \ + --endLabel End --legendLocation lower-center \ + -x 'Scaled peak length' --labelRotation 90 \ + --samplesLabel {params.smpl_label} --colorMap "coolwarm" >{log.out} 2>{log.err} + fi + """ + +rule CSAW_report: + input: + csaw_in = "{}/CSAW.session_info.txt".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")), + heatmap_in = lambda wildcards: getHeatmapInput() + output: + outfile="{}/CSAW.Stats_report.html".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv")) + params: + pipeline=pipeline, + fdr=fdr, + lfc=absBestLFC, + outdir=os.path.join(outdir, "{}".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv"))), + sampleSheet=sampleSheet, + useSpikeInForNorm = useSpikeInForNorm + log: + out = os.path.join(outdir, "{}/logs/report.out".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv"))), + err = os.path.join(outdir, "{}/logs/report.err".format(get_outdir(peakCaller,os.path.splitext(os.path.basename(str(sampleSheet)))[0]+".{compGroup}.tsv"))) + conda: CONDA_ATAC_ENV + script: "../rscripts/CSAW_report.Rmd" diff --git a/snakePipes/shared/rules/CSAW.snakefile b/snakePipes/shared/rules/CSAW.singleComp.snakefile similarity index 76% rename from snakePipes/shared/rules/CSAW.snakefile rename to snakePipes/shared/rules/CSAW.singleComp.snakefile index c316f6f8a..963a62272 100644 --- a/snakePipes/shared/rules/CSAW.snakefile +++ b/snakePipes/shared/rules/CSAW.singleComp.snakefile @@ -48,7 +48,7 @@ def getHeatmapInput(): if pipeline in 'ATAC-seq': return(expand("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.cov.heatmap.png", change_dir=['UP','DOWN'])) elif pipeline in 'chip-seq': - if not useSpikeInForNorm: + if chip_samples_w_ctrl: return(expand("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.cov.heatmap.png", change_dir=['UP','DOWN']) + expand("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.log2r.heatmap.png", change_dir=['UP', 'DOWN'])) else: return(expand("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.cov.heatmap.png", change_dir=['UP','DOWN'])) @@ -89,54 +89,55 @@ rule CSAW: script: "../rscripts/CSAW.R" -rule calc_matrix_log2r_CSAW: - input: - csaw_in = "CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name), - bigwigs = expand("split_deepTools_ChIP/bamCompare/{chip_sample}.log2ratio.over_{control_name}.scaledBYspikein.bw", zip, chip_sample=reordered_dict.keys(), control_name=reordered_dict.values()) if useSpikeInForNorm else expand("deepTools_ChIP/bamCompare/{chip_sample}.filtered.log2ratio.over_{control_name}.bw", zip, chip_sample=reordered_dict.keys(), control_name=reordered_dict.values()), - sampleSheet = sampleSheet - output: - matrix = touch("CSAW_{}_{}".format(peakCaller, sample_name)+"/CSAW.{change_dir}.log2r.matrix") - params: - bed_in = "CSAW_{}_{}".format(peakCaller, sample_name)+"/Filtered.results.{change_dir}.bed" - log: - out = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_matrix.log2r.{change_dir}.out"), - err = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_matrix.log2r.{change_dir}.err") - threads: 8 - conda: CONDA_SHARED_ENV - shell: """ - touch {log.out} - touch {log.err} - if [[ -s {params.bed_in} ]]; then - computeMatrix scale-regions -S {input.bigwigs} -R {params.bed_in} -m 1000 -b 200 -a 200 -o {output.matrix} -p {threads} > {log.out} 2> {log.err} - fi - """ - - -rule plot_heatmap_log2r_CSAW: - input: - matrix = "CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.log2r.matrix" - output: - image = touch("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.log2r.heatmap.png"), - sorted_regions = touch("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.log2r.sortedRegions.bed") - params: - smpl_label=' '.join(reordered_dict.keys()) - log: - out = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_heatmap.log2r.{change_dir}.out"), - err = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_heatmap.log2r.{change_dir}.err") - conda: CONDA_SHARED_ENV - shell: """ - touch {log.out} - touch {log.err} - if [[ -s {input.matrix} ]]; then - plotHeatmap --matrixFile {input.matrix} \ +if chip_samples_w_ctrl: + rule calc_matrix_log2r_CSAW: + input: + csaw_in = "CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name), + bigwigs = expand("split_deepTools_ChIP/bamCompare/{chip_sample}.log2ratio.over_{control_name}.scaledBYspikein.bw", zip, chip_sample=reordered_dict.keys(), control_name=reordered_dict.values()) if useSpikeInForNorm else expand("deepTools_ChIP/bamCompare/{chip_sample}.filtered.log2ratio.over_{control_name}.bw", zip, chip_sample=reordered_dict.keys(), control_name=reordered_dict.values()), + sampleSheet = sampleSheet + output: + matrix = touch("CSAW_{}_{}".format(peakCaller, sample_name)+"/CSAW.{change_dir}.log2r.matrix") + params: + bed_in = "CSAW_{}_{}".format(peakCaller, sample_name)+"/Filtered.results.{change_dir}.bed" + log: + out = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_matrix.log2r.{change_dir}.out"), + err = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_matrix.log2r.{change_dir}.err") + threads: 8 + conda: CONDA_SHARED_ENV + shell: """ + touch {log.out} + touch {log.err} + if [[ -s {params.bed_in} ]]; then + computeMatrix scale-regions -S {input.bigwigs} -R {params.bed_in} -m 1000 -b 200 -a 200 -o {output.matrix} -p {threads} > {log.out} 2> {log.err} + fi + """ + + + rule plot_heatmap_log2r_CSAW: + input: + matrix = "CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.log2r.matrix" + output: + image = touch("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.log2r.heatmap.png"), + sorted_regions = touch("CSAW_{}_{}".format(peakCaller, sample_name) + "/CSAW.{change_dir}.log2r.sortedRegions.bed") + params: + smpl_label=' '.join(reordered_dict.keys()) + log: + out = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_heatmap.log2r.{change_dir}.out"), + err = os.path.join(outdir, "CSAW_{}_{}".format(peakCaller, sample_name) + "/logs/deeptools_heatmap.log2r.{change_dir}.err") + conda: CONDA_SHARED_ENV + shell: """ + touch {log.out} + touch {log.err} + if [[ -s {input.matrix} ]]; then + plotHeatmap --matrixFile {input.matrix} \ --outFileSortedRegions {output.sorted_regions} \ --outFileName {output.image} \ --startLabel Start --endLabel End \ --legendLocation lower-center \ -x 'Scaled peak length' --labelRotation 90 \ --samplesLabel {params.smpl_label} --colorMap "coolwarm" > {log.out} 2> {log.err} - fi - """ + fi + """ rule calc_matrix_cov_CSAW: diff --git a/snakePipes/shared/rules/ChIP_peak_calling.snakefile b/snakePipes/shared/rules/ChIP_peak_calling.snakefile index 5c32ad1b8..ef644c06f 100755 --- a/snakePipes/shared/rules/ChIP_peak_calling.snakefile +++ b/snakePipes/shared/rules/ChIP_peak_calling.snakefile @@ -158,38 +158,75 @@ rule namesort_bams: # Requires PE data # Should be run once per-group! -if pairedEnd: - rule Genrich_peaks: - input: - bams=lambda wildcards: expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group]), - control = lambda wildcards: ["filtered_bam/"+get_control(x)+".namesorted.bam" for x in genrichDict[wildcards.group]] if chip_samples_w_ctrl else [] - output: - "Genrich/{group}.narrowPeak" - log: "Genrich/logs/{group}.log" - params: - bams = lambda wildcards: ",".join(expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group])), - blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", - control_pfx=lambda wildcards,input: "-c" if input.control else "", - control=lambda wildcards,input: ",".join(input.control) if input.control else "" - conda: CONDA_CHIPSEQ_ENV - shell: """ - Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -y 2> {log} - """ +if not isMultipleComparison: + if pairedEnd: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group]), + control = lambda wildcards: ["filtered_bam/"+get_control(x)+".namesorted.bam" for x in genrichDict[wildcards.group]] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.narrowPeak" + log: "Genrich/logs/{group}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "" + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -y 2> {log} + """ + else: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group]), + control = lambda wildcards: ["filtered_bam/"+get_control(x)+".namesorted.bam" for x in genrichDict[wildcards.group] ] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.narrowPeak" + log: "Genrich/logs/{group}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "", + frag_size=fragmentLength + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -w {params.frag_size} 2> {log} + """ else: - rule Genrich_peaks: - input: - bams=lambda wildcards: expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group]), - control = lambda wildcards: ["filtered_bam/"+get_control(x)+".namesorted.bam" for x in genrichDict[wildcards.group] ] if chip_samples_w_ctrl else [] - output: - "Genrich/{group}.narrowPeak" - log: "Genrich/logs/{group}.log" - params: - bams = lambda wildcards: ",".join(expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.group])), - blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", - control_pfx=lambda wildcards,input: "-c" if input.control else "", - control=lambda wildcards,input: ",".join(input.control) if input.control else "", - frag_size=fragmentLength - conda: CONDA_CHIPSEQ_ENV - shell: """ - Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -w {params.frag_size} 2> {log} - """ + if pairedEnd: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group]), + control = lambda wildcards: ["filtered_bam/"+get_control(x)+".namesorted.bam" for x in genrichDict[wildcards.compGroup][wildcards.group]] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.{compGroup}.narrowPeak" + log: "Genrich/logs/{group}.{compGroup}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "" + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -y 2> {log} + """ + else: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group]), + control = lambda wildcards: ["filtered_bam/"+get_control(x)+".namesorted.bam" for x in genrichDict[wildcards.compGroup][wildcards.group] ] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.{compGroup}.narrowPeak" + log: "Genrich/logs/{group}.{compGroup}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("filtered_bam", "{sample}.namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "", + frag_size=fragmentLength + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -w {params.frag_size} 2> {log} + """ diff --git a/snakePipes/shared/rules/ChIP_peak_calling_spikein.snakefile b/snakePipes/shared/rules/ChIP_peak_calling_spikein.snakefile index 146a833fe..1283a9460 100755 --- a/snakePipes/shared/rules/ChIP_peak_calling_spikein.snakefile +++ b/snakePipes/shared/rules/ChIP_peak_calling_spikein.snakefile @@ -160,40 +160,80 @@ rule namesort_bams: # Requires PE data # Should be run once per-group! -if pairedEnd: - rule Genrich_peaks: - input: - bams=lambda wildcards: expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group]), - control = lambda wildcards: ["namesorted_bam/"+get_control(x)+"_host_namesorted.bam" for x in genrichDict[wildcards.group]] if chip_samples_w_ctrl else [] - output: - "Genrich/{group}.narrowPeak" - log: "Genrich/logs/{group}.log" - params: - bams = lambda wildcards: ",".join(expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group])), - blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", - control_pfx=lambda wildcards,input: "-c" if input.control else "", - control=lambda wildcards,input: ",".join(input.control) if input.control else "", - spikein_chroms=",".join(spikein_chr) - conda: CONDA_CHIPSEQ_ENV - shell: """ - Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -e {params.spikein_chroms} -y 2> {log} - """ + +if not isMultipleComparison: + if pairedEnd: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group]), + control = lambda wildcards: ["namesorted_bam/"+get_control(x)+"_host_namesorted.bam" for x in genrichDict[wildcards.group]] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.narrowPeak" + log: "Genrich/logs/{group}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "", + spikein_chroms=",".join(spikein_chr) + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -e {params.spikein_chroms} -y 2> {log} + """ + else: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group]), + control = lambda wildcards: ["namesorted_bam/"+get_control(x)+"_host_namesorted.bam" for x in genrichDict[wildcards.group]] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.narrowPeak" + log: "Genrich/logs/{group}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "", + frag_size=fragmentLength, + spikein_chroms=",".join(spikein_chr) + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -e {params.spikein_chroms} -w {params.frag_size} 2> {log} + """ else: - rule Genrich_peaks: - input: - bams=lambda wildcards: expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group]), - control = lambda wildcards: ["namesorted_bam/"+get_control(x)+"_host_namesorted.bam" for x in genrichDict[wildcards.group]] if chip_samples_w_ctrl else [] - output: - "Genrich/{group}.narrowPeak" - log: "Genrich/logs/{group}.log" - params: - bams = lambda wildcards: ",".join(expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.group])), - blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", - control_pfx=lambda wildcards,input: "-c" if input.control else "", - control=lambda wildcards,input: ",".join(input.control) if input.control else "", - frag_size=fragmentLength, - spikein_chroms=",".join(spikein_chr) - conda: CONDA_CHIPSEQ_ENV - shell: """ - Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -e {params.spikein_chroms} -w {params.frag_size} 2> {log} - """ + if pairedEnd: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group]), + control = lambda wildcards: ["namesorted_bam/"+get_control(x)+"_host_namesorted.bam" for x in genrichDict[wildcards.compGroup][wildcards.group]] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.{compGroup}.narrowPeak" + log: "Genrich/logs/{group}.{compGroup}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "", + spikein_chroms=",".join(spikein_chr) + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -e {params.spikein_chroms} -y 2> {log} + """ + else: + rule Genrich_peaks: + input: + bams=lambda wildcards: expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group]), + control = lambda wildcards: ["namesorted_bam/"+get_control(x)+"_host_namesorted.bam" for x in genrichDict[wildcards.compGroup][wildcards.group] ] if chip_samples_w_ctrl else [] + output: + "Genrich/{group}.{compGroup}.narrowPeak" + log: "Genrich/logs/{group}.{compGroup}.log" + params: + bams = lambda wildcards: ",".join(expand(os.path.join("namesorted_bam", "{sample}_host_namesorted.bam"), sample=genrichDict[wildcards.compGroup][wildcards.group])), + blacklist = "-E {}".format(blacklist_bed) if blacklist_bed else "", + control_pfx=lambda wildcards,input: "-c" if input.control else "", + control=lambda wildcards,input: ",".join(input.control) if input.control else "", + frag_size=fragmentLength, + spikein_chroms=",".join(spikein_chr) + conda: CONDA_CHIPSEQ_ENV + shell: """ + Genrich -t {params.bams} {params.control_pfx} {params.control} -o {output} -r {params.blacklist} -e {params.spikein_chroms} -w {params.frag_size} 2> {log} + """ diff --git a/snakePipes/shared/rules/deepTools_ChIP.snakefile b/snakePipes/shared/rules/deepTools_ChIP.snakefile index 1426fa5d2..d26787caf 100755 --- a/snakePipes/shared/rules/deepTools_ChIP.snakefile +++ b/snakePipes/shared/rules/deepTools_ChIP.snakefile @@ -1,6 +1,6 @@ ### deepTools bamCompare subtract ####################################################### -if bigWigType == "subtract" or bigWigType == "both": +if bigWigType == "subtract" or bigWigType == "both" and chip_samples_w_ctrl: rule bamCompare_subtract: input: chip_bam = "filtered_bam/{chip_sample}.filtered.bam", @@ -26,7 +26,7 @@ if bigWigType == "subtract" or bigWigType == "both": shell: bamcompare_subtract_cmd ### deepTools bamCompare log2ratio ####################################################### -if bigWigType == "log2ratio" or bigWigType == "both": +if bigWigType == "log2ratio" or bigWigType == "both" and chip_samples_w_ctrl: rule bamCompare_log2: input: chip_bam = "filtered_bam/{chip_sample}.filtered.bam", diff --git a/snakePipes/shared/rules/nearestGene.multiComp.snakefile b/snakePipes/shared/rules/nearestGene.multiComp.snakefile new file mode 100644 index 000000000..d925180ae --- /dev/null +++ b/snakePipes/shared/rules/nearestGene.multiComp.snakefile @@ -0,0 +1,34 @@ +sample_name = os.path.splitext(os.path.basename(sampleSheet))[0] +if pipeline in ['chip-seq','ATAC-seq']: + change_direction = ["UP","DOWN","MIXED"] + +rule get_nearest_transcript: + input: + bed="CSAW_{}_{}".format(peakCaller, sample_name + ".{compGroup}")+"/Filtered.results.{change_dir}.bed" if pipeline in ['chip-seq','ATAC-seq'] else "" + output: + annotated_bed=temp("AnnotatedResults_{}_{}".format(peakCaller, sample_name + ".{compGroup}")+"/Filtered.results.{change_dir}_withNearestTranscript.bed") + params: + genes_bed=genes_bed, + field_offset=lambda wildcards: "18" if pipeline in ['chip-seq','ATAC-seq'] else "" + log: + err= "AnnotatedResults_{}_{}".format(peakCaller, sample_name + ".{compGroup}")+"/logs/bedtools_closest.{change_dir}.err", + conda: CONDA_RNASEQ_ENV + shell: """ + if [ -r {input.bed} ]; then bedtools closest -D b -a <( bedtools sort -i {input.bed} ) -b <( bedtools sort -i {params.genes_bed} ) | cut -f1-{params.field_offset},$(( {params.field_offset} + 1 ))-$(( {params.field_offset} + 4 )),$(( {params.field_offset} + 6 )),$(( {params.field_offset} + 13 )) > {output.annotated_bed};fi 2> {log.err} + """ + +rule get_nearest_gene: + input: + bed="AnnotatedResults_{}_{}".format(peakCaller, sample_name + ".{compGroup}")+"/Filtered.results.{change_dir}_withNearestTranscript.bed", + t2g="Annotation/genes.filtered.t2g", + gene_symbol="Annotation/genes.filtered.symbol" + output: + annotated_bed="AnnotatedResults_{}_{}".format(peakCaller, sample_name + ".{compGroup}")+"/Filtered.results.{change_dir}_withNearestGene.txt" + params: + pipeline=pipeline, + wdir="AnnotatedResults_{}_{}".format(peakCaller, sample_name + ".{compGroup}") + log: + err="AnnotatedResults_{}_{}".format(peakCaller, sample_name + ".{compGroup}")+"/logs/nearestGene.{change_dir}.err", + out="AnnotatedResults_{}_{}".format(peakCaller, sample_name + ".{compGroup}")+"/logs/nearestGene.{change_dir}.out" + conda: CONDA_RNASEQ_ENV + script: "../rscripts/nearestGene.R" diff --git a/snakePipes/shared/rules/nearestGene.snakefile b/snakePipes/shared/rules/nearestGene.singleComp.snakefile similarity index 100% rename from snakePipes/shared/rules/nearestGene.snakefile rename to snakePipes/shared/rules/nearestGene.singleComp.snakefile diff --git a/snakePipes/shared/rules/rMats.multipleComp.snakefile b/snakePipes/shared/rules/rMats.multipleComp.snakefile index b8eb86e4c..f83d27066 100644 --- a/snakePipes/shared/rules/rMats.multipleComp.snakefile +++ b/snakePipes/shared/rules/rMats.multipleComp.snakefile @@ -22,7 +22,7 @@ def generate_b1_b2(sampleSheet,which_b): def get_s1(sampleSheet): if os.path.isfile(sampleSheet): - rMatsConds = cf.sampleSheetGroups(sampleSheet) + rMatsConds = cf.sampleSheetGroups(sampleSheet,isMultipleComparison) return ["filtered_bam/" + s for s in [s + ".filtered.bam" for s in rMatsConds[list(rMatsConds)[0]]]][0] else: return "" diff --git a/snakePipes/shared/rules/rMats.singleComp.snakefile b/snakePipes/shared/rules/rMats.singleComp.snakefile index d940ca0b0..07334192d 100644 --- a/snakePipes/shared/rules/rMats.singleComp.snakefile +++ b/snakePipes/shared/rules/rMats.singleComp.snakefile @@ -7,7 +7,7 @@ def wrap_libType(libType): dic_libType = {0:"fr-unstranded",1:"fr-firststrand",2:"fr-secondstrand"} return dic_libType[libType] -rMatsConds = cf.sampleSheetGroups(sampleSheet) +rMatsConds = cf.sampleSheetGroups(sampleSheet,isMultipleComparison) rule createInputcsv: input: diff --git a/snakePipes/workflows/ATAC-seq/Snakefile b/snakePipes/workflows/ATAC-seq/Snakefile index 635b2e40e..eda4bf494 100755 --- a/snakePipes/workflows/ATAC-seq/Snakefile +++ b/snakePipes/workflows/ATAC-seq/Snakefile @@ -57,8 +57,12 @@ else: chip_samples = samples pairedEnd = True if sampleSheet: - include: os.path.join(maindir, "shared", "rules", "CSAW.snakefile") - include: os.path.join(maindir, "shared", "rules", "nearestGene.snakefile") + if not isMultipleComparison: + include: os.path.join(maindir, "shared", "rules", "CSAW.singleComp.snakefile") + include: os.path.join(maindir, "shared", "rules", "nearestGene.singleComp.snakefile") + else: + include: os.path.join(maindir, "shared", "rules", "CSAW.multiComp.snakefile") + include: os.path.join(maindir, "shared", "rules", "nearestGene.multiComp.snakefile") include: os.path.join(maindir, "shared", "rules", "filterGTF.snakefile") # if not fromBAM: # These are needed for the snakefile to be imported @@ -77,15 +81,23 @@ def run_deepTools_allelic(): def run_CSAW(): if sampleSheet: - file_list=["CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name), + if not isMultipleComparison: + file_list=["CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name), "Annotation/genes.filtered.symbol","Annotation/genes.filtered.t2g", "CSAW_{}_{}/CSAW.Stats_report.html".format(peakCaller, sample_name)] - file_list.append([os.path.join("CSAW_{}_{}".format(peakCaller, sample_name), x) \ + file_list.append([os.path.join("CSAW_{}_{}".format(peakCaller, sample_name), x) \ for x in list(itertools.chain.from_iterable([expand("CSAW.{change_dir}.cov.matrix",\ change_dir=change_direction),expand("CSAW.{change_dir}.cov.heatmap.png",change_dir=change_direction)]))]) - file_list.append([os.path.join("AnnotatedResults_{}_{}".format(peakCaller, sample_name), x) \ + file_list.append([os.path.join("AnnotatedResults_{}_{}".format(peakCaller, sample_name), x) \ for x in list(itertools.chain.from_iterable([expand("Filtered.results.{change_dir}_withNearestGene.txt",\ change_dir=change_direction)]))]) + else: + file_list=expand("CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name + ".{compGroup}"),compGroup=cf.returnComparisonGroups(sampleSheet)) + file_list.append(["Annotation/genes.filtered.symbol","Annotation/genes.filtered.t2g",expand("CSAW_{}_{}/CSAW.Stats_report.html".format(peakCaller, sample_name + ".{compGroup}"),compGroup=cf.returnComparisonGroups(sampleSheet))]) + file_list.append([expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{compGroup}") + "/CSAW.{change_dir}.cov.matrix",change_dir=change_direction,compGroup=cf.returnComparisonGroups(sampleSheet)), + expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{compGroup}") +"/CSAW.{change_dir}.cov.heatmap.png",change_dir=change_direction,compGroup=cf.returnComparisonGroups(sampleSheet) + )]) + file_list.append(expand("AnnotatedResults_{}_{}".format(peakCaller,sample_name + ".{compGroup}") + "/Filtered.results.{change_dir}_withNearestGene.txt",change_dir=change_direction, compGroup=cf.returnComparisonGroups(sampleSheet))) return( file_list ) else: return([]) @@ -118,7 +130,17 @@ def run_genrich(): if peakCaller == "Genrich": file_list = ["Genrich/all_samples.narrowPeak"] if sampleSheet: - file_list = ["Genrich/{}.narrowPeak".format(x) for x in genrichDict.keys()] + if not isMultipleComparison: + file_list = ["Genrich/{}.narrowPeak".format(x) for x in genrichDict.keys()] + else: + #print(genrichDict) + unique_group=[] + file_list=[] + for key,value in genrichDict.items(): + for x in value.keys(): + if zip(key,x) not in unique_group: + unique_group.append(zip(key,x)) + file_list.append("Genrich/{}.{}.narrowPeak".format(x,key)) file_list.append(expand(short_bams + "{sample}.short.namesorted.bam",sample=samples)) return (file_list) return ([]) diff --git a/snakePipes/workflows/ATAC-seq/internals.snakefile b/snakePipes/workflows/ATAC-seq/internals.snakefile index f425e5827..0910e8bf6 100644 --- a/snakePipes/workflows/ATAC-seq/internals.snakefile +++ b/snakePipes/workflows/ATAC-seq/internals.snakefile @@ -11,6 +11,7 @@ if sampleSheet: if not cf.check_replicates(sampleSheet): print("\nWarning! CSAW cannot be invoked without replicates!\n") sys.exit() + isMultipleComparison = cf.isMultipleComparison(sampleSheet) if not fromBAM: if pairedEnd: @@ -66,9 +67,18 @@ def filter_dict(sampleSheet): output_dict = dict(zip(names_sub, [""]*len(names_sub))) return(output_dict) +chip_samples_w_ctrl = [] + if sampleSheet: filtered_dict = filter_dict(sampleSheet) - genrichDict = cf.sampleSheetGroups(sampleSheet) - reordered_dict = {k: filtered_dict[k] for k in [item for sublist in genrichDict.values() for item in sublist]} + genrichDict = cf.sampleSheetGroups(sampleSheet,isMultipleComparison) + if not isMultipleComparison: + reordered_dict = {k: filtered_dict[k] for k in [item for sublist in genrichDict.values() for item in sublist]} + else: + reordered_dict = {} + for g in genrichDict.keys(): + for k in genrichDict[g].keys(): + genrichDict[g][k]=[item for item in genrichDict[g][k] if item in samples] + reordered_dict[g] = {k: filtered_dict[k] for k in [item for sublist in genrichDict[g].values() for item in sublist]} else: genrichDict = {"all_samples": samples} diff --git a/snakePipes/workflows/ChIP-seq/Snakefile b/snakePipes/workflows/ChIP-seq/Snakefile index 00a2604e4..6066a4cb9 100755 --- a/snakePipes/workflows/ChIP-seq/Snakefile +++ b/snakePipes/workflows/ChIP-seq/Snakefile @@ -59,8 +59,12 @@ else: # CSAW for differential binding (if sampleinfo specified) if sampleSheet and cf.check_replicates(sampleSheet): - include: os.path.join(maindir, "shared", "rules", "CSAW.snakefile") - include: os.path.join(maindir, "shared", "rules", "nearestGene.snakefile") + if not isMultipleComparison: + include: os.path.join(maindir, "shared", "rules", "CSAW.singleComp.snakefile") + include: os.path.join(maindir, "shared", "rules", "nearestGene.singleComp.snakefile") + else: + include: os.path.join(maindir, "shared", "rules", "CSAW.multiComp.snakefile") + include: os.path.join(maindir, "shared", "rules", "nearestGene.multiComp.snakefile") include: os.path.join(maindir, "shared", "rules", "filterGTF.snakefile") #if not fromBAM and not useSpikeInForNorm: # These are needed for the snakefile to be imported @@ -106,20 +110,21 @@ def run_deepTools_ChIP(): file_list = [] file_list.append(["deepTools_ChIP/plotFingerprint/plotFingerprint.metrics.txt"]) if not useSpikeInForNorm \ else file_list.append(["split_deepTools_ChIP/plotFingerprint/plotFingerprint.metrics.txt"]) - for chip_sample in chip_samples_w_ctrl: - control_name = get_control_name(chip_sample) - if not useSpikeInForNorm: - # get bigwigtype - if bigWigType == "subtract" or bigWigType == "both": - file_list.append(["deepTools_ChIP/bamCompare/"+chip_sample+".filtered.subtract."+control_name+".bw"]) - if bigWigType == "log2ratio" or bigWigType == "both": - file_list.append(["deepTools_ChIP/bamCompare/"+chip_sample+".filtered.log2ratio.over_"+control_name+".bw"]) - elif useSpikeInForNorm and getSizeFactorsFrom == "genome": - # get bigwigtype - if bigWigType == "subtract" or bigWigType == "both": - file_list.append(expand("split_deepTools_ChIP/bamCompare/"+chip_sample+".subtract."+control_name+".scaledBY{part}.bw",part=part)) - if bigWigType == "log2ratio" or bigWigType == "both": - file_list.append(expand("split_deepTools_ChIP/bamCompare/"+chip_sample+".log2ratio.over_"+control_name+".scaledBY{part}.bw",part=part)) + if chip_samples_w_ctrl: + for chip_sample in chip_samples_w_ctrl: + control_name = get_control_name(chip_sample) + if not useSpikeInForNorm: + # get bigwigtype + if bigWigType == "subtract" or bigWigType == "both": + file_list.append(["deepTools_ChIP/bamCompare/"+chip_sample+".filtered.subtract."+control_name+".bw"]) + if bigWigType == "log2ratio" or bigWigType == "both": + file_list.append(["deepTools_ChIP/bamCompare/"+chip_sample+".filtered.log2ratio.over_"+control_name+".bw"]) + elif useSpikeInForNorm and getSizeFactorsFrom == "genome": + # get bigwigtype + if bigWigType == "subtract" or bigWigType == "both": + file_list.append(expand("split_deepTools_ChIP/bamCompare/"+chip_sample+".subtract."+control_name+".scaledBY{part}.bw",part=part)) + if bigWigType == "log2ratio" or bigWigType == "both": + file_list.append(expand("split_deepTools_ChIP/bamCompare/"+chip_sample+".log2ratio.over_"+control_name+".scaledBY{part}.bw",part=part)) return(file_list) def run_deepTools_allelic(): @@ -140,13 +145,26 @@ def run_deepTools_allelic(): def run_CSAW(): if sampleSheet and cf.check_replicates(sampleSheet): - file_list=["CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name)] - if not allele_info : - file_list.append(["Annotation/genes.filtered.symbol","Annotation/genes.filtered.t2g","CSAW_{}_{}/CSAW.Stats_report.html".format(peakCaller, sample_name)]) - file_list.append([os.path.join("CSAW_{}_{}".format(peakCaller, sample_name), x) for x in list(itertools.chain.from_iterable([expand("CSAW.{change_dir}.cov.matrix",change_dir=change_direction),expand("CSAW.{change_dir}.cov.heatmap.png",change_dir=change_direction)]))]) - file_list.append([os.path.join("AnnotatedResults_{}_{}".format(peakCaller,sample_name), x) for x in list(itertools.chain.from_iterable([expand("Filtered.results.{change_dir}_withNearestGene.txt",change_dir=change_direction)]))]) - if not useSpikeInForNorm and chip_samples_w_ctrl: - file_list.append([os.path.join("CSAW_{}_{}".format(peakCaller, sample_name), x) for x in list(itertools.chain.from_iterable([expand("CSAW.{change_dir}.log2r.matrix",change_dir=change_direction),expand("CSAW.{change_dir}.log2r.heatmap.png",change_dir=change_direction)]))]) + if not isMultipleComparison: + file_list=["CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name)] + if not allele_info : + file_list.append(["Annotation/genes.filtered.symbol","Annotation/genes.filtered.t2g","CSAW_{}_{}/CSAW.Stats_report.html".format(peakCaller, sample_name)]) + file_list.append([os.path.join("CSAW_{}_{}".format(peakCaller, sample_name), x) for x in list(itertools.chain.from_iterable([expand("CSAW.{change_dir}.cov.matrix",change_dir=change_direction),expand("CSAW.{change_dir}.cov.heatmap.png",change_dir=change_direction)]))]) + file_list.append([os.path.join("AnnotatedResults_{}_{}".format(peakCaller,sample_name), x) for x in list(itertools.chain.from_iterable([expand("Filtered.results.{change_dir}_withNearestGene.txt",change_dir=change_direction)]))]) + if chip_samples_w_ctrl and not useSpikeInForNorm: + file_list.append([os.path.join("CSAW_{}_{}".format(peakCaller, sample_name), x) for x in list(itertools.chain.from_iterable([expand("CSAW.{change_dir}.log2r.matrix",change_dir=change_direction),expand("CSAW.{change_dir}.log2r.heatmap.png",change_dir=change_direction)]))]) + else: + file_list=expand("CSAW_{}_{}/CSAW.session_info.txt".format(peakCaller, sample_name + ".{compGroup}"),compGroup=cf.returnComparisonGroups(sampleSheet)) + if not allele_info : + file_list.append(["Annotation/genes.filtered.symbol","Annotation/genes.filtered.t2g",expand("CSAW_{}_{}/CSAW.Stats_report.html".format(peakCaller, sample_name + ".{compGroup}"),compGroup=cf.returnComparisonGroups(sampleSheet))]) + file_list.append([expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{compGroup}") + "/CSAW.{change_dir}.cov.matrix",change_dir=change_direction,compGroup=cf.returnComparisonGroups(sampleSheet)), + expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{compGroup}") +"/CSAW.{change_dir}.cov.heatmap.png",change_dir=change_direction,compGroup=cf.returnComparisonGroups(sampleSheet) + )]) + file_list.append(expand("AnnotatedResults_{}_{}".format(peakCaller,sample_name + ".{compGroup}") + "/Filtered.results.{change_dir}_withNearestGene.txt",change_dir=change_direction, compGroup=cf.returnComparisonGroups(sampleSheet))) + if chip_samples_w_ctrl and not useSpikeInForNorm: + file_list.append([expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{compGroup}") + "/CSAW.{change_dir}.log2r.matrix",change_dir=change_direction,compGroup=cf.returnComparisonGroups(sampleSheet)), + expand("CSAW_{}_{}".format(peakCaller, sample_name + ".{compGroup}") + "/CSAW.{change_dir}.log2r.heatmap.png",change_dir=change_direction,compGroup=cf.returnComparisonGroups(sampleSheet)) + ]) return( file_list ) else: return([]) @@ -160,7 +178,17 @@ def run_genrich(): return ([]) file_list = ["Genrich/all_samples.narrowPeak"] if sampleSheet: - file_list = ["Genrich/{}.narrowPeak".format(x) for x in genrichDict.keys()] + if not isMultipleComparison: + file_list = ["Genrich/{}.narrowPeak".format(x) for x in genrichDict.keys()] + else: + #print(genrichDict) + unique_group=[] + file_list=[] + for key,value in genrichDict.items(): + for x in value.keys(): + if zip(key,x) not in unique_group: + unique_group.append(zip(key,x)) + file_list.append("Genrich/{}.{}.narrowPeak".format(x,key)) return (file_list) return ([]) diff --git a/snakePipes/workflows/ChIP-seq/internals.snakefile b/snakePipes/workflows/ChIP-seq/internals.snakefile index c09602550..b656d11d9 100755 --- a/snakePipes/workflows/ChIP-seq/internals.snakefile +++ b/snakePipes/workflows/ChIP-seq/internals.snakefile @@ -90,6 +90,7 @@ if sampleSheet: print("\nWarning! CSAW cannot be invoked without replicates and will not be run!\n") if not peakCaller=="Genrich": sys.exit() + isMultipleComparison = cf.isMultipleComparison(sampleSheet) chip_dict = {} with open(samples_config, "r") as f: @@ -109,7 +110,7 @@ chip_samples_w_ctrl = set() chip_samples_wo_ctrl = set() for chip_sample, value in chip_dict.items(): # set control to False if not specified or set to False - if 'control' not in chip_dict[chip_sample] or not value['control']: + if 'control' not in chip_dict[chip_sample] or value['control'] is None: chip_dict[chip_sample]['control'] = False chip_samples_wo_ctrl.add(chip_sample) else: @@ -119,6 +120,7 @@ for chip_sample, value in chip_dict.items(): if 'broad' not in chip_dict[chip_sample] or not value['broad']: chip_dict[chip_sample]['broad'] = False + control_samples = list(sorted(control_samples)) # get a list of corresp control_names for chip samples control_names = [] @@ -126,9 +128,19 @@ for chip_sample in chip_samples_w_ctrl: control_names.append(get_control_name(chip_sample)) chip_samples_w_ctrl = list(sorted(chip_samples_w_ctrl)) +chip_samples_w_ctrl = list(filter(None, chip_samples_w_ctrl)) chip_samples_wo_ctrl = list(sorted(chip_samples_wo_ctrl)) +chip_samples_wo_ctrl = list(filter(None, chip_samples_wo_ctrl)) chip_samples = sorted(chip_samples_w_ctrl + chip_samples_wo_ctrl) -all_samples = sorted(control_samples + chip_samples) +chip_samples = list(filter(None, chip_samples)) +all_samples = sorted(control_samples + chip_samples) if control_samples else chip_samples +all_samples = list(filter(None, all_samples)) + +#useful for debugging purposes; change the mode to info or debug +if chip_samples_wo_ctrl: + warnings.warn( str(len(chip_samples_wo_ctrl)) + " out of " + str(len(chip_samples)) + " have no matching control ") +if chip_samples_w_ctrl: + warnings.warn( str(len(chip_samples_w_ctrl)) + " out of " + str(len(chip_samples)) + " have a matching control ") if not fromBAM: if pairedEnd and not useSpikeInForNorm: @@ -196,18 +208,27 @@ def filter_dict(sampleSheet,input_dict): return(output_dict) if sampleSheet: - genrichDict = cf.sampleSheetGroups(sampleSheet) - for k in genrichDict.keys(): - genrichDict[k]=[item for item in genrichDict[k] if item in chip_samples] if chip_samples_w_ctrl: filtered_dict = filter_dict(sampleSheet,dict(zip(chip_samples_w_ctrl, [ get_control_name(x) for x in chip_samples_w_ctrl ]))) else: filtered_dict = filter_dict(sampleSheet,dict(zip(chip_samples_wo_ctrl, [None]*len(chip_samples_wo_ctrl)))) - reordered_dict = {k: filtered_dict[k] for k in [item for sublist in genrichDict.values() for item in sublist]} + genrichDict = cf.sampleSheetGroups(sampleSheet,isMultipleComparison) + if not isMultipleComparison: + for k in genrichDict.keys(): + genrichDict[k]=[item for item in genrichDict[k] if item in chip_samples] + reordered_dict = {k: filtered_dict[k] for k in [item for sublist in genrichDict.values() for item in sublist]} + else: + #print(genrichDict) + reordered_dict = {} + for g in genrichDict.keys(): + for k in genrichDict[g].keys(): + genrichDict[g][k]=[item for item in genrichDict[g][k] if item in chip_samples] + reordered_dict[g] = {k: filtered_dict[k] for k in [item for sublist in genrichDict[g].values() for item in sublist]} else: genrichDict = {"all_samples": chip_samples} + #################### functions and checks for using a spiked-in genome for normalization ######################################## def check_if_spikein_genome(genome_index,spikeinExt): resl=[] diff --git a/tests/test_jobcounts.py b/tests/test_jobcounts.py index e234eb644..fdaee4fa9 100644 --- a/tests/test_jobcounts.py +++ b/tests/test_jobcounts.py @@ -25,7 +25,7 @@ def parseSpOut(_s) -> int: except IndexError: return (0) -def createTestData(fp, samples=6) -> None: +def createTestData(fp, samples=9) -> None: # single end folder (fp / 'SE').mkdir() # paired end folder @@ -151,6 +151,46 @@ def createTestData(fp, samples=6) -> None: columns = ['name', 'condition', 'group'] ).to_csv(fp / 'sampleSheet_mc.tsv', sep='\t', index=False) # ChIP sample_config + chip_dict ={ + 'chip_dict': { + 'sample1': {'control': 'sample7', 'broad': 'False'}, + 'sample2': {'control': 'sample7', 'broad': 'False'}, + 'sample3': {'control': 'sample8', 'broad': 'False'}, + 'sample4': {'control': 'sample8', 'broad': 'False'}, + 'sample5': {'control': 'sample9', 'broad': 'False'}, + 'sample6': {'control': 'sample9', 'broad': 'False'} + } + } + with open(fp / 'chipdict.yaml', 'w') as f: + yaml.dump(chip_dict, f, default_flow_style=False, default_style=None) + + chip_dict ={ + 'chip_dict': { + 'sample1': {'control': 'sample7', 'broad': 'True'}, + 'sample2': {'control': 'sample7', 'broad': 'True'}, + 'sample3': {'control': 'sample8', 'broad': 'True'}, + 'sample4': {'control': 'sample8', 'broad': 'True'}, + 'sample5': {'control': 'sample9', 'broad': 'True'}, + 'sample6': {'control': 'sample9', 'broad': 'True'} + } + } + with open(fp / 'chipdict_broad.yaml', 'w') as f: + yaml.dump(chip_dict, f, default_flow_style=False, default_style=None) + + chip_dict ={ + 'chip_dict': { + 'sample1': {'control': None, 'broad': 'False'}, + 'sample2': {'control': None, 'broad': 'False'}, + 'sample3': {'control': None, 'broad': 'False'}, + 'sample4': {'control': None, 'broad': 'False'}, + 'sample5': {'control': None, 'broad': 'False'}, + 'sample6': {'control': None, 'broad': 'False'} + } + } + with open(fp / 'chipdict_noControl.yaml', 'w') as f: + yaml.dump(chip_dict, f, default_flow_style=False, default_style=None) + + chip_dict ={ 'chip_dict': { 'sample1': {'control': 'sample3', 'broad': 'False'}, @@ -159,7 +199,7 @@ def createTestData(fp, samples=6) -> None: 'sample5': {'control': 'sample6', 'broad': 'False'} } } - with open(fp / 'chipdict.yaml', 'w') as f: + with open(fp / 'chipdict_simple.yaml', 'w') as f: yaml.dump(chip_dict, f, default_flow_style=False, default_style=None) @pytest.fixture(scope="session") @@ -266,7 +306,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 98 + assert parseSpOut(_p) == 143 def test_properPairs(self, ifs): ci = [ "DNA-mapping", @@ -286,7 +326,7 @@ def test_properPairs(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 104 + assert parseSpOut(_p) == 152 def test_bcExtract(self, ifs): ci = [ "DNA-mapping", @@ -307,7 +347,7 @@ def test_bcExtract(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 98 + assert parseSpOut(_p) == 143 def test_UMIDedup(self, ifs): ci = [ "DNA-mapping", @@ -327,7 +367,7 @@ def test_UMIDedup(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 110 + assert parseSpOut(_p) == 161 def test_UMIDedupbcExtract(self, ifs): ci = [ "DNA-mapping", @@ -348,7 +388,7 @@ def test_UMIDedupbcExtract(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 104 + assert parseSpOut(_p) == 152 def test_DAG(self, ifs): ci = [ "DNA-mapping", @@ -369,7 +409,7 @@ def test_DAG(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 110 + assert parseSpOut(_p) == 161 def test_bwa(self, ifs): ci = [ "DNA-mapping", @@ -388,7 +428,7 @@ def test_bwa(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 98 + assert parseSpOut(_p) == 143 def test_bwa2(self, ifs): ci = [ "DNA-mapping", @@ -407,7 +447,7 @@ def test_bwa2(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 98 + assert parseSpOut(_p) == 143 def test_se(self, ifs): ci = [ "DNA-mapping", @@ -422,7 +462,7 @@ def test_se(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 86 + assert parseSpOut(_p) == 125 def test_seproperPairs(self, ifs): ci = [ "DNA-mapping", @@ -442,7 +482,7 @@ def test_seproperPairs(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 92 + assert parseSpOut(_p) == 134 class TestChIPseq: def test_default(self, ifs): @@ -460,7 +500,23 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 60 + assert parseSpOut(_p) == 77 + def test_broad(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict_broad.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 77 def test_genrich(self, ifs): ci = [ "ChIP-seq", @@ -478,7 +534,7 @@ def test_genrich(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 60 + assert parseSpOut(_p) == 74 def test_SE(self, ifs): ci = [ "ChIP-seq", @@ -495,7 +551,7 @@ def test_SE(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 60 + assert parseSpOut(_p) == 77 def test_l2ratio(self, ifs): ci = [ "ChIP-seq", @@ -513,7 +569,41 @@ def test_l2ratio(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 + assert parseSpOut(_p) == 71 + def test_default_noInput(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 assert parseSpOut(_p) == 56 + def test_genrich_noInput(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet.tsv', + '--snakemakeOptions', + SMKOPTS, + '--peakCaller', + 'Genrich', + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 50 def test_frombam(self, ifs): ci = [ "ChIP-seq", @@ -531,7 +621,25 @@ def test_frombam(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 102 + assert parseSpOut(_p) == 137 + def test_frombam_noInput(self, ifs): + ci = [ + "ChIP-seq", + '-d', + 'outdir', + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + '--sampleSheet', + ifs / 'sampleSheet.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 98 def test_spikein(self, ifs): ci = [ "ChIP-seq", @@ -548,7 +656,24 @@ def test_spikein(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 89 + assert parseSpOut(_p) == 124 + def test_spikein_noInput(self, ifs): + ci = [ + "ChIP-seq", + '--useSpikeInForNorm', + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 83 def test_spikeinfrombam(self, ifs): ci = [ "ChIP-seq", @@ -567,7 +692,7 @@ def test_spikeinfrombam(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 113 + assert parseSpOut(_p) == 160 def test_spikeinfrombamTSSnorm(self, ifs): ci = [ "ChIP-seq", @@ -588,7 +713,7 @@ def test_spikeinfrombamTSSnorm(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 92 + assert parseSpOut(_p) == 136 def test_spikeinfrombaminputnorm(self, ifs): ci = [ "ChIP-seq", @@ -609,7 +734,7 @@ def test_spikeinfrombaminputnorm(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 90 + assert parseSpOut(_p) == 133 def test_allelic(self, ifs): ci = [ "ChIP-seq", @@ -620,12 +745,252 @@ def test_allelic(self, ifs): '--snakemakeOptions', SMKOPTS, ifs / 'org.yaml', - ifs / 'chipdict.yaml' + ifs / 'chipdict_simple.yaml' ] print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 assert parseSpOut(_p) == 37 + def test_multicomp(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 99 + def test_multicomp_genrich(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--snakemakeOptions', + SMKOPTS, + '--peakCaller', + 'Genrich', + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 100 + def test_multicomp_broad(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict_broad.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 99 + def test_multicomp_fromBam(self, ifs): + ci = [ + "ChIP-seq", + '-d', + 'outdir', + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 159 + def test_multicomp_fromBam_Genrich(self, ifs): + ci = [ + "ChIP-seq", + '-d', + 'outdir', + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--snakemakeOptions', + SMKOPTS, + '--peakCaller', + 'Genrich', + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 160 + def test_multicomp_spikein(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 136 + def test_multicomp_spikein_genrich(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + '--peakCaller', + 'Genrich', + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 137 + def test_multicomp_spikein_noInput(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 99 + def test_multicomp_spikein_noInput_Genrich(self, ifs): + ci = [ + "ChIP-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + '--peakCaller', + 'Genrich', + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 97 + def test_multicomp_spikein_fromBam(self, ifs): + ci = [ + "ChIP-seq", + '-d', + 'outdir', + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 172 + def test_multicomp_spikein_fromBam_genrich(self, ifs): + ci = [ + "ChIP-seq", + '-d', + 'outdir', + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + '--peakCaller', + 'Genrich', + ifs / 'org.yaml', + ifs / 'chipdict.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 173 + def test_multicomp_spikein_fromBam_noInput(self, ifs): + ci = [ + "ChIP-seq", + '-d', + 'outdir', + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 123 + def test_multicomp_spikein_fromBam_noInput_genrich(self, ifs): + ci = [ + "ChIP-seq", + '-d', + 'outdir', + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--useSpikeInForNorm', + '--snakemakeOptions', + SMKOPTS, + '--peakCaller', + 'Genrich', + ifs / 'org.yaml', + ifs / 'chipdict_noControl.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 121 class TestmRNAseq: def test_default(self, ifs): @@ -642,7 +1007,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 116 + assert parseSpOut(_p) == 167 def test_DE(self, ifs): ci = [ "mRNA-seq", @@ -659,7 +1024,7 @@ def test_DE(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 117 + assert parseSpOut(_p) == 168 def test_rMats(self, ifs): ci = [ "mRNA-seq", @@ -677,7 +1042,7 @@ def test_rMats(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 119 + assert parseSpOut(_p) == 170 def test_almode(self, ifs): ci = [ "mRNA-seq", @@ -696,7 +1061,7 @@ def test_almode(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 86 + assert parseSpOut(_p) == 125 def test_trim(self, ifs): ci = [ "mRNA-seq", @@ -714,7 +1079,7 @@ def test_trim(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 123 + assert parseSpOut(_p) == 177 def test_alfreemode(self, ifs): ci = [ "mRNA-seq", @@ -733,7 +1098,7 @@ def test_alfreemode(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 131 + assert parseSpOut(_p) == 188 def test_bcExtract(self, ifs): ci = [ "mRNA-seq", @@ -752,7 +1117,7 @@ def test_bcExtract(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 117 + assert parseSpOut(_p) == 168 def test_bcExtractUMIdedup(self, ifs): ci = [ "mRNA-seq", @@ -772,7 +1137,7 @@ def test_bcExtractUMIdedup(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 123 + assert parseSpOut(_p) == 177 def test_multicomp(self, ifs): ci = [ "mRNA-seq", @@ -792,7 +1157,7 @@ def test_multicomp(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 117 + assert parseSpOut(_p) == 165 def test_SE(self, ifs): ci = [ "mRNA-seq", @@ -809,7 +1174,7 @@ def test_SE(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 104 + assert parseSpOut(_p) == 149 def test_SEalmode(self, ifs): ci = [ "mRNA-seq", @@ -828,7 +1193,7 @@ def test_SEalmode(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 74 + assert parseSpOut(_p) == 107 def test_SEtrim(self, ifs): ci = [ "mRNA-seq", @@ -846,7 +1211,7 @@ def test_SEtrim(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 110 + assert parseSpOut(_p) == 158 def test_SEalfreemode(self, ifs): ci = [ "mRNA-seq", @@ -865,7 +1230,7 @@ def test_SEalfreemode(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 118 + assert parseSpOut(_p) == 169 def test_SEfastqc(self, ifs): ci = [ "mRNA-seq", @@ -884,7 +1249,7 @@ def test_SEfastqc(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 122 + assert parseSpOut(_p) == 176 def test_SEfrombam(self, ifs): ci = [ "mRNA-seq", @@ -902,7 +1267,7 @@ def test_SEfrombam(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 81 + assert parseSpOut(_p) == 114 def test_threeprime(self, ifs): ci = [ "mRNA-seq", @@ -921,7 +1286,7 @@ def test_threeprime(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 132 + assert parseSpOut(_p) == 189 def test_threeprimeqc(self, ifs): ci = [ "mRNA-seq", @@ -940,7 +1305,7 @@ def test_threeprimeqc(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 163 + assert parseSpOut(_p) == 232 def test_allelic(self, ifs): ci = [ "mRNA-seq", @@ -961,7 +1326,7 @@ def test_allelic(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 175 + assert parseSpOut(_p) == 253 def test_allelicfrombam(self, ifs): ci = [ "mRNA-seq", @@ -983,7 +1348,7 @@ def test_allelicfrombam(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 137 + assert parseSpOut(_p) == 197 def test_allelicDE(self, ifs): ci = [ "mRNA-seq", @@ -1006,7 +1371,7 @@ def test_allelicDE(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 176 + assert parseSpOut(_p) == 254 def test_allelicDE_SNPfile(self, ifs): ci = [ "mRNA-seq", @@ -1029,7 +1394,7 @@ def test_allelicDE_SNPfile(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 174 + assert parseSpOut(_p) == 252 def test_allelicDEsinglestrain(self, ifs): ci = [ "mRNA-seq", @@ -1052,7 +1417,7 @@ def test_allelicDEsinglestrain(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 176 + assert parseSpOut(_p) == 254 def test_allelicDEalfree(self, ifs): ci = [ "mRNA-seq", @@ -1075,7 +1440,7 @@ def test_allelicDEalfree(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 228 + assert parseSpOut(_p) == 330 class TestncRNAseq(): def test_default(self, ifs): @@ -1092,7 +1457,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 95 + assert parseSpOut(_p) == 137 def test_DE(self, ifs): ci = [ "noncoding-RNA-seq", @@ -1109,7 +1474,7 @@ def test_DE(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 97 + assert parseSpOut(_p) == 139 def test_SE(self, ifs): ci = [ "noncoding-RNA-seq", @@ -1126,7 +1491,7 @@ def test_SE(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 84 + assert parseSpOut(_p) == 120 def test_frombam(self, ifs): ci = [ "noncoding-RNA-seq", @@ -1144,7 +1509,7 @@ def test_frombam(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 67 + assert parseSpOut(_p) == 94 def test_multicomp(self, ifs): ci = [ "noncoding-RNA-seq", @@ -1161,7 +1526,7 @@ def test_multicomp(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 100 + assert parseSpOut(_p) == 142 class TestscRNAseq(): def test_default(self, ifs): @@ -1180,7 +1545,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 124 + assert parseSpOut(_p) == 178 def test_skipvelo(self, ifs): ci = [ "scRNAseq", @@ -1198,7 +1563,7 @@ def test_skipvelo(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 111 + assert parseSpOut(_p) == 159 def test_alevin(self, ifs): ci = [ "scRNAseq", @@ -1215,7 +1580,7 @@ def test_alevin(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 54 + assert parseSpOut(_p) == 78 def test_alevinskipvelo(self, ifs): ci = [ "scRNAseq", @@ -1233,7 +1598,7 @@ def test_alevinskipvelo(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 45 + assert parseSpOut(_p) == 66 class TestWGBS(): def test_default(self, ifs): @@ -1252,7 +1617,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 106 + assert parseSpOut(_p) == 154 def test_bwameth2(self, ifs): ci = [ "WGBS", @@ -1271,7 +1636,7 @@ def test_bwameth2(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 106 + assert parseSpOut(_p) == 154 def test_trimgcbias(self, ifs): ci = [ "WGBS", @@ -1290,7 +1655,7 @@ def test_trimgcbias(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 107 + assert parseSpOut(_p) == 155 def test_frombam(self, ifs): ci = [ "WGBS", @@ -1309,7 +1674,7 @@ def test_frombam(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 77 + assert parseSpOut(_p) == 110 def test_frombamfqc(self, ifs): ci = [ "WGBS", @@ -1329,7 +1694,7 @@ def test_frombamfqc(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 77 + assert parseSpOut(_p) == 110 def test_frombamskipqc(self, ifs): ci = [ "WGBS", @@ -1349,7 +1714,7 @@ def test_frombamskipqc(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 41 + assert parseSpOut(_p) == 59 class TestATAC(): def test_default(self, ifs): @@ -1366,7 +1731,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 48 + assert parseSpOut(_p) == 63 def test_genrich(self, ifs): ci = [ "ATAC-seq", @@ -1383,7 +1748,7 @@ def test_genrich(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 56 + assert parseSpOut(_p) == 74 def test_HMMRATAC(self, ifs): ci = [ "ATAC-seq", @@ -1400,7 +1765,7 @@ def test_HMMRATAC(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 55 + assert parseSpOut(_p) == 73 def test_sieve(self, ifs): ci = [ "ATAC-seq", @@ -1419,7 +1784,7 @@ def test_sieve(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 48 + assert parseSpOut(_p) == 63 def test_frombam(self, ifs): ci = [ "ATAC-seq", @@ -1436,7 +1801,92 @@ def test_frombam(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 84 + assert parseSpOut(_p) == 114 + def test_multicomp_default(self, ifs): + ci = [ + "ATAC-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 79 + def test_multicomp_genrich(self, ifs): + ci = [ + "ATAC-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--peakCaller', + 'Genrich', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 92 + def test_multicomp_HMMRATAC(self, ifs): + ci = [ + "ATAC-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--peakCaller', + 'HMMRATAC', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 89 + def test_multicomp_sieve(self, ifs): + ci = [ + "ATAC-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--maxFragmentSize', + '120', + '--qval', + '0.1', + '--snakemakeOptions', + SMKOPTS, + ifs / 'org.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 79 + def test_multicomp_frombam(self, ifs): + ci = [ + "ATAC-seq", + '-d', + ifs / 'bam_input', + '--sampleSheet', + ifs / 'sampleSheet_mc.tsv', + '--snakemakeOptions', + SMKOPTS, + '--fromBAM', + ifs / 'bam_input' / 'filtered_bam', + ifs / 'org.yaml' + ] + print(' '.join([str(i) for i in ci])) + _p = sp.run(ci, capture_output=True, text=True) + assert _p.returncode == 0 + assert parseSpOut(_p) == 130 class TestHIC(): def test_default(self, ifs): @@ -1453,7 +1903,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 69 + assert parseSpOut(_p) == 102 def test_ice(self, ifs): ci = [ "HiC", @@ -1470,7 +1920,7 @@ def test_ice(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 75 + assert parseSpOut(_p) == 111 def test_trim(self, ifs): ci = [ "HiC", @@ -1486,7 +1936,7 @@ def test_trim(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 75 + assert parseSpOut(_p) == 111 def test_dpnii(self, ifs): ci = [ "HiC", @@ -1503,7 +1953,7 @@ def test_dpnii(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 69 + assert parseSpOut(_p) == 102 def test_notad(self, ifs): ci = [ "HiC", @@ -1519,7 +1969,7 @@ def test_notad(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 63 + assert parseSpOut(_p) == 93 def test_bwamem2(self, ifs): ci = [ "HiC", @@ -1536,7 +1986,7 @@ def test_bwamem2(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 69 + assert parseSpOut(_p) == 102 class Testpreprocessing(): def test_default(self, ifs): @@ -1555,7 +2005,7 @@ def test_default(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 57 + assert parseSpOut(_p) == 84 def test_DAG(self, ifs): ci = [ "preprocessing", @@ -1573,4 +2023,4 @@ def test_DAG(self, ifs): print(' '.join([str(i) for i in ci])) _p = sp.run(ci, capture_output=True, text=True) assert _p.returncode == 0 - assert parseSpOut(_p) == 57 + assert parseSpOut(_p) == 84