Révision 0303dbe8

b/doc/sphinx_doc/conf.py
50 50
# built documents.
51 51
#
52 52
# The short X.Y version.
53
version = '2.3.30'
53
version = '2.3.31'
54 54
# The full version, including alpha/beta/rc tags.
55
release = '2.3.30'
55
release = '2.3.31'
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
979 979

  
980 980
Florent Chuffart
981 981

  
982
R: Compute the fuzzy nucs.
983

  
984
Compute the fuzzy nucs.
985
-----------------------
986

  
987
Description
988
~~~~~~~~~~~
989

  
990
This function aggregate non common wp nucs for each strain and substract
991
common wp nucs. It does not take care about the size of the resulting
992
fuzzy regions. It will be take into account in the count read part og
993
the pipeline.
994

  
995
Usage
996
~~~~~
997

  
998
::
999

  
1000
    get_fuzzy(combi, roi, roi_index, strain_maps, common_nuc_results, 
1001
        config = NULL)
1002

  
1003
Arguments
1004
~~~~~~~~~
1005

  
1006
``combi``
1007

  
1008
The strain combination to consider.
1009

  
1010
``roi``
1011

  
1012
The region of interest.
1013

  
1014
``roi_index``
1015

  
1016
The region of interest index.
1017

  
1018
``strain_maps``
1019

  
1020
Nuc maps.
1021

  
1022
``common_nuc_results``
1023

  
1024
Common wp nuc maps
1025

  
1026
``config``
1027

  
1028
GLOBAL config variable
1029

  
1030
Author(s)
1031
~~~~~~~~~
1032

  
1033
Florent Chuffart
1034

  
1035 982
R: Compute the list of SNEPs for a given set of marker, strain...
1036 983

  
1037 984
Compute the list of SNEPs for a given set of marker, strain combination and nuc form.
......
1166 1113
+---------------+---------------------------------------------------+
1167 1114
| Author:       | Florent Chuffart                                  |
1168 1115
+---------------+---------------------------------------------------+
1169
| Version:      | 2.3.30                                            |
1116
| Version:      | 2.3.31                                            |
1170 1117
+---------------+---------------------------------------------------+
1171 1118
| License:      | CeCILL                                            |
1172 1119
+---------------+---------------------------------------------------+
......
1278 1225

  
1279 1226
Florent Chuffart
1280 1227

  
1281
R: Remove wp nucs from common nucs list.
1282

  
1283
Remove wp nucs from common nucs list.
1284
-------------------------------------
1285

  
1286
Description
1287
~~~~~~~~~~~
1288

  
1289
It is based on common wp nucs index on nucs and region.
1290

  
1291
Usage
1292
~~~~~
1293

  
1294
::
1295

  
1296
    remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, strain)
1297

  
1298
Arguments
1299
~~~~~~~~~
1300

  
1301
``strain_maps``
1302

  
1303
Nuc maps.
1304

  
1305
``roi_index``
1306

  
1307
The region of interest index.
1308

  
1309
``tmp_common_nucs``
1310

  
1311
the list of wp nucs.
1312

  
1313
``strain``
1314

  
1315
The strain to consider.
1316

  
1317
Author(s)
1318
~~~~~~~~~
1319

  
1320
Florent Chuffart
1321

  
1322 1228
R: sign from strand
1323 1229

  
1324 1230
sign from strand
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.30
4
Version: 2.3.31
5 5
License: CeCILL 
6 6
Title: nm
7 7
Depends: seqinr, plotrix, DESeq, cachecache
b/src/NAMESPACE
1
export(flat_aggregated_intra_strain_nucs, FDR, lod_score_vecs, dfadd, filter_tf_inputs, filter_tf_outputs, sign_from_strand, flat_reads, get_comp_strand, aggregate_intra_strain_nucs, align_inter_strain_nucs, translate_roi, fetch_mnase_replicates, substract_region, union_regions, remove_aligned_wp, translate_regions, extract_wp, crop_fuzzy, get_fuzzy, get_all_reads, get_design, plot_dist_samples, analyse_design, get_sneps, perform_anovas, watch_samples, compute_inter_all_strain_curs, switch_pairlist, build_replicates, ARAB2ROM, ROM2ARAB)
1
export(flat_aggregated_intra_strain_nucs, FDR, lod_score_vecs, dfadd, filter_tf_inputs, filter_tf_outputs, sign_from_strand, flat_reads, get_comp_strand, aggregate_intra_strain_nucs, align_inter_strain_nucs, translate_roi, fetch_mnase_replicates, substract_region, union_regions, collapse_regions, translate_regions, crop_fuzzy, get_all_reads, get_design, plot_dist_samples, analyse_design, get_sneps, perform_anovas, watch_samples, compute_inter_all_strain_curs, switch_pairlist, build_replicates, ARAB2ROM, ROM2ARAB)
b/src/R/nucleominer.R
819 819
### This function is based on sort of lower bounds to detect regions that intersect. We compare lower bound and upper bound of the porevious item. This function embed a while loop and break break regions list become stable.
820 820
regions ##<< The Regions to be aggregated
821 821
) {
822
  if (nrow(regions) == 0) {return(regions)}
822 823
  old_length = length(regions[,1])
823 824
  new_length = 0
824 825

  
......
848 849
  return(union)
849 850
}
850 851

  
851
remove_aligned_wp = function(# Remove wp nucs from common nucs list.
852
### It is based on common wp nucs index on nucs and region.
853
strain_maps, ##<< Nuc maps.
854
roi_index, ##<< The region of interest index.
855
tmp_common_nucs, ##<< the list of wp nucs.
856
strain##<< The strain to consider.
857
){
858
  fuzzy_nucs = strain_maps[[strain]]
859
  fuzzy_nucs = fuzzy_nucs[fuzzy_nucs$roi_index == roi_index,]
860
  fuzzy_nucs = fuzzy_nucs[order(fuzzy_nucs$index_nuc),]
861
  if (length(fuzzy_nucs[,1]) == 0) {return(fuzzy_nucs)}
862
  if (sum(fuzzy_nucs$index_nuc == min(fuzzy_nucs$index_nuc):max(fuzzy_nucs$index_nuc)) != max(fuzzy_nucs$index_nuc)) {"Warning in index!"}
863
  anti_index_1 = tmp_common_nucs[[paste("index_nuc", strain, sep="_")]]
864
  fuzzy_nucs = fuzzy_nucs[-anti_index_1,]
865
  return(fuzzy_nucs)
866
}
852
# remove_aligned_wp = function(# Remove wp nucs from common nucs list.
853
# ### It is based on common wp nucs index on nucs and region.
854
# strain_maps, ##<< Nuc maps.
855
# roi_index, ##<< The region of interest index.
856
# tmp_common_nucs, ##<< the list of wp nucs.
857
# strain##<< The strain to consider.
858
# ){
859
#   fuzzy_nucs = strain_maps[[strain]]
860
#   fuzzy_nucs = fuzzy_nucs[fuzzy_nucs$roi_index == roi_index,]
861
#   fuzzy_nucs = fuzzy_nucs[order(fuzzy_nucs$index_nuc),]
862
#   if (length(fuzzy_nucs[,1]) == 0) {return(fuzzy_nucs)}
863
#   if (sum(fuzzy_nucs$index_nuc == min(fuzzy_nucs$index_nuc):max(fuzzy_nucs$index_nuc)) != max(fuzzy_nucs$index_nuc)) {"Warning in index!"}
864
#   anti_index_1 = tmp_common_nucs[[paste("index_nuc", strain, sep="_")]]
865
#   fuzzy_nucs = fuzzy_nucs[-anti_index_1,]
866
#   return(fuzzy_nucs)
867
# }
867 868

  
868 869
translate_regions = function(# Translate a list of regions from a strain ref to another.
869 870
### This function is an eloborated call to translate_roi.
......
941 942
}
942 943

  
943 944

  
944
get_fuzzy = function(# Compute the fuzzy nucs.
945
### This function aggregate non common wp nucs for each strain and substract common wp nucs. It does not take care about the size of the resulting fuzzy regions. It will be take into account in the count read part og the pipeline.
946
combi, ##<< The strain combination to consider.
947
roi, ##<< The region of interest.
948
roi_index, ##<< The region of interest index.
949
strain_maps, ##<< Nuc maps.
950
common_nuc_results, ##<< Common wp nuc maps
951
config=NULL ##<< GLOBAL config variable
952
) {
953
  print(roi_index)
954
  PLOT = FALSE
955
  tmp_common_nucs = common_nuc_results[[paste(combi[1], combi[2], sep="_")]]
956
  tmp_common_nucs = tmp_common_nucs[tmp_common_nucs$roi_index == roi_index, ]
957

  
958
  print(paste("Dealing with fuzzy from", combi[1]))
959
  tmp_fuzzy_nucs_1 = remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, combi[1])
960
  tmp_fuzzy_nucs_1 = crop_fuzzy(tmp_fuzzy_nucs_1, roi, combi[1], config)
961
  if (length(tmp_fuzzy_nucs_1[,1]) == 0) {return(NULL)}
962
  agg_fuzzy_1 = union_regions(tmp_fuzzy_nucs_1)
963
  if (PLOT) for (i in 1:length(agg_fuzzy_1[,1])) {
964
    lines(c(agg_fuzzy_1[i,]$lower_bound, agg_fuzzy_1[i,]$upper_bound), c(+3.1,+3.1), col=2)
965
  }
966

  
967
  print(paste("Dealing with fuzzy from ", combi[2]))
968
  tmp_fuzzy_nucs_2 = remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, combi[2])
969
  if (length(tmp_fuzzy_nucs_2[,1]) == 0) {return(NULL)}
970
  agg_fuzzy_2 = union_regions(tmp_fuzzy_nucs_2)
971
  agg_fuzzy_2 = crop_fuzzy(agg_fuzzy_2, roi, combi[2], config)
972
  tr_agg_fuzzy_2 = translate_regions(agg_fuzzy_2, combi, roi_index, roi=roi, config=config)
973
  tr_agg_fuzzy_2 = crop_fuzzy(tr_agg_fuzzy_2, roi, combi[2], config)
974
  # tr_agg_fuzzy_2 = union_regions(tr_agg_fuzzy_2)
975
  if (PLOT) for (i in 1:length(tr_agg_fuzzy_2[,1])) {
976
    lines(c(tr_agg_fuzzy_2[i,]$lower_bound, tr_agg_fuzzy_2[i,]$upper_bound), c(+3.3,+3.3), col=2)
977
  }
978

  
979
  print("Dealing with fuzzy from both...")
980
  all_fuzzy = union_regions(rbind(agg_fuzzy_1, tr_agg_fuzzy_2))
981
  if (PLOT) for (i in 1:length(all_fuzzy[,1])) {
982
    lines(c(all_fuzzy[i,]$lower_bound, all_fuzzy[i,]$upper_bound), c(+3.2, +3.2), col=1)
983
  }
984

  
985
  print(paste("Dealing with wp from", combi[1]))
986
  wp_nucs_1 = extract_wp(strain_maps, roi_index, combi[1], tmp_common_nucs)
987
  if (PLOT) for (i in 1:length(wp_nucs_1[,1])) {
988
    lines(c(wp_nucs_1[i,]$lower_bound, wp_nucs_1[i,]$upper_bound), c(+3.5,+3.5), col=3)
989
  }
990

  
991
  print(paste("Dealing with wp from", combi[2]))
