def combinePlinkBinaryFiles(prefixes, outPrefix):
    """Combine Plink binary files.

    :param prefixes: a list of the prefix of the files that need to be
                     combined.
    :param outPrefix: the prefix of the output file (the combined file).

    :type prefixes: list
    :type outPrefix: str

    It uses Plink to merge a list of binary files (which is a list of prefixes
    (strings)), and create the final data set which as ``outPrefix`` as the
    prefix.

    """
    # The first file is the bfile, the others are the ones to merge
    outputFile = None
    try:
        outputFile = open(outPrefix + ".files_to_merge", "w")
    except IOError:
        msg = "%(outPrefix)s.filesToMerge: can't write file" % locals()
        raise ProgramError(msg)

    for prefix in prefixes[1:]:
        print >>outputFile, " ".join([
            prefix + i for i in [".bed", ".bim", ".fam"]
        ])

    # Closing the output files
    outputFile.close()

    # Runing plink
    plinkCommand = ["plink", "--noweb", "--bfile", prefixes[0],
                    "--merge-list", outPrefix + ".files_to_merge",
                    "--make-bed", "--out", outPrefix]
    runCommand(plinkCommand)
def combinePlinkBinaryFiles ( prefixes , outPrefix ) : outputFile = None try : outputFile = open ( outPrefix + ".files_to_merge" , "w" ) except IOError : msg = "%(outPrefix)s.filesToMerge: can't write file" % locals ( ) raise ProgramError ( msg ) for prefix in prefixes [ 1 : ] : print >> outputFile , " " . join ( [ prefix + i for i in [ ".bed" , ".bim" , ".fam" ] ] ) outputFile . close ( ) plinkCommand = [ "plink" , "--noweb" , "--bfile" , prefixes [ 0 ] , "--merge-list" , outPrefix + ".files_to_merge" , "--make-bed" , "--out" , outPrefix ] runCommand ( plinkCommand )
Combine Plink binary files.

    :param prefixes: a list of the prefix of the files that need to be
                     combined.
    :param outPrefix: the prefix of the output file (the combined file).

    :type prefixes: list
    :type outPrefix: str

    It uses Plink to merge a list of binary files (which is a list of prefixes
    (strings)), and create the final data set which as ``outPrefix`` as the
    prefix.