Scripts for Table Manipulation/Transformation


  1. Script to sort a table

    This python script sorts a table by the given header list with the following options.

    Command Line:
    $ python tableRotation.py
    # Select the options: (Default - 0)
    0. Exit
    1. Sort by row
    2. Sort by column
    3. Sort by both row and column
    Your choice is: 3
    # Enter file name to be sorted: Ath_SFP_Scores_0846_Rand.lg1_Shfl.map.loc
    # Enter file name of the sorted row header: example_sorted_list_2_M.txt
    # Enter file name of the sorted column header: example_sorted_list_1_R.txt
    # Enter file name of the output: Ath_SFP_Scores_0846_Sort.out
    # Please provide the following information, ENTER to accept the DEFAULT setting!
    ... Number of lines to skip from start(Default - 0): 1
    ... Real Data starts from line #(Default - 2): 4
    ... Column Headerline locates at line #(Default - 1): 3
    ... Columns/fields are seperated by(Default - TAB):
    ... Add AUTO_INCREMENT value at the first line?(y/n)(Default - n):y
    # Processing ...
    ... Read 212 rows, 149 columns
    ... Write 212 rows, 149 columns
    ... Skip 0 empty rows

    Input file:
    Ath_SFP_Scores_0846_Rand.lg1_Shfl.map.loc
    example_sorted_list_2_M.txt
    example_sorted_list_1_R.txt


    Output file:
    Ath_SFP_Scores_0846_Sort.out

  2. Script to rotate a table

    This script is designed to rotate the row and column of a table, to view a table in different directions

    Command Line:
    $ python tableRotation.py
    #Enter the SOURCE file name: Ath_SFP_Scores_0846_RIL.lg1.map.loc
    # Please provide the following information, ENTER to accept the DEFAULT setting!
    ... Number of lines to skip from start(Default - 0): 1
    ... Columns/fields are seperated by(Default - TAB):
    ... Add AUTO_INCREMENT value at the first line?(y/n)(Default - n):y
    ... Processing ...
    ... Skip 0 empty rows
    ... Read 149 rows, 210 columns
    ... Write 210 rows, 149 columns
    ... Please find output in file "Ath_SFP_Scores_0846_RIL.lg1.map.loc_rotate.out"

    Input file:
    Ath_SFP_Scores_0846_RIL.lg1.map.loc

    Output file:
    Ath_SFP_Scores_0846_RIL.lg1.map.loc_rotate.out




Example Tables for debugging/troubleshooting:

test_table_01.tab
test_table_02.tab
test_table_03.tab

test_list_M_01.tab
test_list_M_02.tab
test_list_R_01.tab
test_list_R_02.tab