[R] Bionconductor help

2013-06-07 Thread Payal Urs
Hi

I am trying to do some data analysis using R and Bioconductor.  I have a
function to read my data called ReadAffyData and a function to plot the
data called preqc.  I want to know if there is any way I can extract
information (read: Data) from the ReadAffyData function into preqc in order
to produce plots? I have not completely understood the inheritance in R and
I am getting errors similar to the one below. I am new to R and could do
with any help in this aspect!

ReadAffyData - function( filename ) {

require(affy)
require(annotate)

Cov - read.table( filename, sep=\t, header=1, quote=,
comment= )
if( ! all( c( Filename, Label, Repl, Trt ) %in% colnames( Cov )
) )
{
stop( Missing mandatory column )
}

Cov - Cov[order(Cov$Trt),]
i - table(Cov$Trt)
Cov$Repl - unlist( lapply( i, function( j ) 1:j ) )
Cov$Label - paste( as.character( Cov$Trt ), Cov$Repl, sep=: )
rownames(Cov) - as.character(Cov$Label)

tmp1 - colnames( Cov )
tmp2 - rep( , length( Cov ) )

for( i in 1:length( tmp2 ) )
{
tmp2[i] - paste( sort( unique( as.character( Cov[,i] ) ) ),
collapse=/ )
}

labelDescription - data.frame( labelDescription=tmp2 )

rownames( labelDescription ) - tmp1
tmp - new( AnnotatedDataFrame, data=Cov,
varMetadata=labelDescription)

Data - ReadAffy( sampleNames=as.character( Cov$Label
),phenoData=tmp, verbose=TRUE )
}

preQC - function(name){
ReadAffyData(name)
plotDensity( log2( pm( Data ) ), xlab=Log2( Intensity ), ylab=Density,
main=Raw(PM))
}

preQC(cov.txt)
1 reading C:/CEL/GSM311471.CEL ...instantiating an AffyBatch (intensity a
506944x24 matrix)...done.
Reading in : C:/CEL/GSM311471.CEL
Reading in : C:/CEL/GSM311472.CEL
Reading in : C:/CEL/GSM311473.CEL
Reading in : C:/CEL/GSM311474.CEL
Reading in : C:/CEL/GSM311475.CEL
.
.
.
Error in pm(Data) :
  error in evaluating the argument 'object' in selecting a method for
function 'pm': Error: object 'Data' not found

sessionInf()
R version 3.0.1 (2013-05-16)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252
 LC_MONETARY=English_India.1252
[4] LC_NUMERIC=C   LC_TIME=English_India.1252

attached base packages:
[1] parallel  stats graphics  grDevices utils datasets  methods
base

other attached packages:
[1] annotate_1.38.0  AnnotationDbi_1.22.6 affy_1.38.1
 Biobase_2.20.0   BiocGenerics_0.6.0

loaded via a namespace (and not attached):
 [1] affyio_1.28.0 BiocInstaller_1.10.1  DBI_0.2-7
IRanges_1.18.1preprocessCore_1.22.0
 [6] RSQLite_0.11.4stats4_3.0.1  tools_3.0.1
XML_3.96-1.1  xtable_1.7-1
[11] zlibbioc_1.6.0



Thanking you,
Ipsitha
Graduate Student
London

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bionconductor help

2013-06-07 Thread arun
Hi,

You would get better response if you post at Bioconductor mailing list.
http://www.bioconductor.org/help/mailing-list/

A.K.

- Original Message -
From: Payal Urs payal@gmail.com
To: r-help@r-project.org
Cc: 
Sent: Friday, June 7, 2013 6:12 AM
Subject: [R] Bionconductor help

Hi

I am trying to do some data analysis using R and Bioconductor.  I have a
function to read my data called ReadAffyData and a function to plot the
data called preqc.  I want to know if there is any way I can extract
information (read: Data) from the ReadAffyData function into preqc in order
to produce plots? I have not completely understood the inheritance in R and
I am getting errors similar to the one below. I am new to R and could do
with any help in this aspect!

ReadAffyData - function( filename ) {

        require(affy)
        require(annotate)

        Cov - read.table( filename, sep=\t, header=1, quote=,
comment= )
    if( ! all( c( Filename, Label, Repl, Trt ) %in% colnames( Cov )
) )
        {
        stop( Missing mandatory column )
    }

        Cov - Cov[order(Cov$Trt),]
        i - table(Cov$Trt)
        Cov$Repl - unlist( lapply( i, function( j ) 1:j ) )
        Cov$Label - paste( as.character( Cov$Trt ), Cov$Repl, sep=: )
        rownames(Cov) - as.character(Cov$Label)

        tmp1 - colnames( Cov )
    tmp2 - rep( , length( Cov ) )

        for( i in 1:length( tmp2 ) )
        {
        tmp2[i] - paste( sort( unique( as.character( Cov[,i] ) ) ),
collapse=/ )
    }

        labelDescription - data.frame( labelDescription=tmp2 )

    rownames( labelDescription ) - tmp1
    tmp - new( AnnotatedDataFrame, data=Cov,
varMetadata=labelDescription)

        Data - ReadAffy( sampleNames=as.character( Cov$Label
),phenoData=tmp, verbose=TRUE )
}

preQC - function(name){
ReadAffyData(name)
plotDensity( log2( pm( Data ) ), xlab=Log2( Intensity ), ylab=Density,
main=Raw(PM))
}

preQC(cov.txt)
1 reading C:/CEL/GSM311471.CEL ...instantiating an AffyBatch (intensity a
506944x24 matrix)...done.
Reading in : C:/CEL/GSM311471.CEL
Reading in : C:/CEL/GSM311472.CEL
Reading in : C:/CEL/GSM311473.CEL
Reading in : C:/CEL/GSM311474.CEL
Reading in : C:/CEL/GSM311475.CEL
.
.
.
Error in pm(Data) :
  error in evaluating the argument 'object' in selecting a method for
function 'pm': Error: object 'Data' not found

sessionInf()
R version 3.0.1 (2013-05-16)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252
LC_MONETARY=English_India.1252
[4] LC_NUMERIC=C                   LC_TIME=English_India.1252

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods
base

other attached packages:
[1] annotate_1.38.0      AnnotationDbi_1.22.6 affy_1.38.1
Biobase_2.20.0       BiocGenerics_0.6.0

loaded via a namespace (and not attached):
[1] affyio_1.28.0         BiocInstaller_1.10.1  DBI_0.2-7
IRanges_1.18.1        preprocessCore_1.22.0
[6] RSQLite_0.11.4        stats4_3.0.1          tools_3.0.1
XML_3.96-1.1          xtable_1.7-1
[11] zlibbioc_1.6.0



Thanking you,
Ipsitha
Graduate Student
London

    [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Bionconductor help

2013-06-07 Thread Martin Morgan

On 06/07/2013 07:16 AM, arun wrote:

Hi,

You would get better response if you post at Bioconductor mailing list.
http://www.bioconductor.org/help/mailing-list/


Agreed, though in this case I think


ReadAffyData - function( filename ) {

...

Data - ReadAffy( sampleNames=as.character( Cov$Label),
 phenoData=tmp, verbose=TRUE )
}

preQC - function(name){
ReadAffyData(name)


what needs to happen here is that the return value needs to be assigned to a 
variable,


Data - ReadAffyData(name)

Martin




plotDensity( log2( pm( Data ) ), xlab=Log2( Intensity ), ylab=Density,
main=Raw(PM))
}




A.K.

- Original Message -
From: Payal Urs payal@gmail.com
To: r-help@r-project.org
Cc:
Sent: Friday, June 7, 2013 6:12 AM
Subject: [R] Bionconductor help

Hi

I am trying to do some data analysis using R and Bioconductor.  I have a
function to read my data called ReadAffyData and a function to plot the
data called preqc.  I want to know if there is any way I can extract
information (read: Data) from the ReadAffyData function into preqc in order
to produce plots? I have not completely understood the inheritance in R and
I am getting errors similar to the one below. I am new to R and could do
with any help in this aspect!

ReadAffyData - function( filename ) {

...

   Data - ReadAffy( sampleNames=as.character( Cov$Label ),phenoData=tmp, 
verbose=TRUE )
}

preQC - function(name){
ReadAffyData(name)
plotDensity( log2( pm( Data ) ), xlab=Log2( Intensity ), ylab=Density,
main=Raw(PM))
}

preQC(cov.txt)
1 reading C:/CEL/GSM311471.CEL ...instantiating an AffyBatch (intensity a
506944x24 matrix)...done.
Reading in : C:/CEL/GSM311471.CEL
Reading in : C:/CEL/GSM311472.CEL
Reading in : C:/CEL/GSM311473.CEL
Reading in : C:/CEL/GSM311474.CEL
Reading in : C:/CEL/GSM311475.CEL
.
.
.
Error in pm(Data) :
   error in evaluating the argument 'object' in selecting a method for
function 'pm': Error: object 'Data' not found

sessionInf()
R version 3.0.1 (2013-05-16)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252
LC_MONETARY=English_India.1252
[4] LC_NUMERIC=C   LC_TIME=English_India.1252

attached base packages:
[1] parallel  stats graphics  grDevices utils datasets  methods
base

other attached packages:
[1] annotate_1.38.0  AnnotationDbi_1.22.6 affy_1.38.1
Biobase_2.20.0   BiocGenerics_0.6.0

loaded via a namespace (and not attached):
[1] affyio_1.28.0 BiocInstaller_1.10.1  DBI_0.2-7
IRanges_1.18.1preprocessCore_1.22.0
[6] RSQLite_0.11.4stats4_3.0.1  tools_3.0.1
XML_3.96-1.1  xtable_1.7-1
[11] zlibbioc_1.6.0



Thanking you,
Ipsitha
Graduate Student
London

 [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.