Révision 7646593d

b/doc/sphinx_doc/conf.py
50 50
# built documents.
51 51
#
52 52
# The short X.Y version.
53
version = '2.3.26'
53
version = '2.3.27'
54 54
# The full version, including alpha/beta/rc tags.
55
release = '2.3.26'
55
release = '2.3.27'
56 56

  
57 57
# The language for content autogenerated by Sphinx. Refer to documentation
58 58
# for a list of supported languages.
b/doc/sphinx_doc/rref.rst
789 789

  
790 790
Florent Chuffart
791 791

  
792
R: to flat aggregate\_intra\_strain\_nucs function output
793

  
794
to flat aggregate\_intra\_strain\_nucs function output
795
------------------------------------------------------
796

  
797
Description
798
~~~~~~~~~~~
799

  
800
This function builds a dataframe of all clusters obtain from
801
aggregate\_intra\_strain\_nucs function.
802

  
803
Usage
804
~~~~~
805

  
806
::
807

  
808
    flat_aggregated_intra_strain_nucs(partial_strain_maps, roi_index)
809

  
810
Arguments
811
~~~~~~~~~
812

  
813
``partial_strain_maps``
814

  
815
the output of aggregate\_intra\_strain\_nucs function
816

  
817
``roi_index``
818

  
819
the index of the roi involved
820

  
821
Value
822
~~~~~
823

  
824
Returns a dataframe of all clusters obtain from
825
aggregate\_intra\_strain\_nucs function.
826

  
827
Author(s)
828
~~~~~~~~~
829

  
830
Florent Chuffart
831

  
792 832
R: flat reads
793 833

  
794 834
flat reads
......
1126 1166
+---------------+---------------------------------------------------+
1127 1167
| Author:       | Florent Chuffart                                  |
1128 1168
+---------------+---------------------------------------------------+
1129
| Version:      | 2.3.26                                            |
1169
| Version:      | 2.3.27                                            |
1130 1170
+---------------+---------------------------------------------------+
1131 1171
| License:      | CeCILL                                            |
1132 1172
+---------------+---------------------------------------------------+
......
1551 1591
        plot_arrow_raw_reads = TRUE, plot_arrow_nuc_reads = TRUE, 
1552 1592
        plot_squared_reads = TRUE, plot_coverage = FALSE, plot_gaussian_reads = TRUE, 
1553 1593
        plot_gaussian_unified_reads = TRUE, plot_ellipse_nucs = TRUE, 
1554
        plot_wp_nucs = TRUE, plot_wp_nuc_model = TRUE, plot_common_nucs = TRUE, 
1555
        plot_anovas = FALSE, plot_anova_boxes = FALSE, plot_wp_nucs_4_nonmnase = FALSE, 
1556
        plot_chain = FALSE, aggregated_intra_strain_nucs = NULL, 
1594
        change_col = TRUE, plot_wp_nucs = TRUE, plot_wp_nuc_model = TRUE, 
1595
        plot_common_nucs = TRUE, plot_anovas = FALSE, plot_anova_boxes = FALSE, 
1596
        plot_wp_nucs_4_nonmnase = FALSE, plot_chain = FALSE, aggregated_intra_strain_nucs = NULL, 
1557 1597
        aligned_inter_strain_nucs = NULL, height = 10, config = NULL)
1558 1598

  
1559 1599
Arguments
......
1599 1639

  
1600 1640
Plot (or not) ellipse for a nuc.
1601 1641

  
1642
``change_col``
1643

  
1644
Change the color of each nucleosome.
1645

  
1602 1646
``plot_wp_nucs``
1603 1647

  
1604 1648
Plot (or not) cluster of nucs
b/src/DESCRIPTION
1 1
Package: nucleominer
2 2
Maintainer: Florent Chuffart <florent.chuffart@ens-lyon.fr>
3 3
Author: Florent Chuffart
4
Version: 2.3.26
4
Version: 2.3.27
5 5
License: CeCILL 
6 6
Title: nm
7 7
Depends: seqinr, plotrix, DESeq, cachecache
b/src/R/nucleominer.R
445 445
	print(aggregate_intra_strain_nucs(samples))
