pycallingcards.plotting.draw_area#
- pycallingcards.plotting.draw_area(chromosome, start, end, extend, peaks, insertions, reference, background=None, adata=None, name=None, key=None, insertionkey=None, figsize=(10, 3), plotsize=[1, 1, 2], bins=None, color='red', color_cc=None, color_peak=None, color_genes=None, color_background='lightgray', title=None, example_length=10000, peak_line=1, font_size=1, name_insertion1='Experiment Insertions', name_insertion2='Backgound Insertions', name_density1='Experiment Insertion Density', name_density2='Backgound Insertion Density', save=False)[source]#
Plot the specific area of the genome. This plot contains three sections. The top section is a plot of insertions plot: one dot is one insertion and the height is log(reads + 1). The middle section is the distribution plot of insertions. If backgound is the input, the colored one would be the experiment inerstions/distribution and the grey one would be the backgound one. If backgound is not the input and adata/name/key is provided, the colored one would be the inerstions/distribution for specific group and the grey one would be the whole data. The bottom section composes of reference genes and peaks.
- Parameters:
chromosome (
str
) – The chromosome plotted.start (
int
) – The start point of middle area. Usually, it’s the start point of a peak.end (
int
) – The end point of middle area. Usually, it’s the end point of a peak.extend (
int
) – The extend length (bp) to plot.peaks (
DataFrame
) – pd.Dataframe of peaksinsertions (
DataFrame
) – pd.Datadrame of qbedreference (
Union
[str
,DataFrame
]) – ‘hg38’, ‘mm10’, ‘sacCer3’ or pd.DataFrame of the reference data.background (
Optional
[DataFrame
] (default:None
)) – pd.DataFrame of qbed or None.adata (
Optional
[AnnData
] (default:None
)) – Input along with name and key. It will only show the insertions when the key of adata is name.name (
Optional
[str
] (default:None
)) – Input along with adata and key. It will only show the insertions when the key of adata is name.key (
Optional
[str
] (default:None
)) – Input along with adata and name. It will only show the insertions when the key of adata is name.insertionkey (
Optional
[str
] (default:None
)) – Input along with adata and name. It will find the column insertionkey of the insertions file.figsize (
Tuple
[int
,int
] (default:(10, 3)
)) – The size of the figure.plotsize (
list
(default:[1, 1, 2]
)) – The relative size of the dot plot, distribution plot and the peak plot.bins (
Optional
[int
] (default:None
)) – The bins of histogram. It will automatically calculate if None.color (
Optional
[Literal
['blue'
,'red'
,'green'
,'pruple'
]] (default:'red'
)) – [‘blue’,’red’,’green’,’pruple’]. The color of the plot. If color is not a valid color, color_cc, color_peak, and color_genes should be utilized.color_cc (
Optional
[str
] (default:None
)) – The color of qbed insertions. Used only when color is not a valid color.color_peak (
Optional
[str
] (default:None
)) – The color of peaks. Used only when color is not a valid color.color_genes (
Optional
[str
] (default:None
)) – The color of genes. Used only when color is not a valid color.color_background (
str
(default:'lightgray'
)) – The color of background.title (
Optional
[str
] (default:None
)) – The title of the plot.example_length (
int
(default:10000
)) – The length of example.peak_line (
int
(default:1
)) – The total number of peak lines.font_size (
int
(default:1
)) – The relative font of the words on the plot.name_insertion1 (
str
(default:'Experiment Insertions'
)) – The name for the top insertion part.name_insertion2 (
str
(default:'Backgound Insertions'
)) – The name for the bottom insertion part.name_density1 (
str
(default:'Experiment Insertion Density'
)) – The name for the top density part.name_density2 (
str
(default:'Backgound Insertion Density'
)) – The name for the bottom density part.save (
Union
[bool
,str
] (default:False
)) – Could be bool or str indicating the file name It will be saved as. If True, a default name would be given and the plot would be saved as a png file.
- Example:
>>> import pycallingcards as cc >>> qbed_data = cc.datasets.mousecortex_data(data="qbed") >>> peak_data = cc.pp.callpeaks(qbed_data, method = "CCcaller", reference = "mm10", record = True) >>> adata_cc = cc.datasets.mousecortex_data(data="CC") >>> cc.pl.draw_area("chr12",50102917,50124960,400000,peak_data,qbed_data,"mm10",adata_cc,"Neuron_Excit",'cluster',figsize = (30,6),peak_line = 4,color = "red")