On 30/10/14 08:32, [email protected] wrote:
Sorry for my bad presentation of my problem!!
Thats OK, and this explanation is much better, thanks.
A file with a long liste of gene ad the occurence for sample:
gene Samples
FUS SampleA
TP53 SampleA
ATF4 SampleB
ATF3 SampleC
ATF4 SampleD
FUS SampleE
WHat I want to obtain is amtrix where I have the occurence for sample.
SampleA SampleB SampleC SampleD SampleE
FUS 1 0 0 0 1
TP53 1 0 0 0 0
ATF4 0 1 1 0
ATF3 0 0 1 0 0
In that way I count count the occurence in fast way!
You probably want a dictionary keyed on the gene and
with a list of samples as the value.
Using the data above the final result would be
data = {
'FUS' : [1,0,0,0,1]
'TP53' : [1,0,0,0,0]
'ATF4' : [0,1,0,1,0]
'ATF3' : [0,0,1,0,0]
You would need to initialise each entry to all zeros when you create it.
Then overwrite the sample positions as you discover them.
PS.
When replying to a digest please remove the irrelevant material
from the end of your post. Some people pay by the byte to
receive mail.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor