Skip to content

Commit

Permalink
adding gap expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisamiller committed Nov 8, 2017
1 parent 9f06aec commit 0ee86c0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Package: copyCat
Title: Find regions of genomic copy number loss and gain from short reads
Version: 1.6.11
Version: 1.6.12
Author: Chris Miller
Description: Uses the depth of short reads in windows across the genome to
identify regions of genomic copy-number gain and loss
Maintainer: Chris Miller <chrisamiller@gmail.com>
LazyLoad: yes
License: Apache License 2.0 | file LICENSE
Depends: methods, foreach, doMC, IRanges, DNAcopy, stringr
Packaged: 2016-11-30 12:45:10 PM; cmiller
Packaged: 2017-04-18 02:55:38 PM; cmiller
14 changes: 12 additions & 2 deletions R/cnSegments.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ trimSegmentEnds <- function(segs,rdo){
##-----------------------------------------------
## remove segments that overlap at least n% with a reference assembly gap
##
removeGapSpanningSegments <- function(segs,rdo,maxOverlap=0.75){
removeGapSpanningSegments <- function(segs,rdo,maxOverlap=0.75,gapExpansion=1.0){
count = length(segs[,1]);

if(!(file.exists(paste(rdo@params$annotationDirectory,"/gaps.bed",sep="")))){
Expand All @@ -247,7 +247,17 @@ removeGapSpanningSegments <- function(segs,rdo,maxOverlap=0.75){
}

gaps = read.table(paste(rdo@params$annotationDirectory,"/gaps.bed",sep=""))

#expand gaps if necessary
if(gapExpansion!=1){
print(paste("Using gap expansion of ",gapExpansion))
sizes=gaps[,3]-gaps[,2]
exp=round(((sizes*gapExpansion)-sizes)/2)
gaps[,2] = gaps[,2]-exp
gaps[,3] = gaps[,3]+exp
gaps[(gaps[,2]<0),2]=0 #no negative coords exp=round(((sizes*gapExpansion)-sizes)/2)
}


#intersect each chromosome separately
newsegs = foreach(chr=names(rdo@chrs), .combine="rbind") %do%{

Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
sillyname(methods)

initRdClass()
packageStartupMessage("Using copyCat version 1.6.11")
packageStartupMessage("Using copyCat version 1.6.12")
}
6 changes: 5 additions & 1 deletion man/removeGapSpanningSegments.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
false-positive calls.
}
\usage{
removeGapSpanningSegments(segs,rdo,maxOverlap=0.75)
removeGapSpanningSegments(segs,rdo,maxOverlap=0.75,gapExpansion=1.0)
}

\arguments{
Expand All @@ -26,6 +26,10 @@
\item{maxOverlap}{
if a segment overlaps at least this much with a gap, it will be removed.
}
\item{gapExpansion}{
expand each gap feature by this fraction before doing gap
filtering. A value of 1.3 would expand each gap by 30%.
}
}
\value{
returns a dataframe with 5 columns:
Expand Down

0 comments on commit 0ee86c0

Please sign in to comment.