Skip to content

Commit

Permalink
Merge pull request #6 from mahmoudibrahim/mahmoudibrahim-patch-1
Browse files Browse the repository at this point in the history
Mahmoudibrahim patch 1
  • Loading branch information
mahmoudibrahim committed May 17, 2019
2 parents 2162b15 + a79e6b6 commit 5a9a46f
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 56 deletions.
59 changes: 43 additions & 16 deletions JAMM.sh
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud M Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand All @@ -28,7 +28,7 @@ sPath="`( cd \"$sPath\" && pwd )`"
usage()
{
cat << EOF
Welcome to JAMM v1.0.7rev5 (GNU GPLv3). Copyright (C) 2014-2016 Mahmoud Ibrahim.
Welcome to JAMM v1.0.7rev5 (GNU GPLv3). Copyright (C) 2014-2019 Mahmoud Ibrahim.
This program comes with ABSOLUTELY NO WARRANTY; for details visit http://www.gnu.org/licenses/gpl.html. This is free software, and you are welcome to redistribute it under certain conditions; visit http://www.gnu.org/licenses/gpl.html for details.
Expand Down Expand Up @@ -136,23 +136,44 @@ then
usage
exit 1
fi
if [[ -d "$out/peaks" ]]; then
printf "\n\nOutput directory $out/peaks already exists. I can't override existing results!\n\n"
if [ -f "$out/peaks/filtered.peaks.narrowPeak" ]; then
printf "\n\nOutput file $out/peaks/filtered.peaks.narrowPeak already exists. I can't override existing results!\n\n"
exit 0
fi

if [ $fraglen == "ns" ]; then
if [[ -d "$out/xcorr" ]]; then
printf "\n\nOutput directory $out/xcorr already exists. I can't override existing results!\n\n"
exit 0
fi
for j in $out/xcorr/*/xcorrsummary.txt; do
if [ -e "$j" ]; then
printf "\n\nOutput files in $out/xcorr already exist. I can't override existing results!\n\n"
exit 0
fi
done
fi

nreps=$(ls -1 $sdir/*.bed | wc -l) #count how many sample files
#no sample files
if [ $nreps == "0" ]; then
echo "No Sample Files Found!"
exit 1
fi

if [ $fraglen != "ns" ]; then
IFS=',' read -ra numTemp <<< "$fraglen"
numFrags=$(echo "${#numTemp[@]}")
if [ $bdir != "None" ]; then
nrepsTemp=$(echo $((nreps + 1)))
if [ $numFrags != $nrepsTemp ]; then
printf "\n\nThe number of fragment lengths you gave is not the same as the number of sample replicates (and background). There should be as many fragment lengths as number of sample replicates+1\n\n"
exit 1
fi
else
if [ $numFrags != $nreps ]; then
printf "\n\nThe number of fragment lengths you gave is not the same as the number of sample replicates. There should be as many fragment lengths as there are sample replicates\n\n"
exit 1
fi
fi
fi

if [ $tempdir == "/tmp" ]; then
wdir=$(mktemp -d -t -p $tempdir)
else
Expand Down Expand Up @@ -245,8 +266,9 @@ if [ $fraglen == "ns" ]; then

##Counting Where Reads Start and Calculating Cross Correlation
mkdir $wdir/stats.$ran/ #store count files
mkdir $out/xcorr #final xcorr results

if [ ! -d "$out/xcorr" ]; then
mkdir $out/xcorr #final xcorr results
fi

printf "Calculating Fragment Length(s)...\n"
for f in $wdir/sizes.$ran/*; do #for each chromosome
Expand Down Expand Up @@ -290,15 +312,19 @@ if [ $fraglen == "ns" ]; then
for f in $sdir/*.bed; do
file=$(basename $f)
samplefile=$(echo $file | awk -F"." '{print $1}');
mkdir "$out/xcorr/$samplefile" #final xcorr results
if [ ! -d "$out/xcorr/$samplefile" ]; then
mkdir "$out/xcorr/$samplefile" #final xcorr results
fi
if [ -f "$wdir/stats.$ran/xc.$samplefile.tab" ]; then
cp $wdir/stats.$ran/xc.$samplefile.tab $out/xcorr/$samplefile/shifts.txt
fi
Rscript "$sPath/xcorrhelper.r" -infile="$out/xcorr/$samplefile/shifts.txt" -out="$out/xcorr/$samplefile"
done
#report xcorr results (control)
if [ $bdir != "None" ]; then
mkdir "$out/xcorr/ctrl" #final xcorr results
if [ ! -d "$out/xcorr/ctrl" ]; then
mkdir "$out/xcorr/ctrl" #final xcorr results
fi
if [ -f "$wdir/stats.$ran/xc.ctrl.tab" ]; then
cp $wdir/stats.$ran/xc.ctrl.tab $out/xcorr/ctrl/shifts.txt
fi
Expand Down Expand Up @@ -382,8 +408,9 @@ fi
# Step Four: Calling Peaks
# ===========================
mkdir $wdir/peaks.$ran/ #store count files
mkdir $out/peaks #store peak files

if [ ! -d "$out/peaks" ]; then
mkdir $out/peaks #store peak files
fi
printf "Calling Peaks...(mode: $mode, resolution: $resol)\n"


Expand Down
15 changes: 7 additions & 8 deletions README.md
@@ -1,18 +1,18 @@
JAMM Peak Finder
======

**JAMM is a peak finder for NGS datasets (ChIP-Seq, ATAC-Seq, DNase-Seq..etc.) that can integrate replicates and assign peak boundaries accurately. JAMM is applicable to both broad and narrow datasets. Read more [in JAMM's publication](http://bioinformatics.oxfordjournals.org/content/early/2014/09/15/bioinformatics.btu568).**
**JAMM is a peak finder for NGS datasets (ChIP-Seq, ATAC-Seq, DNase-Seq..etc.) that can integrate replicates and assign peak boundaries accurately. JAMM is applicable to both broad and narrow datasets. Read more [in JAMM's publication](https://academic.oup.com/bioinformatics/article/31/1/48/2365061).**

JAMM was developed at the [Ohler lab](http://ohlerlab.mdc-berlin.net/) at [BIMSB-MDC](http://www.mdc-berlin.de/13800178/en/bimsb) in Berlin.
JAMM was developed at the [Ohler lab](http://ohlerlab.mdc-berlin.net/) at [BIMSB-MDC](https://www.mdc-berlin.de/bimsb) in Berlin.

If you have questions or need help running JAMM please email us at [this email](http://www.google.com/recaptcha/mailhide/d?k=01vPijd2GG0LEbZV2NyE_rSA==&c=49GEiFp47dZQV_120clczwxYcP3tQ98VWBJtNl6_dBw=), we will be happy to help you.
If you have questions or need help running JAMM please email us at [this email](http://scr.im/jammpro), we will be happy to help you.



Download JAMM
------

**The latest JAMM version is _JAMMv1.0.7rev5_. [Click here to download it](https://github.com/mahmoudibrahim/JAMM/archive/JAMMv1.0.7.5.zip).**
**The latest JAMM version is _JAMMv1.0.7rev6_. [Click here to download it](https://github.com/mahmoudibrahim/JAMM/archive/JAMMv1.0.7.6.zip).**

If you are interested in older versions, check the [Downloads Archive](https://github.com/mahmoudibrahim/JAMM/wiki/JAMM-Downloads-Archive) or the [Github release page](https://github.com/mahmoudibrahim/JAMM/releases).

Expand All @@ -21,7 +21,7 @@ If you are interested in older versions, check the [Downloads Archive](https://g
Latest News and Updates
------

* **Jul 14 2016:** *New version of JAMM released (v1.0.7rev5)*. This version adds -T parameter for custom temporary directory (thanks to @amathelier) as well as streamlined code and fixed bugs in peakfinder.r.
* **May 17 2019:** *New version of JAMM released (v1.0.7rev6)*. This version features some small changes to input checks.

_Visit the [the Wiki Homepage](https://github.com/mahmoudibrahim/JAMM/wiki) for older updates and news._

Expand All @@ -35,7 +35,7 @@ JAMM Documentation
* [JAMM's Output](https://github.com/mahmoudibrahim/JAMM/wiki/JAMM%27s-Output)
* [Frequently Asked Questions](https://github.com/mahmoudibrahim/JAMM/wiki/Frequently-Asked-Questions)
* [Parameter Recommendations](https://github.com/mahmoudibrahim/JAMM/wiki/JAMM-Parameter-Recommendation)
* Of course it is always good to read [the actual paper](http://bioinformatics.oxfordjournals.org/content/31/1/48) :)
* Of course it is always good to read [the actual paper](https://academic.oup.com/bioinformatics/article/31/1/48/2365061) :)

Please check [the Wiki Homepage](https://github.com/mahmoudibrahim/JAMM/wiki) for more information on JAMM.

Expand Down Expand Up @@ -71,11 +71,10 @@ How to Cite JAMM?

Please cite:

**Ibrahim MM, Lacadie SA, Ohler U (2015). JAMM: A Peak Finder for Joint Analysis of NGS Replicates. _Bioinformatics_, 31(1): 48-55. doi: [10.1093/bioinformatics/btu568] (http://bioinformatics.oxfordjournals.org/content/early/2014/09/15/bioinformatics.btu568)**
**Ibrahim MM, Lacadie SA, Ohler U (2015). JAMM: A Peak Finder for Joint Analysis of NGS Replicates. _Bioinformatics_, 31(1): 48-55. doi: [10.1093/bioinformatics/btu568] (https://academic.oup.com/bioinformatics/article/31/1/48/23650618)**


---

*Hint: While you run JAMM, you can also go on jammin...*

[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/HSs1HgM0Wos/0.jpg)](http://www.youtube.com/watch?v=HSs1HgM0Wos)
8 changes: 4 additions & 4 deletions SignalGenerator.sh
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################

##Finding out the path
Expand All @@ -27,7 +27,7 @@ sPath="`( cd \"$sPath\" && pwd )`"
usage()
{
cat << EOF
Welcome to JAMM v1.0.7rev5 Signal Generator Script (GNU GPLv3). Copyright (C) 2014-2016 Mahmoud Ibrahim.
Welcome to JAMM v1.0.7rev5 Signal Generator Script (GNU GPLv3). Copyright (C) 2014-2019 Mahmoud Ibrahim.
This program comes with ABSOLUTELY NO WARRANTY; for details visit http://www.gnu.org/licenses/gpl.html. This is free software, and you are welcome to redistribute it under certain conditions; visit http://www.gnu.org/licenses/gpl.html for details.
Expand Down
6 changes: 3 additions & 3 deletions bincalculator.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down
7 changes: 4 additions & 3 deletions changelog
@@ -1,6 +1,7 @@
===================
Version 1.0.7rev5
Version 1.0.7rev6
===================

- add -T option to define a custom temporary directory (thanks to Anthony Mathelier[https://github.com/amathelier])
- streamlined some code parts related to findpeak function and removed a bug there that affected peaks in some extreme parameter/data combinations
- changed some input checks to make it more compatible with pipeline tools
- added an input check for -f option
- updated contact info
6 changes: 3 additions & 3 deletions peakfilter.pl
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down
6 changes: 3 additions & 3 deletions peakfinder.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down
6 changes: 3 additions & 3 deletions peakhelper.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down
2 changes: 1 addition & 1 deletion readme
Expand Up @@ -16,7 +16,7 @@ To install JAMM:
To get information about options available to JAMM users, run the JAMM bash script without any parameters or visit the documentation page at https://github.com/mahmoudibrahim/JAMM/wiki/Usage


If you encounter errors or have questions, please email mahmoud.ibrahim@mdc-berlin.de
If you encounter errors or have questions, please email mmibrahim@pm.me


Important Note: JAMM produces a large number of peaks on purpose to allow you to choose your threshold the way you like. The peaks are scored and ranked by column 7 in the output narrowPeak file. If you want a confident list directly from JAMM, you could use the option "-e auto", although a better way is probably to see the peaks that are reproducible in your replicates.
6 changes: 3 additions & 3 deletions readshifter.pl
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down
6 changes: 3 additions & 3 deletions signalmaker.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down
6 changes: 3 additions & 3 deletions xcorr.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down
6 changes: 3 additions & 3 deletions xcorrhelper.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev5 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 Mahmoud Ibrahim
# JAMMv1.0.7rev6 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2019 Mahmoud Ibrahim
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Contact: mahmoud.ibrahim@mdc-berlin.de
# Contact: mmibrahim@pm.me
########################################################################


Expand Down

0 comments on commit 5a9a46f

Please sign in to comment.