flowCore: modifying exprs of a flowFrame
1
0
Entering edit mode
Last seen 7.3 years ago
Hello Everybody, This is my first post to this list, so please advise me if this is not a right place to post this question. I was trying to modify a flowFrame by accessing the raw data matrix obtained from exprs(). This operation, however, does not changes tthe parameters of the flowFrame ( can be found by pData(parameters(ff)) ). In particular I was unable to use operations such as filter at later stage if I directly modify exprs(). Please take a look at the following two methods of transformations. They are essentially doing the same transformation but I am getting error in subsequent analysis if I transform exprs(ff) directly without using transform function in flowCore. ##### first use direct transformation... error on the filter ######### > ff = GvHD[[1,3:4]] > exprs(ff) = asinh(exprs(ff)/10000) > ff flowFrame object 's5a01' with 3420 cells and 2 observables: name desc range minRange maxRange $P3 FL1-H CD15 FITC 1024 1 10000$P4 FL2-H CD45 PE 1024 1 10000 124 keywords are stored in the 'description' slot > summary(ff) FL1-H FL2-H Min. 0.0001000 0.000100 1st Qu. 0.0004621 0.003833 Median 0.0017590 0.010840 Mean 0.0841400 0.033600 3rd Qu. 0.1090000 0.053100 Max. 0.8814000 0.825300 > c1f <- curv1Filter(filterId="myCurv1Filter", x='FL2-H') > fres <- filter(ff, c1f) Error in if (from == to) rep.int(from, length.out) else as.vector(c(from, : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In min(x[, id]) : no non-missing arguments to min; returning Inf 2: In max(x[, id]) : no non-missing arguments to max; returning -Inf > ##### Now use transformation of flowCore. No error on the filter ######### > ff = GvHD[[1,3:4]] > ff = transform(ff, FL1-H=asinh(FL1-H/10000), FL2-H=asinh(FL2-H/10000)) > ff flowFrame object 's5a01' with 3420 cells and 2 observables: name desc range minRange maxRange $P3 FL1-H CD15 FITC 1024 1e-04 0.8813736$P4 FL2-H CD45 PE 1024 1e-04 0.8813736 128 keywords are stored in the 'description' slot > summary(ff) FL1-H FL2-H Min. 0.0001000 0.000100 1st Qu. 0.0004621 0.003833 Median 0.0017590 0.010840 Mean 0.0841400 0.033600 3rd Qu. 0.1090000 0.053100 Max. 0.8814000 0.825300 > c1f <- curv1Filter(filterId="myCurv1Filter", x='FL2-H') > fres <- filter(ff, c1f) ######################################### I am looking for a way such that the first method does work. I wanted to transform on exprs() because it is faster . Thanks Ariful Azad PhD Student Purdue University [[alternative HTML version deleted]]
flowCore flowCore • 2.0k views
0
Entering edit mode
@valerie-obenchain-4275
Last seen 2.1 years ago
United States
Hi Ariful, This looks like a bug. I've cc'd a couple of the authors. Valerie On 12/06/12 15:18, Ariful Azad wrote: > Hello Everybody, > > This is my first post to this list, so please advise me if this is not a > right place to post this question. > > I was trying to modify a flowFrame by accessing the raw data matrix > obtained from exprs(). This operation, however, does not changes tthe > parameters of the flowFrame ( can be found by pData(parameters(ff)) ). > In particular I was unable to use operations such as filter at later stage > if I directly modify exprs(). Please take a look at the following two > methods of transformations. They are essentially doing the same > transformation but I am getting error in subsequent analysis if I transform > exprs(ff) directly without using transform function in flowCore. > > ##### first use direct transformation... error on the filter ######### > >> ff = GvHD[[1,3:4]] >> exprs(ff) = asinh(exprs(ff)/10000) >> ff > flowFrame object 's5a01' > with 3420 cells and 2 observables: > name desc range minRange maxRange > $P3 FL1-H CD15 FITC 1024 1 10000 >$P4 FL2-H CD45 PE 1024 1 10000 > 124 keywords are stored in the 'description' slot >> summary(ff) > FL1-H FL2-H > Min. 0.0001000 0.000100 > 1st Qu. 0.0004621 0.003833 > Median 0.0017590 0.010840 > Mean 0.0841400 0.033600 > 3rd Qu. 0.1090000 0.053100 > Max. 0.8814000 0.825300 >> c1f<- curv1Filter(filterId="myCurv1Filter", x='FL2-H') >> fres<- filter(ff, c1f) > Error in if (from == to) rep.int(from, length.out) else as.vector(c(from, > : > missing value where TRUE/FALSE needed > In addition: Warning messages: > 1: In min(x[, id]) : no non-missing arguments to min; returning Inf > 2: In max(x[, id]) : no non-missing arguments to max; returning -Inf > > ##### Now use transformation of flowCore. No error on the filter ######### > >> ff = GvHD[[1,3:4]] >> ff = transform(ff, FL1-H=asinh(FL1-H/10000), > FL2-H=asinh(FL2-H/10000)) >> ff > flowFrame object 's5a01' > with 3420 cells and 2 observables: > name desc range minRange maxRange > $P3 FL1-H CD15 FITC 1024 1e-04 0.8813736 >$P4 FL2-H CD45 PE 1024 1e-04 0.8813736 > 128 keywords are stored in the 'description' slot >> summary(ff) > FL1-H FL2-H > Min. 0.0001000 0.000100 > 1st Qu. 0.0004621 0.003833 > Median 0.0017590 0.010840 > Mean 0.0841400 0.033600 > 3rd Qu. 0.1090000 0.053100 > Max. 0.8814000 0.825300 >> c1f<- curv1Filter(filterId="myCurv1Filter", x='FL2-H') >> fres<- filter(ff, c1f) > ######################################### > > I am looking for a way such that the first method does work. I wanted to > transform on exprs() because it is faster . > > Thanks > > Ariful Azad > PhD Student > Purdue University > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
0
Entering edit mode
Hi,Ariful, As you said,transform method should be the right API to use because it takes care of the the dynamic range in the parameters slot as well the exprs matrix. By using exprs replacement method directly, you want to update the range info manually before apply curve1Filter,i.e.: rg<-pData(parameters(ff))[,4:5] pData(parameters(ff))[,4:5]<-asinh(rg/1000) And I don't think we want exprs<- to update parameters slot automatically because the range in the parameters may not necessarily need to be consistent with exprs values. Hope this helps. Mike Jiang Raphael Gottardo's Lab On 12/27/2012 09:43 AM, Valerie Obenchain wrote: > Hi Ariful, > > This looks like a bug. I've cc'd a couple of the authors. > > Valerie > > > On 12/06/12 15:18, Ariful Azad wrote: >> Hello Everybody, >> >> This is my first post to this list, so please advise me if this is not a >> right place to post this question. >> >> I was trying to modify a flowFrame by accessing the raw data matrix >> obtained from exprs(). This operation, however, does not changes tthe >> parameters of the flowFrame ( can be found by pData(parameters(ff)) ). >> In particular I was unable to use operations such as filter at later >> stage >> if I directly modify exprs(). Please take a look at the following two >> methods of transformations. They are essentially doing the same >> transformation but I am getting error in subsequent analysis if I >> transform >> exprs(ff) directly without using transform function in flowCore. >> >> ##### first use direct transformation... error on the filter ######### >> >>> ff = GvHD[[1,3:4]] >>> exprs(ff) = asinh(exprs(ff)/10000) >>> ff >> flowFrame object 's5a01' >> with 3420 cells and 2 observables: >> name desc range minRange maxRange >> $P3 FL1-H CD15 FITC 1024 1 10000 >>$P4 FL2-H CD45 PE 1024 1 10000 >> 124 keywords are stored in the 'description' slot >>> summary(ff) >> FL1-H FL2-H >> Min. 0.0001000 0.000100 >> 1st Qu. 0.0004621 0.003833 >> Median 0.0017590 0.010840 >> Mean 0.0841400 0.033600 >> 3rd Qu. 0.1090000 0.053100 >> Max. 0.8814000 0.825300 >>> c1f<- curv1Filter(filterId="myCurv1Filter", x='FL2-H') >>> fres<- filter(ff, c1f) >> Error in if (from == to) rep.int(from, length.out) else >> as.vector(c(from, >> : >> missing value where TRUE/FALSE needed >> In addition: Warning messages: >> 1: In min(x[, id]) : no non-missing arguments to min; returning Inf >> 2: In max(x[, id]) : no non-missing arguments to max; returning -Inf >> >> ##### Now use transformation of flowCore. No error on the filter >> ######### >> >>> ff = GvHD[[1,3:4]] >>> ff = transform(ff, FL1-H=asinh(FL1-H/10000), >> FL2-H=asinh(FL2-H/10000)) >>> ff >> flowFrame object 's5a01' >> with 3420 cells and 2 observables: >> name desc range minRange maxRange >> $P3 FL1-H CD15 FITC 1024 1e-04 0.8813736 >>$P4 FL2-H CD45 PE 1024 1e-04 0.8813736 >> 128 keywords are stored in the 'description' slot >>> summary(ff) >> FL1-H FL2-H >> Min. 0.0001000 0.000100 >> 1st Qu. 0.0004621 0.003833 >> Median 0.0017590 0.010840 >> Mean 0.0841400 0.033600 >> 3rd Qu. 0.1090000 0.053100 >> Max. 0.8814000 0.825300 >>> c1f<- curv1Filter(filterId="myCurv1Filter", x='FL2-H') >>> fres<- filter(ff, c1f) >> ######################################### >> >> I am looking for a way such that the first method does work. I wanted to >> transform on exprs() because it is faster . >> >> Thanks >> >> Ariful Azad >> PhD Student >> Purdue University >> >> [[alternative HTML version deleted]] >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at r-project.org >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >