Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(
        description=
        "Compute a sample correlation matrix from a matrix of expression values.  Including --probes_csv causes this to only compute correlation values for one probe per gene (the 'median' probe)."
    )
    parser.add_argument('-p', '--probes_csv', help="path to Probes.csv.")
    parser.add_argument('expression_csv',
                        help="path to MicroarrayExpression.csv")
    parser.add_argument('output_npz', help="output .npz file name")

    args = parser.parse_args()

    print "Reading Expression Values"
    values = aibs.read_expression_values(args.expression_csv)

    if args.probes_csv:
        print "Filtering Probes"
        probes, gene_probes = aibs.read_probes(args.probes_csv)
        best_probes = find_best_probes(gene_probes, values)

        best_probe_indices = np.array([p['index'] for p in best_probes])
        values = values[best_probe_indices, :]

        print values.shape

    values = np.transpose(values)

    print "Computing Sample Covariance"
    cov = np.corrcoef(values)

    print "Saving " + args.output_npz
    np.savez(args.output_npz, cov)
def main():
    parser = argparse.ArgumentParser(description="Compute a sample correlation matrix from a matrix of expression values.  Including --probes_csv causes this to only compute correlation values for one probe per gene (the 'median' probe).")
    parser.add_argument('-p','--probes_csv', help="path to Probes.csv.")
    parser.add_argument('expression_csv', help="path to MicroarrayExpression.csv")
    parser.add_argument('output_npz', help="output .npz file name")

    args = parser.parse_args()

    print "Reading Expression Values"
    values = aibs.read_expression_values(args.expression_csv)

    if args.probes_csv:
        print "Filtering Probes"
        probes, gene_probes = aibs.read_probes(args.probes_csv)
        best_probes = find_best_probes(gene_probes, values)
        
        best_probe_indices = np.array([ p['index'] for p in best_probes ])
        values = values[best_probe_indices, :]

        print values.shape

    values = np.transpose(values)
    
    print "Computing Sample Covariance"
    cov = np.corrcoef(values)
    
    print "Saving " + args.output_npz
    np.savez(args.output_npz, cov)
Exemplo n.º 3
0
def main():
    parser = argparse.ArgumentParser(
        description=
        "Create a CSV file that lists one probe (the 'median' probe) for every gene."
    )
    parser.add_argument('probes_csv', help="path to Probes.csv")
    parser.add_argument('expression_csv',
                        help="path to MicroarrayExpression.csv")
    parser.add_argument('output_csv', help="output .csv file name")

    args = parser.parse_args()

    print "Reading Expression Values"
    values = aibs.read_expression_values(args.expression_csv)

    print "Reading Probes"
    probes, gene_probes = aibs.read_probes(args.probes_csv)

    print "Finding Best Probes"
    out_probes = find_best_probes(gene_probes, values)

    print "Writing " + args.output_csv
    with open(args.output_csv, 'w') as outfile:
        print >> outfile, "probe_id,array_index"
        for probe in out_probes:
            print >> outfile, ','.join(
                [probe['probe_id'], str(probe['index'])])
def main():
    parser = argparse.ArgumentParser(description="Create a CSV file that lists one probe (the 'median' probe) for every gene.")
    parser.add_argument('probes_csv', help="path to Probes.csv")
    parser.add_argument('expression_csv', help="path to MicroarrayExpression.csv")
    parser.add_argument('output_csv', help="output .csv file name")

    args = parser.parse_args()

    print "Reading Expression Values"
    values = aibs.read_expression_values(args.expression_csv)

    print "Reading Probes"
    probes, gene_probes = aibs.read_probes(args.probes_csv)

    print "Finding Best Probes"
    out_probes = find_best_probes(gene_probes, values)

    print "Writing " + args.output_csv
    with open(args.output_csv, 'w') as outfile:
        print>>outfile, "probe_id,array_index"
        for probe in out_probes:
            print>>outfile, ','.join([probe['probe_id'], str(probe['index'])])