Convenience Methods for Displaying Genomic Data

genomeview.visualize_data(file_paths, chrom, start, end, reference_path=None, width=900, axis_on_top=False)[source]

Creates a GenomeView document to display the data in the specified files (eg bam, bed, etc).

Parameters:
  • file_paths – this specifies the file paths to be rendered. It must be either a list/tuple of the paths, or a dictionary mapping {track_name:path}. (If you are using a python version prior to 3.6, use collections.ordereddict to ensure the order remains the same.) Currently supports files ending in .bam, .cram, .bed, .bed.gz, .bigbed, or .bigwig (or .bw). Most of these file types require a separate index file to be present (eg a .bam.bai or a .bed.gz.tbi file must exist).
  • chrom – chromosome (or contig) to be rendered
  • start – start coordinate of region to be rendered
  • end – end coordinate of region to be rendered
  • reference_path – path to fasta file specifying reference genomic sequence. This is required in order to display mismatches in bam tracks.
  • width – the pixel width of the document
  • axis_on_top – specifies whether the axis should be added at the bottom (default) or at the top
genomeview.save(doc, outpath, outformat=None)[source]

Saves document doc to a file at outpath. By default, this file will be in SVG format; if it ends with .pdf or .png, or if outformat is specified, the document will be converted to PDF or PNG if possible.

Conversion to PDF and PNG require rsvg-convert (provided by librsvg), inkscape or webkitToPDF (PDF conversion only).

genomeview.doc

the genomeview.Document to be saved

genomeview.outpath

a string specifying the file to save to; file extensions of .pdf or .png will change the default output format

genomeview.outformat

override the file format; must be one of “pdf”, “png”, or (the default) “svg”