Commit cd538cbf authored by Venkat Malladi's avatar Venkat Malladi

Merge branch '75-rename_plotprofile' into 'dev'

Resolve "Rename Plot profile to be consistent with naming"

Closes #75

See merge request !67
parents 4651d5e5 16c9a6f6
Pipeline #6611 canceled with stages
in 32 minutes and 58 seconds
......@@ -17,6 +17,13 @@ user_configuration:
script:
- pytest -m unit --cov=./workflow/scripts
bash_tests:
stage: unit
script:
- module load singularity/3.0.2
- module load deeptools/2.5.0.1
- singularity run docker://bats/bats:v1.1.0 --tap workflow/tests/plot_profile.bats
astrocyte:
stage: astrocyte
script:
......
......@@ -75,6 +75,7 @@ $ git clone git@git.biohpc.swmed.edu:BICF/Astrocyte/chipseq_analysis.git
9. Annotate all peaks using ChipSeeker
10. Calculate Differential Binding Activity with DiffBind (If more than 1 rep in more than 1 experiment)
11. Use MEME-ChIP to find motifs in original peaks
12. Plot enrichment of signal around TSS
See [FLOWCHART](docs/flowchart.pdf)
......
......@@ -20,6 +20,7 @@ Report issues to the Bioinformatic Core Facility [BICF](mailto:BICF@UTSouthweste
9. Annotate all peaks using ChipSeeker
10. Calculate Differential Binding Activity with DiffBind (If more than 1 rep in more than 1 experiment)
11. Use MEME-ChIP to find motifs in original peaks
12. Plot enrichment of signal around TSS
## Workflow Parameters
......
......@@ -98,9 +98,8 @@ skipMotif = params.skipMotif
skipPlotProfile = params.skipPlotProfile
references = params.references
multiqc = params.multiqc
gtfFile_plotProfile = Channel.fromPath(params.gtf)
gtfFile_annotPeaks = Channel.fromPath(params.gtf)
geneNames = Channel.fromPath(params.geneNames)
gtfFile = params.gtf
geneNames = params.geneNames
// Check design file for errors
process checkDesignFile {
......@@ -484,8 +483,7 @@ process plotProfile {
input:
file ("*.pooled.fc_signal.bw") from bigwigs.collect()
file gtf from gtfFile_plotProfile
file bigWigList from bigwigs.collect()
output:
......@@ -498,7 +496,7 @@ process plotProfile {
script:
"""
module load deeptools/2.5.0.1
bash $baseDir/scripts/plotProfile.sh
bash $baseDir/scripts/plot_profile.sh -g $gtfFile
"""
}
......@@ -540,8 +538,6 @@ process peakAnnotation {
input:
file designAnnotatePeaks
file gtf from gtfFile_annotPeaks
file geneNames
output:
......@@ -552,7 +548,7 @@ process peakAnnotation {
"""
module load R/3.3.2-gccmkl
Rscript $baseDir/scripts/annotate_peaks.R $designAnnotatePeaks $gtf $geneNames
Rscript $baseDir/scripts/annotate_peaks.R $designAnnotatePeaks $gtfFile $geneNames
"""
}
......
#!/bin/bash
#plotProfile.sh
bws=$(ls *.bw)
gtf=$(ls *.gtf *.bed)
computeMatrix reference-point \
--referencePoint TSS \
-S $bws \
-R $gtf \
--skipZeros \
-o computeMatrix.gz
-p max/2
plotProfile -m computeMatrix.gz \
-out plotProfile.png \
#!/bin/bash
#plot_profile.sh
script_name="plot_profile.sh"
#Help function
usage() {
echo "-h --Help documentation for $script_name"
echo "-g --File path to gtf/bed files"
echo "Example: $script_name -g 'genome.gtf'"
exit 1
}
raise()
{
echo "${1}" >&2
}
check_tools() {
raise "
Checking for required libraries and components on this system
"
deeptools --version &> version_deeptools.txt
if [ $? -gt 0 ]
then
raise "Missing deeptools"
return 1
fi
}
compute_matrix() {
raise "
Computing matrix on ${1} using ${2}
"
computeMatrix reference-point \
--referencePoint TSS \
-S ${1} \
-R ${2} \
--skipZeros \
-o computeMatrix.gz \
-p max/2
if [ $? -gt 0 ]
then
raise "Problem building matrix"
return 1
fi
}
plot_profile() {
raise "
Plotting profile
"
plotProfile -m computeMatrix.gz \
-out plotProfile.png
if [ $? -gt 0 ]
then
raise "Problem plotting"
return 1
fi
}
run_main() {
# Parsing options
OPTIND=1 # Reset OPTIND
while getopts :g:h opt
do
case $opt in
g) gtf=$OPTARG;;
h) usage;;
esac
done
shift $(($OPTIND -1))
# Check for mandatory options
if [[ -z $gtf ]]; then
usage
fi
bws=$(ls *pooled.fc_signal.bw)
check_tools || exit 1
compute_matrix "${bws}" "${gtf}" || return 1
plot_profile || return 1
raise "ALL COMPLETE"
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]
then
run_main "$@"
if [ $? -gt 0 ]
then
exit 1
fi
fi
#!/opt/bats/libexec/bats-core/ bats
profile_script="./workflow/scripts/plot_profile.sh"
@test "Test deeptools present" {
source ${profile_script}
run check_tools
}
@test "Test deeptools computeMatrix" {
source ${profile_script}
run compute_matrix test_data/ENCSR238SGC_pooled.fc_signal.bw /project/shared/bicf_workflow_ref/mouse/GRCm38/gencode.vM20.annotation.gtf
FILE=computeMatrix.gz
if [[ -s "$FILE" ]]; then
echo "$FILE exists and not empty"
fi
}
@test "Test deeptools plotProfile" {
source ${profile_script}
run plot_profile computeMatrix.gz
FILE=plotProfile.png
if [[ -s "$FILE" ]]; then
echo "$FILE exists and not empty"
fi
}
......@@ -11,8 +11,9 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
@pytest.mark.singleend
def test_plot_singleend():
assert os.path.exists(os.path.join(test_output_path, 'plotProfile.png'))
assert os.path.getsize(os.path.join(test_output_path, 'plotProfile.png')) > 0
@pytest.mark.pairedend
def test_plot_pairedend():
assert os.path.exists(os.path.join(test_output_path, 'computeMatrix.gz'))
assert os.path.exists(os.path.join(test_output_path, 'plotProfile.png'))
assert os.path.getsize(os.path.join(test_output_path, 'plotProfile.png')) > 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment