Commit cd538cbf authored by Venkat Malladi's avatar Venkat Malladi
Browse files

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: ...@@ -17,6 +17,13 @@ user_configuration:
script: script:
- pytest -m unit --cov=./workflow/scripts - 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: astrocyte:
stage: astrocyte stage: astrocyte
script: script:
......
...@@ -75,6 +75,7 @@ $ git clone git@git.biohpc.swmed.edu:BICF/Astrocyte/chipseq_analysis.git ...@@ -75,6 +75,7 @@ $ git clone git@git.biohpc.swmed.edu:BICF/Astrocyte/chipseq_analysis.git
9. Annotate all peaks using ChipSeeker 9. Annotate all peaks using ChipSeeker
10. Calculate Differential Binding Activity with DiffBind (If more than 1 rep in more than 1 experiment) 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 11. Use MEME-ChIP to find motifs in original peaks
12. Plot enrichment of signal around TSS
See [FLOWCHART](docs/flowchart.pdf) See [FLOWCHART](docs/flowchart.pdf)
......
...@@ -20,6 +20,7 @@ Report issues to the Bioinformatic Core Facility [BICF](mailto:BICF@UTSouthweste ...@@ -20,6 +20,7 @@ Report issues to the Bioinformatic Core Facility [BICF](mailto:BICF@UTSouthweste
9. Annotate all peaks using ChipSeeker 9. Annotate all peaks using ChipSeeker
10. Calculate Differential Binding Activity with DiffBind (If more than 1 rep in more than 1 experiment) 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 11. Use MEME-ChIP to find motifs in original peaks
12. Plot enrichment of signal around TSS
## Workflow Parameters ## Workflow Parameters
......
...@@ -98,9 +98,8 @@ skipMotif = params.skipMotif ...@@ -98,9 +98,8 @@ skipMotif = params.skipMotif
skipPlotProfile = params.skipPlotProfile skipPlotProfile = params.skipPlotProfile
references = params.references references = params.references
multiqc = params.multiqc multiqc = params.multiqc
gtfFile_plotProfile = Channel.fromPath(params.gtf) gtfFile = params.gtf
gtfFile_annotPeaks = Channel.fromPath(params.gtf) geneNames = params.geneNames
geneNames = Channel.fromPath(params.geneNames)
// Check design file for errors // Check design file for errors
process checkDesignFile { process checkDesignFile {
...@@ -484,8 +483,7 @@ process plotProfile { ...@@ -484,8 +483,7 @@ process plotProfile {
input: input:
file ("*.pooled.fc_signal.bw") from bigwigs.collect() file bigWigList from bigwigs.collect()
file gtf from gtfFile_plotProfile
output: output:
...@@ -498,7 +496,7 @@ process plotProfile { ...@@ -498,7 +496,7 @@ process plotProfile {
script: script:
""" """
module load deeptools/2.5.0.1 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 { ...@@ -540,8 +538,6 @@ process peakAnnotation {
input: input:
file designAnnotatePeaks file designAnnotatePeaks
file gtf from gtfFile_annotPeaks
file geneNames
output: output:
...@@ -552,7 +548,7 @@ process peakAnnotation { ...@@ -552,7 +548,7 @@ process peakAnnotation {
""" """
module load R/3.3.2-gccmkl 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__)) + \ ...@@ -11,8 +11,9 @@ test_output_path = os.path.dirname(os.path.abspath(__file__)) + \
@pytest.mark.singleend @pytest.mark.singleend
def test_plot_singleend(): def test_plot_singleend():
assert os.path.exists(os.path.join(test_output_path, 'plotProfile.png')) 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 @pytest.mark.pairedend
def test_plot_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