@@ -491,18 +491,31 @@ intersectPeakMatrix <- function(peak_id_x,
491
491
492
492
# tag fold change summary
493
493
peakx_with_peaky_all_Info <- peak_x [(peak_x $ id %in% peakx_with_peaky $ id ), ]
494
- tag_x_num <- nrow(peakx_with_peaky_all_Info )
495
- tag_density_x_median <- median(peakx_with_peaky_all_Info $ tag_fold_change )
496
- tag_density_x_mean <- mean(peakx_with_peaky_all_Info $ tag_fold_change )
497
- tag_density_x_sd <- sd(peakx_with_peaky_all_Info $ tag_fold_change )
498
- tag_density_x_quartile <- quantile(peakx_with_peaky_all_Info $ tag_fold_change )
499
- tag_density_x_quartile_25 <- as.numeric(tag_density_x_quartile [2 ])
500
- tag_density_x_quartile_75 <- as.numeric(tag_density_x_quartile [4 ])
501
- tag_density_x <- c(tag_x_num , tag_density_x_mean , tag_density_x_sd ,
502
- tag_density_x_median , tag_density_x_quartile_25 ,
503
- tag_density_x_quartile_75 )
504
- names(tag_density_x ) <- c(" peak_number" ," mean" ," SD" ,
505
- " median" ," quartile_25" ," quartile_75" )
494
+ if (ncol(peakx_with_peaky_all_Info ) < = 4 )
495
+ {
496
+ message(paste0(" ... ... ... Warning: " , id_x ,
497
+ " is derived from TFregulomeR but lack fifth 'read_fold_change' column. So skip read enrichment profiling !!" ))
498
+ }
499
+ else if (! is.numeric(peakx_with_peaky_all_Info [,5 ]))
500
+ {
501
+ message(paste0(" ... ... ... Warning: " , id_x ,
502
+ " is derived from TFregulomeR and fifth column is supposed to be 'tag_old_change' but it's NOT numeric . So skip read enrichment profiling !!" ))
503
+ }
504
+ else
505
+ {
506
+ tag_x_num <- nrow(peakx_with_peaky_all_Info )
507
+ tag_density_x_median <- median(peakx_with_peaky_all_Info [,5 ])
508
+ tag_density_x_mean <- mean(peakx_with_peaky_all_Info [,5 ])
509
+ tag_density_x_sd <- sd(peakx_with_peaky_all_Info [,5 ])
510
+ tag_density_x_quartile <- quantile(peakx_with_peaky_all_Info [,5 ])
511
+ tag_density_x_quartile_25 <- as.numeric(tag_density_x_quartile [2 ])
512
+ tag_density_x_quartile_75 <- as.numeric(tag_density_x_quartile [4 ])
513
+ tag_density_x <- c(tag_x_num , tag_density_x_mean , tag_density_x_sd ,
514
+ tag_density_x_median , tag_density_x_quartile_25 ,
515
+ tag_density_x_quartile_75 )
516
+ names(tag_density_x ) <- c(" peak_number" ," mean" ," SD" ,
517
+ " median" ," quartile_25" ," quartile_75" )
518
+ }
506
519
507
520
508
521
# compute motif matrix
@@ -676,18 +689,32 @@ intersectPeakMatrix <- function(peak_id_x,
676
689
677
690
# tag fold change summary
678
691
peaky_with_peakx_all_Info <- peak_y [(peak_y $ id %in% peaky_with_peakx $ id ), ]
679
- tag_y_num <- nrow(peaky_with_peakx_all_Info )
680
- tag_density_y_median <- median(peaky_with_peakx_all_Info $ tag_fold_change )
681
- tag_density_y_mean <- mean(peaky_with_peakx_all_Info $ tag_fold_change )
682
- tag_density_y_sd <- sd(peaky_with_peakx_all_Info $ tag_fold_change )
683
- tag_density_y_quartile <- quantile(peaky_with_peakx_all_Info $ tag_fold_change )
684
- tag_density_y_quartile_25 <- as.numeric(tag_density_y_quartile [2 ])
685
- tag_density_y_quartile_75 <- as.numeric(tag_density_y_quartile [4 ])
686
- tag_density_y <- c(tag_y_num , tag_density_y_mean , tag_density_y_sd ,
687
- tag_density_y_median , tag_density_y_quartile_25 ,
688
- tag_density_y_quartile_75 )
689
- names(tag_density_y ) <- c(" peak_number" ," mean" ," SD" ,
690
- " median" ," quartile_25" ," quartile_75" )
692
+ if (ncol(peaky_with_peakx_all_Info ) < = 4 )
693
+ {
694
+ message(paste0(" ... ... ... Warning: " , id_y ,
695
+ " is derived from TFregulomeR but lack fifth 'read_fold_change' column. So skip read profiling !!" ))
696
+ }
697
+ else if (! is.numeric(peaky_with_peakx_all_Info [,5 ]))
698
+ {
699
+ message(paste0(" ... ... ... Warning: " , id_y ,
700
+ " is derived from TFregulomeR and fifth column is supposed to be 'tag_old_change' but it's NOT numeric. So skip read profiling !!" ))
701
+ }
702
+ else
703
+ {
704
+ tag_y_num <- nrow(peaky_with_peakx_all_Info )
705
+ tag_density_y_median <- median(peaky_with_peakx_all_Info [,5 ])
706
+ tag_density_y_mean <- mean(peaky_with_peakx_all_Info [,5 ])
707
+ tag_density_y_sd <- sd(peaky_with_peakx_all_Info [,5 ])
708
+ tag_density_y_quartile <- quantile(peaky_with_peakx_all_Info [,5 ])
709
+ tag_density_y_quartile_25 <- as.numeric(tag_density_y_quartile [2 ])
710
+ tag_density_y_quartile_75 <- as.numeric(tag_density_y_quartile [4 ])
711
+ tag_density_y <- c(tag_y_num , tag_density_y_mean , tag_density_y_sd ,
712
+ tag_density_y_median , tag_density_y_quartile_25 ,
713
+ tag_density_y_quartile_75 )
714
+ names(tag_density_y ) <- c(" peak_number" ," mean" ," SD" ,
715
+ " median" ," quartile_25" ," quartile_75" )
716
+
717
+ }
691
718
692
719
# compute motif matrix
693
720
colnames(motif_seq_y ) <- c(" chr" ," start" ," end" ," strand" ," weight" , " pvalue" ," qvalue" ," sequence" )
0 commit comments