992
  wp_nucs_2 = extract_wp(strain_maps, roi_index, combi[2], tmp_common_nucs)
993
  tr_wp_nucs_2 = translate_regions(wp_nucs_2, combi, roi_index, roi=roi, config=config)
994
  if (PLOT) for (i in 1:length(tr_wp_nucs_2[,1])) {
995
    lines(c(tr_wp_nucs_2[i,]$lower_bound, tr_wp_nucs_2[i,]$upper_bound), c(+3.7,+3.7), col=3)
996
  }
997

  
998
  print("Dealing with wp from both...")
999
  all_wp = union_regions(rbind(wp_nucs_1[,1:4], tr_wp_nucs_2))
1000
  if (PLOT) for (i in 1:length(all_wp[,1])) {
1001
    lines(c(all_wp[i,]$lower_bound, all_wp[i,]$upper_bound), c(+3.6, +3.6), col=1)
1002
  }
1003

  
1004
  print("Dealing with fuzzy and wp...")
1005
  non_inter_fuzzy = substract_region(all_fuzzy, all_wp)
1006
  if (is.null(non_inter_fuzzy)) { return(NULL) }
1007

  
1008
  non_inter_fuzzy$len = non_inter_fuzzy$upper_bound - non_inter_fuzzy$lower_bound
1009
  # non_inter_fuzzy = non_inter_fuzzy[non_inter_fuzzy$len >= min_fuzz_width,]
1010
  if (PLOT) for (i in 1:length(non_inter_fuzzy[,1])) {
1011
    lines(c(non_inter_fuzzy[i,]$lower_bound, non_inter_fuzzy[i,]$upper_bound), c(+3.9, +3.9), col=1)
1012
  }
1013

  
1014
  non_inter_fuzzy$index_nuc = 1:length(non_inter_fuzzy[,1])
1015
  return (non_inter_fuzzy)
1016
}
945
# get_fuzzy = function(# Compute the fuzzy nucs.
946
# ### This function aggregate non common wp nucs for each strain and substract common wp nucs. It does not take care about the size of the resulting fuzzy regions. It will be take into account in the count read part og the pipeline.
947
# combi, ##<< The strain combination to consider.
948
# roi, ##<< The region of interest.
949
# roi_index, ##<< The region of interest index.
950
# strain_maps, ##<< Nuc maps.
951
# common_nuc_results, ##<< Common wp nuc maps
952
# config=NULL ##<< GLOBAL config variable
953
# ) {
954
#   print(roi_index)
955
#   PLOT = FALSE
956
#   tmp_common_nucs = common_nuc_results[[paste(combi[1], combi[2], sep="_")]]
957
#   tmp_common_nucs = tmp_common_nucs[tmp_common_nucs$roi_index == roi_index, ]
958
# 
959
#   print(paste("Dealing with fuzzy from", combi[1]))
960
#   tmp_fuzzy_nucs_1 = remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, combi[1])
961
#   tmp_fuzzy_nucs_1 = crop_fuzzy(tmp_fuzzy_nucs_1, roi, combi[1], config)
962
#   if (length(tmp_fuzzy_nucs_1[,1]) == 0) {return(NULL)}
963
#   agg_fuzzy_1 = union_regions(tmp_fuzzy_nucs_1)
964
#   if (PLOT) for (i in 1:length(agg_fuzzy_1[,1])) {
965
#     lines(c(agg_fuzzy_1[i,]$lower_bound, agg_fuzzy_1[i,]$upper_bound), c(+3.1,+3.1), col=2)
966
#   }
967
# 
968
#   print(paste("Dealing with fuzzy from ", combi[2]))
969
#   tmp_fuzzy_nucs_2 = remove_aligned_wp(strain_maps, roi_index, tmp_common_nucs, combi[2])
970
#   if (length(tmp_fuzzy_nucs_2[,1]) == 0) {return(NULL)}
971
#   agg_fuzzy_2 = union_regions(tmp_fuzzy_nucs_2)
972
#   agg_fuzzy_2 = crop_fuzzy(agg_fuzzy_2, roi, combi[2], config)
973
#   tr_agg_fuzzy_2 = translate_regions(agg_fuzzy_2, combi, roi_index, roi=roi, config=config)
974
#   tr_agg_fuzzy_2 = crop_fuzzy(tr_agg_fuzzy_2, roi, combi[2], config)
975
#   # tr_agg_fuzzy_2 = union_regions(tr_agg_fuzzy_2)
976
#   if (PLOT) for (i in 1:length(tr_agg_fuzzy_2[,1])) {
977
#     lines(c(tr_agg_fuzzy_2[i,]$lower_bound, tr_agg_fuzzy_2[i,]$upper_bound), c(+3.3,+3.3), col=2)
978
#   }
979
# 
980
#   print("Dealing with fuzzy from both...")
981
#   all_fuzzy = union_regions(rbind(agg_fuzzy_1, tr_agg_fuzzy_2))
982
#   if (PLOT) for (i in 1:length(all_fuzzy[,1])) {
983
#     lines(c(all_fuzzy[i,]$lower_bound, all_fuzzy[i,]$upper_bound), c(+3.2, +3.2), col=1)
984
#   }
985
# 
986
#   print(paste("Dealing with wp from", combi[1]))
987
#   wp_nucs_1 = extract_wp(strain_maps, roi_index, combi[1], tmp_common_nucs)
988
#   if (PLOT) for (i in 1:length(wp_nucs_1[,1])) {
989
#     lines(c(wp_nucs_1[i,]$lower_bound, wp_nucs_1[i,]$upper_bound), c(+3.5,+3.5), col=3)
990
#   }
991
# 
992
#   print(paste("Dealing with wp from", combi[2]))
993
#   wp_nucs_2 = extract_wp(strain_maps, roi_index, combi[2], tmp_common_nucs)
994
#   tr_wp_nucs_2 = translate_regions(wp_nucs_2, combi, roi_index, roi=roi, config=config)
995
#   if (PLOT) for (i in 1:length(tr_wp_nucs_2[,1])) {
996
#     lines(c(tr_wp_nucs_2[i,]$lower_bound, tr_wp_nucs_2[i,]$upper_bound), c(+3.7,+3.7), col=3)
997
#   }
998
# 
999
#   print("Dealing with wp from both...")
1000
#   all_wp = union_regions(rbind(wp_nucs_1[,1:4], tr_wp_nucs_2))
1001
#   if (PLOT) for (i in 1:length(all_wp[,1])) {
1002
#     lines(c(all_wp[i,]$lower_bound, all_wp[i,]$upper_bound), c(+3.6, +3.6), col=1)
1003
#   }
1004
# 
1005
#   print("Dealing with fuzzy and wp...")
1006
#   non_inter_fuzzy = substract_region(all_fuzzy, all_wp)
1007
#   if (is.null(non_inter_fuzzy)) { return(NULL) }
1008
# 
1009
#   non_inter_fuzzy$len = non_inter_fuzzy$upper_bound - non_inter_fuzzy$lower_bound
1010
#   # non_inter_fuzzy = non_inter_fuzzy[non_inter_fuzzy$len >= min_fuzz_width,]
1011
#   if (PLOT) for (i in 1:length(non_inter_fuzzy[,1])) {
1012
#     lines(c(non_inter_fuzzy[i,]$lower_bound, non_inter_fuzzy[i,]$upper_bound), c(+3.9, +3.9), col=1)
1013
#   }
1014
# 
1015
#   non_inter_fuzzy$index_nuc = 1:length(non_inter_fuzzy[,1])
1016
#   return (non_inter_fuzzy)
1017
# }
1017 1018

  
1018 1019

  
1019 1020

  

Formats disponibles : Unified diff