[Numpy-discussion] how to store variable length string in array and get single char by it's position?
Keith Goodman
kwgoodman at gmail.com
Tue Sep 14 12:33:20 EDT 2010
On Tue, Sep 14, 2010 at 9:25 AM, kee chen <keekychen.shared at gmail.com> wrote:
> Dear All,
>
> Suppose I have a list group some kind like DNA sequence:
>
> 1 ATGCATGCAATTGGCC
> 2 ATGCATGCAATTGGCCATCD
> 3 CATGCAATTGGCCCCCCCCC
> ......
> 100000 CATGCAAATTGGCCCCCCCCC
>
> the string length of each item is not sure and may get change/update later,
> then how can I store above in a numpy array (include the ID) and easy to get
> the single value?
>
> for example
> 1. ATGCATGCAATTGGCC
> I want get the first T then I use something like array[1][1], means
> A[T]G...... and if I want to update the 3rd postion I can use array[1][2]
> = T to set the AT[G]C... to AT[T]C...?
How about using a python list:
>> array = ['ATGC', 'CATGA', 'A']
>> array[0][1]
'T'
More information about the NumPy-Discussion
mailing list