[Tutor] nested list help
Suppose i have this nested list: >>> x [['NM100', 3, 4, 5, 6, 7], ['NM100', 10, 11, 12, 13], ['NM200', 15, 16, 17]] >>> for i in x: ... print i ... ['NM100', 3, 4, 5, 6, 7] ['NM100', 10, 11, 12, 13] ['NM200', 15, 16, 17] >>> how do i obtain from the above the following nested list: >>> z [['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13], ['NM200', 15, 16, 17]] >>> for i in z: ... print i ... ['NM100', 3, 4, 5, 6, 7, 10, 11, 12, 13] ['NM200', 15, 16, 17] >>> ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] string to list
Suppose i have this string: z = 'AT/CG' How do i get this list: zlist = ['A','T/C','G'] ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] python hyperlinks question
I have a bunch of symbols in one of the columns in my program's output file (a csv file which can be opened in excel). I wish to add hyperlinks to each entry in this particular column in my output file. A sample symbol/entry in the specific column of interest in the output file is USP8 and it needs to be hyperlinked to http://www.ncbi.nlm.nih.gov/gene/9101. (So, when you click on 'USP8' in the output file, your browser automatically opens the site http://www.ncbi.nlm.nih.gov/gene/9101). Could you please tell me how to add hyperlinks to my output? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] reading very large files
I wish to read a large data file (file size is around 1.8 MB) and manipulate the data in this file. Just reading and writing the first 500 lines of this file is causing a problem. I wrote: fin = open('gene-GS00471-DNA_B01_ 1101_37-ASM.tsv') count = 0 for i in fin.readlines(): print i count += 1 if count >= 500: break and got this error msg: Traceback (most recent call last): File "H:\genome_4_omics_study\GS03696-DID\GS00471-DNA_B01_1101_37-ASM\GS00471-DNA_B01\ASM\gene-GS00471-DNA_B01_1101_37-ASM.tsv\test.py", line 3, in for i in fin.readlines(): MemoryError --- is there a way to stop python from slurping all the file contents at once? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] nested list query
Suppose i have the following nested list: >>> x [['19600894', '1', 'chr15_76136768', 'MISSENSE'], ['19600894', '2', 'chr15_76136768', 'MISSENSE'], ['18467762', '1', 'chr14_23354066', 'MISSENSE']] How do i obtain from nested list x (given above), the following nested list z: >>> z [['chr15_76136768', 'MISSENSE'], ['chr14_23354066', 'MISSENSE']] -- In other words, if the third element of an element of x is the same, then i wish to combine it into a single element. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor