예제 #1
0
    # Report version
    p.print_version()

    # Internal flags
    fix_chromosome_name = True
    correct_stop_position = True

    # Track name, description and output file name
    track_name = os.path.splitext(os.path.basename(infile))[0]
    track_description = track_name
    outfile = os.path.splitext(os.path.basename(infile))[0] + ".bed"
    print "Output file: %s" % outfile

    # Read in data
    data = BedMaker(infile,column_names=('chr','start','stop','strand','transcript',
                                         'fold_change','p_value'))
    
    # Fix chromosome name
    if fix_chromosome_name:
        print "Prepending 'chr' to chromosome names where it's missing"
        prependChromosomeName(data,'chr')

    # Subtract one from end position
    if correct_stop_position:
        print "Correcting 'stop' position by subtracting one base"
        adjustStopPosition(data)

    # Set name and RBG values
    data.computeColumn('name',lambda line: "%s_fc%s" % (line['transcript'],line['fold_change']))
    data.computeColumn('RGB',lambda line: computeRGB(line['p_value']))
    # Report version
    p.print_version()

    # Internal flags
    fix_chromosome_name = True
    correct_stop_position = True

    # Track name, description and output file name
    track_name = os.path.splitext(os.path.basename(infile))[0]
    track_description = track_name
    outfile = os.path.splitext(os.path.basename(infile))[0] + ".bed"
    print "Output file: %s" % outfile

    # Read in data
    data = BedMaker(infile,column_names=('chr','start','stop','sample_id','length',
                                         'average_coverage'))
    
    # Fix chromosome name
    if fix_chromosome_name:
        print "Prepending 'chr' to chromosome names where it's missing"
        prependChromosomeName(data,'chr')

    # Subtract one from end position
    if correct_stop_position:
        print "Correcting 'stop' position by subtracting one base"
        adjustStopPosition(data)

    # Set name, strand, score and RBG values
    data.computeColumn('name',lambda line: "%s_%sbp" % (line['sample_id'],line['length']))
    data.computeColumn('strand',lambda line: "+")
    data.computeColumn('score',lambda line: min(int(line['average_coverage']),1000))