Martin, thanks, that's a great suggestion and solves my problem.

Andrew

On Mon, Aug 23, 2010 at 5:55 PM, Martin Morgan <mtmorgan@fhcrc.org> wrote:

>  On 8/23/2010 1:28 PM, Andrew Yee wrote:
>
>> Take the following DNAStringSet foo as follows
>>
>> x<- DNAStringSet('AGAT')
>> y<- DNAStringSet('GGGTTCC')
>> z<- DNAStringSet('GGGCC')
>>
>> foo<- c(x,y,z)
>> names(foo)<- c('x','y','z')
>>
>> I'm interested in creating a new DNAStringSet of just x and y.  How do I
>> go
>> about doing this?
>>
>> At first, I thought you could do something like
>>
>> c(foo['x'], foo['y'])
>>
>> but this generates an error message, "cannot subset a DNAStringSet by
>> names."
>>
>
> you might do foo[match(c("x", "y"), names(foo))]; I suspect that the issue
> here is that row names of a data frame need to be unique, but not of a
> DNAStringSet, so one has to be explicit about handling duplicates.
>
>  DNAStringSet(c(x="AAA", x="TTT"))
>
> (the latter might suggest more efficient ways of constructing the object).
> Note that my 'match' solution only finds the first, and not all, matches.
>
> Martin
>
>> Thanks,
>> Andrew
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioc-sig-sequencing mailing list
>> Bioc-sig-sequencing@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>>
>
>

	[[alternative HTML version deleted]]

