Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
BICF
Astrocyte
chipseq_analysis
Commits
bad714b4
Commit
bad714b4
authored
Feb 14, 2018
by
Venkat Malladi
Browse files
Update testing setup.
parent
f5b86f8f
Pipeline
#1558
canceled with stages
in 33 seconds
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
bad714b4
...
...
@@ -4,7 +4,22 @@ before_script:
-
module load nextflow/0.24.1-SNAPSHOT
-
ln -s /project/shared/bicf_workflow_ref/workflow_testdata/chipseq/*fastq.gz test_data/
test
:
stages
:
-
unit
-
integration
-
acceptance
user_configuration
:
stage
:
unit
script
:
-
pytest -m unit
single_end_mouse
:
stage
:
integration
script
:
-
nextflow run workflow/main.nf
single_end_acceptance
:
stage
:
unit
script
:
-
nextflow run workflow/main.nf
-
pytest
-
pytest -m acceptance
workflow/tests/test_call_peaks_macs.py
View file @
bad714b4
...
...
@@ -8,6 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/callPeaksMACS/'
@
pytest
.
mark
.
acceptance
def
test_call_peaks_macs_singleend
():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCLB144FDT.fc_signal.bw'
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCLB144FDT.pvalue_signal.bw'
))
...
...
@@ -15,6 +16,7 @@ def test_call_peaks_macs_singleend():
assert
utils
.
count_lines
(
peak_file
)
==
210349
@
pytest
.
mark
.
acceptance
def
test_call_peaks_macs_pairedend
():
# Do the same thing for paired end data
pass
workflow/tests/test_check_design.py
View file @
bad714b4
...
...
@@ -70,6 +70,7 @@ def fastq_files_1(fastq_files):
return
fastq_df
@
pytest
.
mark
.
unit
def
test_check_headers_singleend
(
design_1
):
paired
=
False
with
pytest
.
raises
(
Exception
)
as
excinfo
:
...
...
@@ -77,6 +78,7 @@ def test_check_headers_singleend(design_1):
assert
str
(
excinfo
.
value
)
==
"Missing column headers: ['fastq_read1']"
@
pytest
.
mark
.
unit
def
test_check_headers_pairedend
(
design
):
paired
=
True
with
pytest
.
raises
(
Exception
)
as
excinfo
:
...
...
@@ -84,12 +86,14 @@ def test_check_headers_pairedend(design):
assert
str
(
excinfo
.
value
)
==
"Missing column headers: ['fastq_read2']"
@
pytest
.
mark
.
unit
def
test_check_controls
(
design_2
):
with
pytest
.
raises
(
Exception
)
as
excinfo
:
check_design
.
check_controls
(
design_2
)
assert
str
(
excinfo
.
value
)
==
"Missing control experiments: ['B_1']"
@
pytest
.
mark
.
unit
def
test_check_files_missing_files
(
design
,
fastq_files_1
):
paired
=
False
with
pytest
.
raises
(
Exception
)
as
excinfo
:
...
...
@@ -97,18 +101,22 @@ def test_check_files_missing_files(design, fastq_files_1):
assert
str
(
excinfo
.
value
)
==
"Missing files from design file: ['B_2.fastq.gz']"
@
pytest
.
mark
.
unit
def
test_check_files_output_singleend
(
design
,
fastq_files
):
paired
=
False
new_design
=
check_design
.
check_files
(
design
,
fastq_files
,
paired
)
assert
new_design
.
loc
[
0
,
'fastq_read1'
]
==
"/path/to/file/A_1.fastq.gz"
@
pytest
.
mark
.
unit
def
test_check_files_output_pairedend
(
design_3
,
fastq_files
):
paired
=
True
new_design
=
check_design
.
check_files
(
design_3
,
fastq_files
,
paired
)
assert
new_design
.
loc
[
0
,
'fastq_read2'
]
==
"/path/to/file/A_2.fastq.gz"
@
pytest
.
mark
.
unit
def
test_check_replicates
(
design_4
):
paired
=
False
with
pytest
.
raises
(
Exception
)
as
excinfo
:
...
...
workflow/tests/test_convert_reads.py
View file @
bad714b4
...
...
@@ -7,11 +7,13 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/convertReads/'
@
pytest
.
mark
.
acceptance
def
test_convert_reads_singleend
():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCFF646LXU.filt.nodup.tagAlign.gz'
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCFF646LXU.filt.nodup.bedse.gz'
))
@
pytest
.
mark
.
integration
def
test_map_qc_pairedend
():
# Do the same thing for paired end data
# Also check that bedpe exists
...
...
workflow/tests/test_experiment_design.py
View file @
bad714b4
...
...
@@ -24,11 +24,13 @@ def design_tag():
return
design_df
@
pytest
.
mark
.
unit
def
test_check_update_controls_tag
(
design_tag
):
new_design
=
experiment_design
.
update_controls
(
design_tag
)
assert
new_design
.
loc
[
0
,
'control_tag_align'
]
==
"B_1.tagAlign.gz"
@
pytest
.
mark
.
acceptance
def
test_experiment_design_single_end
():
design_file
=
os
.
path
.
join
(
test_output_path
,
'ENCSR238SGC.tsv'
)
assert
os
.
path
.
exists
(
design_file
)
...
...
@@ -36,6 +38,7 @@ def test_experiment_design_single_end():
assert
design_df
.
shape
[
0
]
==
2
@
pytest
.
mark
.
acceptance
def
test_experiment_design_paired_end
():
# Do the same thing for paired end data
pass
workflow/tests/test_experiment_qc.py
View file @
bad714b4
...
...
@@ -24,11 +24,13 @@ def design_bam():
return
design_df
@
pytest
.
mark
.
unit
def
test_check_update_controls
(
design_bam
):
new_design
=
experiment_qc
.
update_controls
(
design_bam
)
assert
new_design
.
loc
[
0
,
'control_reads'
]
==
"B_1.bam"
@
pytest
.
mark
.
acceptance
def
test_experiment_qc_singleend
():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'sample_mbs.npz'
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'heatmap_SpearmanCorr.png'
))
...
...
@@ -36,7 +38,7 @@ def test_experiment_qc_singleend():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCLB144FDT_fingerprint.png'
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCLB831RUI_fingerprint.png'
))
@
pytest
.
mark
.
acceptance
def
test_experiment_qc_pairedend
():
# Do the same thing for paired end data
pass
workflow/tests/test_map_qc.py
View file @
bad714b4
...
...
@@ -8,6 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/filterReads/'
@
pytest
.
mark
.
acceptance
def
test_map_qc_singleend
():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCFF646LXU.filt.nodup.bam'
))
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCFF646LXU.filt.nodup.bam.bai'
))
...
...
workflow/tests/test_map_reads.py
View file @
bad714b4
...
...
@@ -7,6 +7,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/alignReads/'
@
pytest
.
mark
.
acceptance
def
test_map_reads_singleend
():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCFF646LXU.srt.bam'
))
aligned_reads_report
=
test_output_path
+
'ENCFF646LXU.srt.bam.flagstat.qc'
...
...
@@ -15,6 +16,7 @@ def test_map_reads_singleend():
assert
'80050072 + 0 mapped (99.08% : N/A)'
in
samtools_report
[
4
]
@
pytest
.
mark
.
acceptance
def
test_map_reads_pairedend
():
# Do the same thing for paired end data
pass
workflow/tests/test_overlap_peaks.py
View file @
bad714b4
...
...
@@ -25,6 +25,7 @@ def design_diff():
return
design_df
@
pytest
.
mark
.
unit
def
test_check_update_design
(
design_diff
):
new_design
=
overlap_peaks
.
update_design
(
design_diff
)
assert
new_design
.
shape
[
0
]
==
2
...
...
@@ -32,12 +33,14 @@ def test_check_update_design(design_diff):
assert
new_design
.
loc
[
0
,
'peak_caller'
]
==
"bed"
@
pytest
.
mark
.
acceptance
def
test_overlap_peaks_singleend
():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCSR238SGC.rejected.narrowPeak'
))
peak_file
=
test_output_path
+
'ENCSR238SGC.replicated.narrowPeak'
assert
utils
.
count_lines
(
peak_file
)
==
150
096
assert
utils
.
count_lines
(
peak_file
)
==
150
302
@
pytest
.
mark
.
acceptance
def
test_call_peaks_macs_pairedend
():
# Do the same thing for paired end data
pass
workflow/tests/test_pool_and_psuedoreplicate.py
View file @
bad714b4
...
...
@@ -36,26 +36,31 @@ def design_experiment_3(design_experiment):
return
design_experiment
@
pytest
.
mark
.
unit
def
test_check_replicates
(
design_experiment
):
no_reps
=
pool_and_psuedoreplicate
.
check_replicates
(
design_experiment
)
assert
no_reps
==
2
@
pytest
.
mark
.
unit
def
test_check_replicates_single
(
design_experiment_2
):
no_reps
=
pool_and_psuedoreplicate
.
check_replicates
(
design_experiment_2
)
assert
no_reps
==
1
@
pytest
.
mark
.
unit
def
test_check_controls
(
design_experiment
):
no_controls
=
pool_and_psuedoreplicate
.
check_controls
(
design_experiment
)
assert
no_controls
==
2
@
pytest
.
mark
.
unit
def
test_check_controls_single
(
design_experiment_3
):
no_controls
=
pool_and_psuedoreplicate
.
check_controls
(
design_experiment_3
)
assert
no_controls
==
1
@
pytest
.
mark
.
acceptance
def
test_pool_and_psuedoreplicate_single_end
():
design_file
=
os
.
path
.
join
(
test_output_path
,
'ENCSR238SGC_ppr.tsv'
)
assert
os
.
path
.
exists
(
design_file
)
...
...
@@ -63,6 +68,7 @@ def test_pool_and_psuedoreplicate_single_end():
assert
design_df
.
shape
[
0
]
==
5
@
pytest
.
mark
.
acceptance
def
test_experiment_design_paired_end
():
# Do the same thing for paired end data
pass
workflow/tests/test_trim_reads.py
View file @
bad714b4
...
...
@@ -9,6 +9,8 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/trimReads/'
@
pytest
.
mark
.
acceptance
def
test_trim_reads_singleend
():
raw_fastq
=
test_data_path
+
'ENCFF833BLU.fastq.gz'
trimmed_fastq
=
test_output_path
+
'ENCFF833BLU_trimmed.fq.gz'
...
...
@@ -19,6 +21,7 @@ def test_trim_reads_singleend():
assert
'Trimming mode: single-end'
in
open
(
trimmed_fastq_report
).
readlines
()[
4
]
@
pytest
.
mark
.
acceptance
def
test_trim_reads_pairedend
():
# Do the same thing for paired end data
pass
workflow/tests/test_utils.py
View file @
bad714b4
...
...
@@ -29,6 +29,7 @@ def steps_2(steps_1):
return
steps_1
@
pytest
.
mark
.
unit
def
test_run_one_step
(
steps_1
,
capsys
):
check_output
=
'ENCLB144FDT
\t
ENCSR238SGC
\t
limb
\t
H3K4me1
\t
None
\t
1
\t
ENCLB304SBJ
\t
ENCFF833BLU.fastq.gz'
.
encode
(
'UTF-8'
)
out
,
err
=
utils
.
run_pipe
(
steps_1
)
...
...
@@ -37,6 +38,7 @@ def test_run_one_step(steps_1, capsys):
assert
check_output
in
out
@
pytest
.
mark
.
unit
def
test_run_two_step
(
steps_2
,
capsys
):
check_output
=
'ENCFF833BLU.fastq.gz
\n
ENCFF646LXU.fastq.gz'
.
encode
(
'UTF-8'
)
out
,
err
=
utils
.
run_pipe
(
steps_2
)
...
...
@@ -45,6 +47,7 @@ def test_run_two_step(steps_2, capsys):
assert
check_output
in
out
@
pytest
.
mark
.
unit
def
test_run_last_step_file
(
steps_2
,
capsys
,
tmpdir
):
check_output
=
'ENCFF833BLU.fastq.gz
\n
ENCFF646LXU.fastq.gz'
tmp_outfile
=
tmpdir
.
join
(
'output.txt'
)
...
...
@@ -54,16 +57,19 @@ def test_run_last_step_file(steps_2, capsys, tmpdir):
assert
check_output
in
tmp_outfile
.
read
()
@
pytest
.
mark
.
unit
def
test_strip_extensions
():
filename
=
utils
.
strip_extensions
(
'ENCFF833BLU.fastq.gz'
,
STRIP_EXTENSIONS
)
assert
filename
==
'ENCFF833BLU'
@
pytest
.
mark
.
unit
def
test_strip_extensions_not_valid
():
filename
=
utils
.
strip_extensions
(
'ENCFF833BLU.not.valid'
,
STRIP_EXTENSIONS
)
assert
filename
==
'ENCFF833BLU.not.valid'
@
pytest
.
mark
.
unit
def
test_strip_extensions_missing_basename
():
filename
=
utils
.
strip_extensions
(
'.fastq.gz'
,
STRIP_EXTENSIONS
)
assert
filename
==
'.fastq'
workflow/tests/test_xcor.py
View file @
bad714b4
...
...
@@ -8,6 +8,7 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
'/../output/crossReads/'
@
pytest
.
mark
.
acceptance
def
test_convert_reads_singleend
():
assert
os
.
path
.
exists
(
os
.
path
.
join
(
test_output_path
,
'ENCFF833BLU.filt.nodup.tagAlign.15.tagAlign.gz.cc.plot.pdf'
))
qc_file
=
os
.
path
.
join
(
test_output_path
,
"ENCFF833BLU.filt.nodup.tagAlign.15.tagAlign.gz.cc.qc"
)
...
...
@@ -17,6 +18,7 @@ def test_convert_reads_singleend():
assert
df_xcor
[
9
].
iloc
[
0
]
==
1.266678
@
pytest
.
mark
.
acceptance
def
test_map_qc_pairedend
():
# Do the same thing for paired end data
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment