Thread: File sampling

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    22
    Rep Power
    0

    File sampling


    Hi all,

    I have an input file (input.txt) in tab separated format.
    A small part of the input file is as follows:

    Gr1 Gr2 Gr3 Gr4 ..............
    row1 1 1 1 0 ..............
    row2 0 1 0 1 ...............
    row3 1 1 0 1 ..............
    ...................
    .................


    From this input,random sampling of all possible Group combinations needed to be taken, and print in a output file.
    From the above input, the output file should be as follows
    (the three columns are: Number of groups used in analysis, Group names, Number shared between these groups;;;
    Shared number are measured if 1 is present in all the measuring groups).

    output:

    2 Gr1-Gr2 2
    2 Gr1-Gr3 1
    2 Gr1-Gr4 1
    2 Gr2-Gr3 1
    2 Gr2-Gr4 2
    2 Gr3-Gr4 0
    3 Gr1-Gr2-Gr3 1
    3 Gr1-Gr2-Gr4 1
    3 Gr1-Gr3-Gr4 0
    3 Gr2-Gr3-Gr4 0
    4 Gr1-Gr2-Gr3-Gr4 0

    Any idea how to do it??? thanks in advance..
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,696
    Rep Power
    480

    Satisfied


    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo