From 09968e1a85678d829b2267f1ad38775ed5cb465d Mon Sep 17 00:00:00 2001 From: Stefan Lang Date: Thu, 10 Mar 2016 07:57:00 +0100 Subject: [PATCH] An urgent fix to FACS data handling. --- SCExV/lib/HTpcrA/Controller/GEOfiles.pm | 47 +++++++++++++++++++++++++ SCExV/lib/HTpcrA/EnableFiles.pm | 3 +- SCExV/lib/HTpcrA/Model/GEO_files.pm | 31 ++++++++++++++++ SCExV/root/R_lib/Tool_Pipe.R | 1 + SCExV/root/R_lib/Tool_grouping.R | 16 +++++++++ SCExV/t/model_GEO_files.t | 8 +++++ 6 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 SCExV/lib/HTpcrA/Controller/GEOfiles.pm create mode 100644 SCExV/lib/HTpcrA/Model/GEO_files.pm create mode 100644 SCExV/t/model_GEO_files.t diff --git a/SCExV/lib/HTpcrA/Controller/GEOfiles.pm b/SCExV/lib/HTpcrA/Controller/GEOfiles.pm new file mode 100644 index 0000000..278a222 --- /dev/null +++ b/SCExV/lib/HTpcrA/Controller/GEOfiles.pm @@ -0,0 +1,47 @@ +package HTpcrA::Controller::GEOfiles; +use Moose; +use namespace::autoclean; + +BEGIN { extends 'Catalyst::Controller'; } + +=head1 NAME + +HTpcrA::Controller::GEOfiles - Catalyst Controller + +=head1 DESCRIPTION + +Catalyst Controller. + +=head1 METHODS + +=cut + + +=head2 index + +=cut + +sub index :Path :Args(0) { + my ( $self, $c ) = @_; + + $c->response->body('Matched HTpcrA::Controller::GEOfiles in GEOfiles.'); +} + + + +=encoding utf8 + +=head1 AUTHOR + +Stefan Lang + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; diff --git a/SCExV/lib/HTpcrA/EnableFiles.pm b/SCExV/lib/HTpcrA/EnableFiles.pm index c8e9669..65eed37 100644 --- a/SCExV/lib/HTpcrA/EnableFiles.pm +++ b/SCExV/lib/HTpcrA/EnableFiles.pm @@ -229,11 +229,12 @@ sub __fix_file_problems { ## 1,000 == 1000 !!!!!!! while () { foreach my $problem ( $_ =~ m/(["']-?\d+,\d+,?\d*["'])/g ) { + ##Carp::confess( join(":::", $_ =~ m/(["']-?\d+,\d+,?\d*["'])/g) ); $rep = $problem; $rep =~ s/["',]//g; $_ =~ s/$problem/$rep/; - $_ =~ s/["']//g; } + $_ =~ s/["']//g; print OUT $_; } } diff --git a/SCExV/lib/HTpcrA/Model/GEO_files.pm b/SCExV/lib/HTpcrA/Model/GEO_files.pm new file mode 100644 index 0000000..7876365 --- /dev/null +++ b/SCExV/lib/HTpcrA/Model/GEO_files.pm @@ -0,0 +1,31 @@ +package HTpcrA::Model::GEO_files; +use Moose; +use namespace::autoclean; + +extends 'Catalyst::Model'; + +=head1 NAME + +HTpcrA::Model::GEO_files - Catalyst Model + +=head1 DESCRIPTION + +Catalyst Model. + + +=encoding utf8 + +=head1 AUTHOR + +Stefan Lang + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +__PACKAGE__->meta->make_immutable; + +1; diff --git a/SCExV/root/R_lib/Tool_Pipe.R b/SCExV/root/R_lib/Tool_Pipe.R index 621e92a..a3aacb9 100644 --- a/SCExV/root/R_lib/Tool_Pipe.R +++ b/SCExV/root/R_lib/Tool_Pipe.R @@ -186,6 +186,7 @@ read.PCR.heatmap <- function (fname,use_pass_fail=T){ } read.FACS <- function(fname,use_pass_fail=T) { + browser() ftab <- matrix(ncol=0, nrow=1) try( ftab <- read.PCR ( fname, use_pass_fail ), silent=T ) if ( ncol(ftab) == 0 ){ diff --git a/SCExV/root/R_lib/Tool_grouping.R b/SCExV/root/R_lib/Tool_grouping.R index c17e47e..2b3071d 100644 --- a/SCExV/root/R_lib/Tool_grouping.R +++ b/SCExV/root/R_lib/Tool_grouping.R @@ -43,6 +43,14 @@ group_1D_worker <- function (ma, gene, ranges ) { userGroups } +#' @name checkGrouping +#' @aliases checkGrouping,FluidigmSet-method +#' @rdname checkGrouping-methods +#' @docType methods +#' @description +#' @param userGroups a data.frame with three column the first being the sample name and the third the group ID +#' @param data the fluidigm data object to check against +#' @export checkGrouping <- function ( userGroups, data=NULL ){ userGroups$groupID <- as.vector( as.numeric( userGroups$groupID )) if ( !is.null(data) ){ @@ -78,6 +86,14 @@ checkGrouping <- function ( userGroups, data=NULL ){ if ( min(userGroups$groupID) > 1 ){ userGroups$groupID <- userGroups$groupID - ( min(userGroups$groupID) -1 ) } + for ( i in 1:max(userGroups$groupID) ) { + if ( length( grep (i,userGroups$groupID) ) == 0 ){ + m <- which( userGroups$groupID > i) + if ( length(m) >0 ) { + userGroups$groupID[m] <- userGroups$groupID[m] -1 + } + } + } userGroups } diff --git a/SCExV/t/model_GEO_files.t b/SCExV/t/model_GEO_files.t new file mode 100644 index 0000000..24dbb7d --- /dev/null +++ b/SCExV/t/model_GEO_files.t @@ -0,0 +1,8 @@ +use strict; +use warnings; +use Test::More; + + +BEGIN { use_ok 'HTpcrA::Model::GEO_files' } + +done_testing();