446 446
})
447 447

  
448

  
449

  
450

  
451

  
448
flat_aggregated_intra_strain_nucs = function(# to flat aggregate_intra_strain_nucs function output
449
### This function builds a dataframe of all clusters obtain from aggregate_intra_strain_nucs function.
450
partial_strain_maps, ##<< the output of aggregate_intra_strain_nucs function
451
roi_index ##<< the index of the roi involved
452
) {
453
	if  (length(partial_strain_maps) == 0 ){
454
		print(paste("Empty partial_strain_maps for roi", roi_index, "ands strain", strain, "." ))
455
    tmp_strain_maps = list()  
456
	} else {
457
		tmp_strain_map = apply(t(1:length(partial_strain_maps)), 2, function(i){
458
			tmp_nuc = partial_strain_maps[[i]]
459
			tmp_nuc_as_list = list()
460
			tmp_nuc_as_list[["chr"]] = tmp_nuc[["chr"]]
461
			tmp_nuc_as_list[["lower_bound"]] = ceiling(tmp_nuc[["lower_bound"]])
462
			tmp_nuc_as_list[["upper_bound"]] = floor(tmp_nuc[["upper_bound"]])
463
			tmp_nuc_as_list[["roi_index"]] = roi_index
464
			tmp_nuc_as_list[["index_nuc"]] = i
465
			tmp_nuc_as_list[["wp"]] = as.integer(tmp_nuc$wp)
466
			all_original_reads = c()
467
			for (j in 1:length(tmp_nuc$nucs)) {
468
				all_original_reads = c(all_original_reads, tmp_nuc$nucs[[j]]$original_reads)
469
			}
470
			tmp_nuc_as_list[["nb_reads"]] = length(all_original_reads)
471
			if (tmp_nuc$wp) {
472
				tmp_nuc_as_list[["lod_1"]] = signif(tmp_nuc$nucs[[2]]$lod_score,5)
473
				tmp_nuc_as_list[["lod_2"]] = signif(tmp_nuc$nucs[[3]]$lod_score,5)
474
			} else {
475
				tmp_nuc_as_list[["lod_1"]] = NA
476
				tmp_nuc_as_list[["lod_2"]] = NA							
477
			}
478
      return(tmp_nuc_as_list)
479
    })
480
    tmp_strain_maps = do.call("rbind", tmp_strain_map)
481
	}
482
  return(data.frame(tmp_strain_maps))
483
### Returns a dataframe of all clusters obtain from aggregate_intra_strain_nucs function.
484
}
452 485

  
453 486
align_inter_strain_nucs = structure(function(# Aligns nucleosomes between 2 strains.
454 487
### This function aligns nucs between two strains for a given genome region.
......
2056 2089
plot_gaussian_reads = TRUE,  ##<< Plot (or not) gaussian model of a F anf R reads.
2057 2090
plot_gaussian_unified_reads = TRUE,  ##<< Plot (or not) gaussian model of a nuc.
2058 2091
plot_ellipse_nucs = TRUE,  ##<< Plot (or not) ellipse for a nuc.
2092
change_col = TRUE, ##<< Change the color of each nucleosome.
2059 2093
plot_wp_nucs = TRUE,  ##<< Plot (or not) cluster of nucs
2060 2094
plot_wp_nuc_model = TRUE,  ##<< Plot (or not) gaussian model for a cluster of nucs
2061 2095
plot_common_nucs = TRUE,  ##<< Plot (or not) aligned reads.
......
2166 2200
				if (length(nucs$center) > 0) {
2167 2201
					col = 1
2168 2202
		      for (i in 1:length(nucs$center)) {
2169
						col = col + 1
2203
            if (change_col) {
2204
  						col = col + 1              
2205
            }
2170 2206
		        nuc = nucs[i,]
2171 2207
						involved_reads = filter_tf_inputs(reads, sample$roi$chr, nuc$lower_bound, nuc$upper_bound, nuc_width = nuc$width)
2172 2208
				  	involved_signs = apply(t(involved_reads[,3]), 2, function(strand) {	if (strand == "F") return(1) else return(-1)})
......
2202 2238
	  # Plot wp nucs
2203 2239
		if ((plot_wp_nucs_4_nonmnase | sample$marker == "Mnase_Seq") & (plot_wp_nucs | plot_common_nucs | plot_chain)) {
2204 2240
			if (samples[[1]]$marker == "Mnase_Seq") {
2205
				if (is.null(aggregated_intra_strain_nucs)) {
2241
				if (is.null(aggregated_intra_strain_nucs)) {      
2206 2242
	  			wp_nucs = aggregate_intra_strain_nucs(samples)[[1]]			
2207
          foo <<- wp_nucs
2208 2243
				} else {
2209 2244
					wp_nucs = aggregated_intra_strain_nucs[[replicate_rank]]
2210 2245
				}
2211 2246
		  } else {
2212 2247
  			wp_nucs = replicates_wp_nucs[[replicate_rank-2]]
2213 2248
		  }
2214
      
2215 2249
      if (plot_chain) {
2216 2250
        tf_nucs = lapply(wp_nucs, function(nuc) {      
2217 2251
          bar = apply(t(nuc$nucs), 2, function(tmp_nuc){
......
2251 2285
        points(tmp_x, tmp_y, cex=4, pch=16, col="white")
2252 2286
        points(tmp_x, tmp_y, cex=4, lw=2)
2253 2287
        text(tmp_x, tmp_y, 1:nrow(tf_nucs))
2254
        text(tmp_x_inter, tmp_y_inter, tmp_lod_inter, col=(tmp_lod_inter < 20) + 2)  
2288
        text(tmp_x_inter, tmp_y_inter, tmp_lod_inter, srt=90, cex=0.9, bg = "yellow")#, col=(tmp_lod_inter < 20) + 2)  
2255 2289
      }
2256 2290
  
2257 2291
      if (plot_wp_nucs | plot_common_nucs ) {

Formats disponibles : Unified diff