On 04/05/2016 12:15 AM, TODOROV HELENA p1001837 wrote:
>
> This is how I scale the matrix :
>
>
> > b<- read.FCS(fcs_file,transformation="scale")
>
> > mat<-exprs(b)
>
> > scaled_matrix<-apply(mat,2,scale)
>
>
> > scaled_b<-new("flowFrame", exprs=scaled_matrix, parameters=parameters(b), description=description(b))
> > write.FCS(scaled_b, outFile)
>
> But I have issues reading the generated fcs file. I suppose it may come from the fact that description parameters such as $PnE, $PnR, MaxRange... no longer correspond to the values of parameters?
>
> Also, could you tell me why the "transformation = "scale" " option from the read.FCS() function does not transform the data so that each markers mean = 0 and sd = 1?
>
> Thank you in advance
> Helena
>>
>>
>
> De : Mike <wjiang2@fhcrc.org>
> Envoyé : lundi 4 avril 2016 20:01
> À : TODOROV HELENA p1001837
> Cc : Emilie Westeel
> Objet : Re: Scaling fcs files with flowCore
>
> What kind of scaling method do you use to transform the data?
>
> On 03/29/2016 03:08 AM, TODOROV HELENA p1001837 wrote:
>>
>> Dear Dr Jiang,
>>
>>
>> I've encountered some issues to scale my fcs data. I use the function :
>>
>>
>> > b<- read.FCS(fcs_file,transformation="scale")
>>
>>
>> But the transformed data are not scaled per marker. Indeed, if I check the summary of the object I generated, the mean for each marker is different from 0 and the sd is different from 1 (I attached a screenshot of this summary to this mail). Is there any way to scale the data per marker with flowCore/ or another Bioconductor package?
>>
>>
>> Also, I transformed my data manually (by extracting the matrix and scaling it per column), but the files I regenerate with the following functions :
>>
>>
>> > scaled_b<-new("flowFrame", exprs=scaled_matrix, parameters=parameters(b), description=description(b))
>>
>>
>> > write.FCS(scaled_b, outFile)
>>
>> present some problems when I try to read them with cytometry data analysis tools such as Phenograph, Visne, Scaffold. I tried to change some parameters manually, like the Rmin Rmax ranges that changed when I scaled the exprs matrix, which worked for some files but not for all, and which is also very time consuming. So I was wondering if there was any way to efficiently regenerate a description and parameters which correspond to the new matrix I generate, to create an FCS file that would be readable again?
>>
>> Thank you in advance,
>>
>> Helena Todorov
>>
Thank you Mike, this function is working perfectly !