コード例 #1
0
    def test3(self):
        '''some special properties'''
        palette = [
            colors.CMYKColorSep(0.6, 0.34, 0, 0.1, spotName='625C', density=1),
            colors.CMYKColorSep(0.13,
                                0.51,
                                0.87,
                                0.48,
                                spotName='464c',
                                density=1),
        ]
        canv = canvas.Canvas(
            'test_pdfgen_general_spots.pdf',
            pagesize=(346, 102),
        )

        canv.setLineWidth(1)
        canv.setStrokeColor(colors.CMYKColor(0, 0, 0, 1))
        x = 10
        y = 10
        for c in palette:
            c.density = 1.0
            canv.setFillColor(c)
            canv.setFont('Helvetica', 20)
            canv.drawString(x, 80, 'This is %s' % c.spotName)
            canv.setFont('Helvetica', 6)
            canv.rect(x, y, 50, 50, fill=1)
            canv.setFillColor(c.clone(density=0.5))
            canv.rect(x + 55, y, 20, 20, fill=1)
            canv.setFillColor(colors.CMYKColor(0, 0, 1, 0))
            canv.rect(x + 80, y, 30, 30, fill=1)
            canv.rect(x + 120, y, 30, 30, fill=1)
            alpha = c is palette[0] and 1 or 0.5
            op = c is palette[0] and True or False
            canv.setFillAlpha(alpha)
            canv.setFillColor(colors.CMYKColor(1, 0, 0, 0))
            canv.drawString(x + 80 + 1, y + 3, 'OP=%d' % int(False))
            canv.drawString(x + 80 + 1, y + 23, 'Alpha=%.1f' % alpha)
            canv.rect(x + 90, y + 10, 10, 10, fill=1)
            canv.setFillOverprint(op)
            canv.drawString(x + 120 + 1, y + 3, 'OP=%d' % int(op))
            canv.drawString(x + 120 + 1, y + 23, 'Alpha=%.1f' % alpha)
            canv.rect(x + 130, y + 10, 10, 10, fill=1)
            canv.setFillAlpha(1)
            canv.setFillOverprint(False)
            x += canv._pagesize[0] * 0.5
        canv.showPage()
        canv.save()
コード例 #2
0
                SeqFeature(FeatureLocation(centromeres[j][1],
                                           centromeres[j][2],
                                           strand=direc),
                           type='gene',
                           id=j,
                           qualifiers={'locus_tag': [centromeres[j][4]]}))

## telomere length - rounded ends of chromosome size
max_len = max(lengths)
telomere_length = 40000

chr_diagram = BasicChromosome.Organism()
#chr_diagram.page_size = (60*cm, 21*cm)
chr_diagram.page_size = (40 * cm, 21 * cm)

fill = colours.CMYKColorSep(0.4, 0, 0, 0.3, density=0.4, spotName='PMS_7496')

for index, (name, length) in enumerate(entries):
    if length > 80000:
        features = []
        for i in acclis1:
            for f in genome[name].features:
                if f.id == i:
                    f.qualifiers['color'] = [2]
                    features += [f]
        for i in cent_list:
            for f in genome[name].features:
                if f.id == i:
                    f.qualifiers['color'] = ["grey"]
                    features += [f]
        if len(sys.argv) == 4: