Entering edit mode
6.7 years ago
Grace_G
▴
20
I use Linux, in one path, there is a file named annotation_x.txt
less annotation_x.txt
transcript:ENST00000437963 gene:ENSG00000187634
transcript:ENST00000624431 gene:ENSG00000239906
transcript:ENST00000335137 gene:ENSG00000186092
other python script annotation_x_mod.py to read it in
# coding=UTF-8
annotation_x = [line.split('\t') for line in open('annotation_x.txt')]
python annotation_x_mod.py
[['transcript:ENST00000437963', 'gene:ENSG00000187634\n'], ['transcript:ENST00000624431', 'gene:ENSG00000239906\n'], ['transcript:ENST00000335137','gene:ENSG00000186092\n']]
How to reverse the process after some modification?
Like this simple example,it will become as:
[['transcript:ENST00000437963', '1', 'ENSG00000187634\n'], ['transcript:ENST00000624431', '12', 'ENSG00000239906\n'], ['transcript:ENST00000335137', '23', 'ENSG00000186092\n']]
then, how to return to linux and just shows by rows and cols?
transcript:ENST00000437963 1 ENSG00000187634
transcript:ENST00000624431 12 ENSG00000239906
transcript:ENST00000335137 23 ENSG00000186092
What you also should do in your code is:
Exactly right! Many thanks!
Where did you get these
1, 12, 23
numbers from?Your consideration is very reasonable. But here I just want to shows maybe will add one col or n cols. Actually for my data process I guess I will add some cols so gave example like
1, 12, 23
.