Skip to content

AlexandrovLab/TMB_plotter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 

Repository files navigation

License

TMB_plotting_function

plotTMB(inputDF, scale, Yrange = "adapt", cutoff = 1, output = "TMB_plot.pdf")

Usage

  1. inputDF: A panda dataframe containing two columns and however many rows of samples.
Column 1 is the category the sample belongs to. 
Column 2 is the number of mutations in that sample.

Example:

Column1 Column2
Bladder-TCC 25212
Bladder-TCC 31114
Bladder-TCC 36432
  1. scale: The number of base pairs sequenced in each sample.
The options are: 
"exome", which assumes sequencing size of 55 Mb
"genome", which assumes sequencing size of 2800 Mb
"custom", which requires the input to have a 3rd column in the entry that specifies the number of Mbs for each sample to be divded by.
An integer indicating the scale of the sequencing
  1. Yrange: The range of Yaxis.
The options are:
"adapt", which will make the plot automatically adapt to the given datase
"cancer", which will set the range to 0.001 to 1000
A list of two numbers of powers of 10 indicating the Y-axis range. Example: [0.1,100]
  1. cutoff: The minimum number of mutations required in a sample to be included in a plot
defaulted at 1, must be larger than or equal to 0
  1. output: outputfile name
defaulted at "TMB_plot.pdf"
  1. redbar: redbar location
The redbar value can either be "median" or "mean" which is the value at which the red bar appears, default is "median"
  1. yaxis: Whether to show yaxis label or not
Defaulted at False
  1. ascend: Wether to arrange data in ascending order of the height of the redbar
Defaulted at True
  1. leftm: left margin
Defaulted at 1
  1. rightm: right margin
Defaulted at 0.3
  1. topm: top margin
Defaulted at 1
  1. bottomm: bottom margin
Defaulted at 1
  1. filterline: bottom margin
Defaulted at True
Will show the number of samples plotted over the number of samples included. When set to False, the divider and the total nubmer of samples plotted will be removed. It will also be automatically removed if no sample was filtered out

Examples

Exmaple 1: The full PCAWG dataset at default setting

inputDF = pd.read_table('exmapleInput1_pcawg.txt')
plotTMB(inputDF,"genome")

Alt text

Exmaple 2: The full PCAWG dataset with redbar set at mean

inputDF = pd.read_table('exmapleInput1_pcawg.txt',redbar="mean")
plotTMB(inputDF,"genome", readbar = "mean")

Alt text

Exmaple 3: The full PCAWG dataset with decending order

inputDF = pd.read_table('exmapleInput1_pcawg.txt',ascend=False)
plotTMB(inputDF, scale = "genome")

Alt text

Example 4: Subtset of PCAWG dataset with Y axis adapts to input data

inputDF = pd.read_table('exmapleInput2_pcawg_less.txt')
plotTMB(inputDF, scale = "genome", Yrange = "adapt")

Alt text

Example 5: Y axis set for standard cancer TMB range

inputDF = pd.read_table('exmapleInput2_pcawg_less.txt')
plotTMB(inputDF, scale = "genome", Yrange = "cancer")

Alt text

Exmaple 6: Using custome input value for sequencing scale and Y axis range

inputDF = pd.read_table('exmapleInput2_pcawg_less.txt')
plotTMB(inputDF, scale = 2800, Yrange = [0.1,10])

Alt text

Exmaple 7: Using cutoff to remove lower end outliers

inputDF = pd.read_table('exmapleInput3_signature.txt')
plotTMB(inputDF,"genome",cutoff =2)

Alt text

About

Python function for TMB snake plots

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages