[BioC] Subsetting data from RGList (Again)

Martin Morgan mtmorgan at fhcrc.org
Tue Oct 30 16:49:33 CET 2007


Hi Elliott,

"elliott harrison" <e.harrison at epistem.co.uk> writes:

> Hi All, 
> Sorry to trouble everyone  but I didn't get my subsetting of an RGList
> sorted last week.
> I've tried loads of different combinations of things that were suggested
> but not quite there yet.
>
> MY Data is an RGList object here is a bit
[SNIP]
> $genes
>   Row Col FeatureNum ProbeUID ControlType       ProbeName
> GeneName  SystematicName   Status
> 1   1   1          1        0           1 GE_BrightCorner
> GE_BrightCorner GE_BrightCorner Control6
>  
> $source
> [1] "generic"
>  
>  
> My list of probes to select data with is in this object.
>> a
>            Gene.Probe
> Probe1   A_24_P329635
> Probe2   A_23_P104098
> Probe3   A_23_P419038
> Probe4   A_24_P124550
> Probe5    A_23_P99044
  
You'd like to match your 'Gene.Probe' column, I guess, to a column in
R$genes, maybe ProbeName? So create a numeric vector, with the
locations of each Gene.Probe in R$Genes$ProbeName

> idx <- which(match(a$Gene.Probe, R$genes$ProbeName))

and use it to subset R

> R[idx,]

If you'd wanted to match Probe1, etc, you'd have used rownames(a)
instead of a$Gene.Probe. Sometimes RGList has row names, i.e.,

> rownames(R)

returns a (long!) character vector. In these cases, you can create a
character vector 'rnms' containing at least some of the row names of
R. and

> R[rnms,]

Martin

>  
>  
> I've tried
> A=rownames(a)
> RA = R[A,]
>  
> But don't get any genes
>>$genes
> [1] Row            Col            FeatureNum     ProbeUID
> ControlType    ProbeName      GeneName       SystematicName Status
>
> <0 rows> (or 0-length row.names)
>  
> I've tried creating a vector using match a load of different ways but it
> is always empty
>>vec = match(A, R)
>>vec = match(A, R$genes$ProbeName)
>>vec = match(A, R$genes)
>>vec = match(probelist600, R)
>>vec = match(probelist600, R$genes)
>>vec = match(probelist600, R$genes$ProbeName)
>  
>  
> This is part what ends up in object A
>> A
>   [1] "Probe1"   "Probe2"   "Probe3"   "Probe4"   "Probe5"   "Probe6"
> "Probe7"   "Probe8"   "Probe9"   "Probe10"  "Probe11"  "Probe12"
> "Probe13" 
>
> I expected to see my probe names in there.
> I'm clearly not getting something. 
> Can anyone see where I'm going wrong?
> Many Thanks
> Elliott
>
>
> This message has been scanned for viruses by BlackSpider...{{dropped:3}}
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list