coalispr.bedgraph_analyze.tracks

This module produces annotation tracks to display with bedgraph plots.

Attributes

Classes

Track

A class to represent a track of segments.

SegmentTrack

A class to represent a track of countable segments.

GTFtrack

A Track class to represent a track with annotation info from a GTF file.

Functions

ref_at_clickpoint(chrnam, clickp, kind)

Get reference label for segment with clickpoint.

ref_in_segment(chrnam, segm, kind, ref)

Get reference labels for segment.

Module Contents

coalispr.bedgraph_analyze.tracks.logger
class coalispr.bedgraph_analyze.tracks.Track(chrnam)

A class to represent a track of segments.

A track provides input for a matplotlib.collections.PolyCollection (formerly matplotlib.collections.BrokenBarHCollection) used in coalispr.bedgraph_analyze.bedgraph_plotting.

chrnam

The name of the chromosome for which the track is made

Type:

str

df1, df2

Tuple of pandas dataframes, for strand 1 (PLUS) and strand 2 (MINUS).

Type:

pandas.DataFrame, pandas.DataFrame

df

Pandas dataframe, used for obtaining segment information.

Type:

pandas.DataFrame

chrnam
df = None
textlist(clickp)

Show list of information for regions under the cursor.

Parameters:

clickp (int) – X-coordinate of point under cursor; registered after mouse-click.

Returns:

List of information associated with segments under the cursor.

Return type:

list

get_segments(df)

Return list of segments with information that form the track.

Parameters:

df (pandas.DataFrame) – A pandas dataframe with segment information

Returns:

List of lower boundaries and length of segments, parseable by matplotlib.collections.BrokenBarHCollection.

Return type:

list

get_ctext(clickp)

Decribe (first) region under the cursor after clicking (if any).

Parameters:

clickp (int) – X-coordinate of point under cursor; registered after mouse-click.

Returns:

Text associated with first entry of listed regions under cursor.

Return type:

str

class coalispr.bedgraph_analyze.tracks.SegmentTrack(chrnam, tag)

Bases: Track

A class to represent a track of countable segments.

chrnam

The name of the chromosome for which the track is made

Type:

str

tag

Kind of data (TAGCOLL or TAGUNCOLL) to annotate.

Type:

str

dfs, dfa

Tuple of pandas dataframes, for strand 1 (plus) and strand 2 (minus).

Type:

pandas.DataFrame, pandas.DataFrame

df

Pandas dataframe, used for obtaining segment information.

Type:

pandas.DataFrame

tag
df
textlist(clickp)

Show list of information for regions under the cursor.

Parameters:

clickp (int) – X-coordinate of point under cursor; registered after mouse-click.

Returns:

List of information associated with segments under the cursor.

Return type:

list

class coalispr.bedgraph_analyze.tracks.GTFtrack(chrnam, kind, strand)

Bases: Track

A Track class to represent a track with annotation info from a GTF file.

kind

The kind of GTF information, for reference, or regions with SPECIFIC or UNSPECIFIC reads.

Type:

str

strand

The strand with the segment the annotation refers to.

Type:

str

kind
strand
textlist(clickp)

Get list of information for regions under the cursor.

Method overwrites that of parent, using another function.

Parameters:

clickp (int) – X-coordinate of point under cursor; registered after mouse-click.

Returns:

List of information associated with segments under the cursor.

Return type:

list

coalispr.bedgraph_analyze.tracks.ref_at_clickpoint(chrnam, clickp, kind)

Get reference label for segment with clickpoint.

Parameters:
  • chrnam (str) – The name of the chromosome for which GTF info is retrieved.

  • clickp (int) – The click point of the segment under the cursor.

  • kind (str) – The kind of specified reads for which a GTF could be prepared: (SPECIFIC, UNSPECIFIC, REFERENCE)

Returns:

Lists with gene_id’s from the GTF described by kind; one list for each strand of chromosome chrnam,

Return type:

tuple of lists

coalispr.bedgraph_analyze.tracks.ref_in_segment(chrnam, segm, kind, ref)

Get reference labels for segment.

Parameters:
  • chrnam (str) – The name of the chromosome for which GTF info is retrieved.

  • segm ((int,int)) – The segment to check.

  • kind (str) – The kind of specified reads for which a GTF could be prepared: (SPECIFIC, UNSPECIFIC)

  • ref (bool) – Include general REFERENCE GTF for annotations (slow). 0: No; 1: Yes.

Returns:

Lists with gene_id’s from the GTF described by kind; one list for each strand of chromosome chrnam.

Return type:

tuple of lists