Skip to content

Commit

Permalink
Merge pull request #2 from mahmoudibrahim/jamm1.0.7.3
Browse files Browse the repository at this point in the history
Jamm1.0.7.3
  • Loading branch information
mahmoudibrahim committed Mar 28, 2016
2 parents fb705d0 + 6a8c1ac commit dfa910e
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 57 deletions.
6 changes: 3 additions & 3 deletions JAMM.sh
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down Expand Up @@ -28,7 +28,7 @@ sPath="`( cd \"$sPath\" && pwd )`"
usage()
{
cat << EOF
Welcome to JAMM v1.0.7rev2 (GNU GPLv3). Copyright (C) 2014-2015 Mahmoud Ibrahim.
Welcome to JAMM v1.0.7rev3 (GNU GPLv3). Copyright (C) 2014-2016 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 SignalGenerator.sh
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 @@ -27,7 +27,7 @@ sPath="`( cd \"$sPath\" && pwd )`"
usage()
{
cat << EOF
Welcome to JAMM v1.0.7rev2 Signal Generator Script (GNU GPLv3). Copyright (C) 2014-2015 Mahmoud Ibrahim.
Welcome to JAMM v1.0.7rev3 Signal Generator Script (GNU GPLv3). Copyright (C) 2014-2016 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
4 changes: 2 additions & 2 deletions bincalculator.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down
7 changes: 2 additions & 5 deletions changelog
@@ -1,9 +1,6 @@
===================
Version 1.0.7rev2
Version 1.0.7rev3
===================

- fixed bugs in paired-end handling
- added an option to set pre-scheduling to FALSE for mclapply
- some cryptic errors now replaced with warnings or more user-friendly error messages
- fixed a bug in peakfinder related to finding one enriched window in a chromosome
- added simple depth normalization option to SignalGenerator.sh
- fixed bugs in automated threshold that slowed it down when input was present
4 changes: 2 additions & 2 deletions peakfilter.pl
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down
87 changes: 58 additions & 29 deletions peakfinder.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down Expand Up @@ -157,17 +157,17 @@ countreadspe = function(bedfile, reads, chromsize, filelist, chrcount) {
o = which(filelist == bedfile)


if (reads[[o]][length(reads[[o]]),2] > chromsize) {
message(paste0(chromName, ", Warning: Read alignments do not match chromosome length, Skipped!"))
#if (reads[[o]][length(reads[[o]]),2] > chromsize) {
# message(paste0(chromName, ", Warning: Read alignments do not match chromosome length, Skipped!"))

if (chrcount == 1) {
message(paste0(chromName, ", ERROR: The first chromosome in the analysis was skipped. I can not calculate normalization factors. You can either delete this chromosome from your chromosome size file or fix the previous warning!"))
quit()
system("exit 1")
} else {
quit()
}
}
# if (chrcount == 1) {
# message(paste0(chromName, ", ERROR: The first chromosome in the analysis was skipped. I can not calculate normalization factors. You can either delete this chromosome from your chromosome size file or fix the previous warning!"))
# quit()
# system("exit 1")
# } else {
# quit()
# }
#}

counts = vector(mode = "numeric", length = chromsize)
for (j in 1:length(reads[[o]][,1])) {
Expand Down Expand Up @@ -251,8 +251,7 @@ pickwins = function(winStart, coffeeshopSud, counts, numdup, startlist, winSize)


#score windows for fast analysis
scorewindow = function(winStart, coffeeshopSud, numdup, C, bkgd, counts, startlist) {

scorewindow = function(winStart, coffeeshopSud, numdup, C, CCC, Cmin, bkgd, counts, startlist) {
plz = which(startlist == winStart)
winEnd = coffeeshopSud[plz]

Expand All @@ -269,16 +268,8 @@ scorewindow = function(winStart, coffeeshopSud, numdup, C, bkgd, counts, startli
Rs[,j] = filtfilt(rep(1,80)/80,1,Rsr[,j])
}
#extract subset of the background
if (bkgd != "None") {
Cs = counts[[numdup+1]]
Cmin = min(Cs[Cs > 0])
Cs = Cs[winStart:winEnd]
Cs = filtfilt(rep(1,80)/80,1,Cs) + Cmin #gets rid of Inf in the fold change
} else {
set.seed(samplingSeed)
Cs = sample(C, rWinSizeTemp, replace = TRUE)
Cs = filtfilt(rep(1,80)/80,1,Cs)
}
Cs = CCC[winStart:winEnd]
Cs = filtfilt(rep(1,80)/80,1,Cs) + Cmin #gets rid of Inf in the fold change

#start scoring
signal = (geomean(Rs))
Expand All @@ -287,6 +278,34 @@ scorewindow = function(winStart, coffeeshopSud, numdup, C, bkgd, counts, startli
}


#score windows for fast analysis
scorewindowALT = function(winStart, coffeeshopSud, numdup, C, bkgd, counts, startlist) {
plz = which(startlist == winStart)
winEnd = coffeeshopSud[plz]

#will store peak information
writethis = list()

rWinSizeTemp = winEnd - winStart + 1

#extract subset of the IP
Rs = matrix(nrow = rWinSizeTemp, ncol = numdup)
Rsr = Rs
for (j in 1:numdup) {
Rsr[,j] = counts[[j]][winStart:winEnd]
Rs[,j] = filtfilt(rep(1,80)/80,1,Rsr[,j])
}
#extract subset of the background
set.seed(samplingSeed)
Cs = sample(C, rWinSizeTemp, replace = TRUE)
Cs = filtfilt(rep(1,80)/80,1,Cs)

#start scoring
signal = (geomean(Rs))
cairo = (mean(signal)) / (mean(Cs))
return(cairo)
}

#Initialize MClust clustering parameters
smoothcounts = function(winStart, coffeeshopSud, numdup, counts, startlist) { #helper function1

Expand Down Expand Up @@ -897,7 +916,6 @@ if (coffeeshopSud[length(coffeeshopSud)] > chromSize) {
coffeeshopSud[length(coffeeshopSud)] = chromSize
}


if (cornum > 1) {
coffeeshop = mclapply(coffeeshopNord, pickwins, coffeeshopSud, counts, numdup, startlist = coffeeshopNord, winSize, mc.cores = cornum, mc.preschedule = presched)
} else {
Expand Down Expand Up @@ -951,13 +969,24 @@ param = initparam(coffeeshopNord, coffeeshopSud, numdup, counts, cornum, clustnu
# Enriched Window Filtering
# ==========================
if (windowe != 1) { #do it only if window fold enrichment filtering is required
if (cornum > 1) {
scores = mclapply(coffeeshop[,1], scorewindow, coffeeshop[,2], numdup, C, bkgd, counts, startlist = coffeeshop[,1], mc.cores = cornum, mc.preschedule = presched)

if (bkgd != "None") {
CCC = counts[[numdup+1]]
Cmin = min(CCC[CCC > 0])
if (cornum > 1) {
scores = mclapply(coffeeshop[,1], scorewindow, coffeeshop[,2], numdup, C, CCC, Cmin, bkgd, counts, startlist = coffeeshop[,1], mc.cores = cornum, mc.preschedule = presched)
} else {
scores = lapply(coffeeshop[,1], scorewindow, coffeeshop[,2], numdup, C, CCC, Cmin, bkgd, counts, startlist = coffeeshop[,1])
}
} else {
scores = lapply(coffeeshop[,1], scorewindow, coffeeshop[,2], numdup, C, bkgd, counts, startlist = coffeeshop[,1])
if (cornum > 1) {
scores = mclapply(coffeeshop[,1], scorewindowALT, coffeeshop[,2], numdup, C, bkgd, counts, startlist = coffeeshop[,1], mc.cores = cornum, mc.preschedule = presched)
} else {
scores = lapply(coffeeshop[,1], scorewindowALT, coffeeshop[,2], numdup, C, bkgd, counts, startlist = coffeeshop[,1])
}
}

scores = unlist(scores)

if (windowe == "auto") {
lscores = log(scores)
if (length(scores) > 0) {
Expand Down
4 changes: 2 additions & 2 deletions peakhelper.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down
8 changes: 5 additions & 3 deletions readme
Expand Up @@ -3,7 +3,7 @@ JAMM is a universal peak finder for NGS datasets that can integrate information
JAMM was developed in the Ohler lab at the Berlin Institute for Medical Systems Biology.


Visit this page for documentation: http://code.google.com/p/jamm-peak-finder/
Visit this page for documentation: https://github.com/mahmoudibrahim/JAMM
Also check JAMM's publication in Bioinformatics: http://bioinformatics.oxfordjournals.org/content/31/1/48


Expand All @@ -13,10 +13,12 @@ To install JAMM:
- Install the following R packages: signal and mclust


To get information about options available to JAMM users, run the JAMM bash script without any parameters or visit the documentation page at http://code.google.com/p/jamm-peak-finder/wiki/Usage
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 or post at the JAMM Google groups page: https://groups.google.com/forum/#!forum/jamm-peak-finder
If you encounter errors or have questions, please email mahmoud.ibrahim@mdc-berlin.de


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, please use the option "-e auto".

Thank you.
4 changes: 2 additions & 2 deletions readshifter.pl
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down
4 changes: 2 additions & 2 deletions signalmaker.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down
4 changes: 2 additions & 2 deletions xcorr.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down
4 changes: 2 additions & 2 deletions xcorrhelper.r
@@ -1,6 +1,6 @@
########################################################################
# JAMMv1.0.7rev2 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2015 Mahmoud Ibrahim
# JAMMv1.0.7rev3 is a peak finder for joint analysis of NGS replicates.
# Copyright (C) 2014-2016 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 Down

0 comments on commit dfa910e

Please sign in to comment.