1- bigwig_export <- function (x , y ){
1+ bigwig_export <- function (x , y , type ){
22 tracks <- split(x , strand(x ))
3- rtracklayer :: export.bw(tracks $ `+` , paste0 (y ," _plus .bw" ))
3+ rtracklayer :: export.bw(tracks $ `+` , paste (y , type , " plus .bw" , sep = " _ " ))
44 min <- tracks $ `-`
55 min $ score <- min $ score * (- 1 )
6- rtracklayer :: export.bw(tracks $ `+` , paste0(y ," _plus.bw" ))
7- rtracklayer :: export.bw(min , paste0(y , " _minus.bw" ) )
6+ rtracklayer :: export.bw(min , paste(y , type , " minus.bw" , sep = " _" ) )
87}
98
109export_tagclusters <- function (ce ){
1110 # export normalized TSS counts into bigwig
1211 mapply(
1312 bigwig_export ,
1413 CAGEr :: CTSSnormalizedTpmGR(ce , " all" ),
15- CAGEr :: sampleLabels(ce ))
14+ CAGEr :: sampleLabels(ce ),
15+ " normalized" )
1616
1717 # export raw TSS counts into bigwig
1818 mapply(
1919 bigwig_export ,
2020 CAGEr :: CTSStagCountGR(ce , " all" ),
21- CAGEr :: sampleLabels(ce ))
21+ CAGEr :: sampleLabels(ce ),
22+ " raw" )
2223
2324 bedTracks <- CAGEr :: exportToTrack(
2425 ce ,
@@ -35,8 +36,9 @@ export_consensus_clusters <- function(ce){
3536 ccbedTracks <- CAGEr :: exportToTrack(
3637 ce ,
3738 what = " consensusClusters" ,
38- colorByExpressionProfile = TRUE ,
39- oneTrack = FALSE )
40-
39+ colorByExpressionProfile = FALSE ,
40+ oneTrack = TRUE )
41+ # remove dominant TSS because it is not applicable for consensus clusters
42+ ccbedTracks $ thick = NA
4143 rtracklayer :: export.bed(ccbedTracks , " consensusClusters.bed" )
4244}
0 commit comments