hi all,<br> I have problem to sort the data.. the file includes data as follow.<br>file:<br>chrX: 123343123 123343182 A_16_P41787782<br>chrX: 123343417 123343476 A_16_P03762840<br>chrX: 123343460 123343519 A_16_P41787783
<br>chrX: 12334336 12334395 A_16_P03655927<br>chrX: 123343756 123343815 A_16_P03762841<br>chrX: 123343807 123343866 A_16_P41787784<br>chrX: 123343966 123344024 A_16_P21578670<br>chrX: 123344059 123344118 A_16_P21578671
<br>chrX: 12334438 12334497 A_16_P21384637<br>chrX: 123344776 123344828 A_16_P21578672<br>chrX: 123344811 123344870 A_16_P03762842<br>chrX: 123345165 123345224 A_16_P41787789<br>chrX: 123345360 123345419 A_16_P41787790
<br>chrX: 123345380 123345439 A_16_P03762843<br>chrX: 123345481 123345540 A_16_P41787792<br>chrX: 123345873 123345928 A_16_P41787793<br>chrX: 123345891 123345950 A_16_P03762844<br><br><br>
how do is sort the file based on the column 1 and 2 with values......<br>using sort option works for only one column and not for the other how do is sort both 1 and 2nd column so that the third column does not change.....
<br>my script:#sorting the file<br>start_lis = []<br>end_lis = []<br>fh = open('chromosome_location_346010.bed','r')<br>for line in fh.readlines():<br> data = line.strip().split('\t')<br> start = data[1].strip()
<br> end = data[2].strip()<br> probe_id = data[3].strip()<br> start_lis.append(start)<br> end_lis.append(end)<br>start_lis.sort()<br>end_lis.sort()<br>for k in start_lis:<br> for i in end_lis
<br> print k , i , probe_id(this doesnot worK)<br> result = start#end#probe_id ------->this doesnot work...<br> print result<br> <br>What is the error and how do is sort a file based on the two column to get the fourth column also with that.
<br>regards<br>shafreen<br><br><br><br>