Processing steps for creating the BCaPE database

September 5, 2019 ยท View on GitHub

R scripts for carrying out an analysis of the association between various biomarkers and drug sensitivity measurements are described in this section. The input data files are also described and instructions for creating the SQLite database used by the Shiny app are provided in what follows.

The data used in the BCaPE Shiny app are available on figshare.

R package dependencies

The R processing scripts require the following packages which can be installed using the install.packages function.

  • tidyverse collection of R packages for data science
  • furrr for distributing the processing across multiple CPUs
  • tictoc for timing the processing steps
  • RSQLite SQLite interface for R
  • dbplyr dplyr backend for databases

In addition, the SQLite database engine needs to be installed; this can be checked as follows.

sqlite3 --version

Annotation files

Annotation files for the patient-derived tumour xenografts (PDTX), hereafter referred to as models, and the drugs these were treated with need to be provided. A tabular file containing details of genes assayed is also needed but can be generated from the human gene dataset available from the HUGO Gene Nomenclature Committee (HGNC).

Note that all annotation files are tab-delimited.

ModelClassifications.txt

The model classifications file contains details of the PDTX models including the ER, HER2, PR and BRCA1 status (positive, negative), the type of tumour from which the PDTX was derived (primary, metastatic), and various classifications including the METABRIC integrated cluster, 3-gene and PAM50 classifications described in the BCAPE publication.

An excerpt from this tabular file is given below:

ModelERHER2PRBRCA1TypeiC103-GenePAM50
AB405NegNegNANAMetastaticNANANA
AB521MNegPosNegNAMetastatic10ER-/HER2-Basal
AB551PosPosNegNAMetastatic5HER2+Her2
AB555PosNegNegNAMetastatic1ER+/HER2- High ProlifNC
AB559PosNegNegNAPrimary10ER-/HER2-Basal
AB569PosNegNANAPrimary4ER+NCNA

DrugAnnotations.txt

The drug annotation file contains details of each of the drugs for which sensitivity data is available, specifically the pathways and genes targeted by each drug.

An excerpt from this tab-delimited file is given below:

DrugPathwayTarget
(5Z)-7-OxozeaenolotherTAK1 (MAP3K7)
17-AAGotherHSP90
5-FluorouracilDNA replicationantimetabolite
681640Genome integrity (CHEK)WEE1, CHEK1
ABT-263apoptosis regulationBCL2, BCL-XL, BCL-W
AG-014699Genome integrity (PARP)PARP1, PARP2

GeneDetails.txt

The gene details file uses gene symbols as identifiers for each gene as well as aliases and descriptive gene names. An excerpt is given below:

SymbolAliasesName
A1BGalpha-1-B glycoprotein
A1BG-AS1A1BG-AS, A1BGAS, FLJ23569, NCRNA00181A1BG antisense RNA 1
A1CFACF, ACF64, ACF65, APOBEC1CF, ASPAPOBEC1 complementation factor
A2LD1GGACTgamma-glutamylamine cyclotransferase
A2MCPAMD5, FWP007, S863-7alpha-2-macroglobulin
A2M-AS1A2M antisense RNA 1

This file can be generated from the complete HGNC dataset with the create_gene_details.R R script.

wget ftp://ftp.ebi.ac.uk/pub/databases/genenames/new/tsv/hgnc_complete_set.txt

Rscript create_gene_details.R

Assay data files

The BCaPE resource consists of drug sensitivity measurements and data from high-throughput sequencing to detect single nucleotide variants and copy number states and to measure levels of expression and methylation for all genes.

Details of how these data were generated are given in the BCAPE publication. An excerpt from each file is given below.

DrugResponsesAUCModels.txt

ModelDrugAUCiC50D1_CONCD5_CONCperc.iC50
HCI001(5Z)-7-Oxozeaenol0.2185.4837.7012.33871.507
HCI00117-AAG0.30218349.74110.004183.038
HCI0015-Fluorouracil0.4941.350200.07851.391
HCI0016816400.103152.12620.008150.681
HCI001ABT-2630.4970.12520.00849.591
HCI001AG-0146990.23518.22750.020123.326

SNVsModels.txt

Mutations detected within genes in each PDTX model should also be provided in a tabular format as shown below. The first column contains contains genes and all subsequent columns contain details of mutations for each PDTX model.

GeneAB521MAB551AB555AB559AB580
AGBL5chr2:27278923_G/A_nonsynonymous SNVNONONONO
ALAS1chr3:52248142_A/ATGGTATTTTTGGTCCTTGAGGAACCACC_frameshift substitutionNONONONO
APODchr3:195306268_G/A_nonsynonymous SNVNONONONO
B4GALT2chr1:44447006_TAGC/T_nonframeshift substitutionNONOchr1:44447006_TAGC/T_nonframeshift substitutionNO
BNIP3Lchr8:26240683_CACA/C_nonframeshift substitutionNONONONO
CACNA1FchrX:49066446_G/A_nonsynonymous SNVNONONONO

The format expected for mutations is as follows.

Chromosome:Position_ReferenceAllele/AlternateAllele_Type

where everything after the type of mutation is ignored. The ':', '/' and '_' characters are used to separate the mutation string into its chromosome, position, reference and alternate allele constituents.

Multiple mutations identified within a gene can be listed and need to be separated by '//', e.g.

shr13:108518706_TGCTGCTGCC/T_nonframeshift substitution//chr13:108518727_T/C_nonsynonymous SNV

If a gene is not mutated within a given model a value of 'NO' should be given.

CNAModels.txt

Copy number states for each gene within each model should be provided in a tabular format as shown below. The first column contains contains genes and all subsequent columns contain copy number states for each PDTX model.

GeneAB521MAB551AB555AB559AB580
DDX11L1NANANANANA
WASH7PNANANANANA
MIR6859-1LOSSLOSSUNKNOWNUNKNOWNGAIN
MIR6859-2LOSSLOSSUNKNOWNUNKNOWNGAIN
FAM138ANANANANANA
FAM138FNANANANANA

Valid values for copy number states are GAIN, LOSS, NEUTRAL (or NEUT), UNKNOWN and NA.

ExpressionModels.txt

Normalized log2-transformed expression values should be provided in a tabular format as shown below. The first column contains contains genes and all subsequent columns contain expression values for each PDTX model.

GeneAB521MAB551AB555AB559AB580
A1BG5.8625.8315.9895.9535.928
A1CF5.8185.9655.9096.0096.063
A2LD17.6866.9317.0377.1706.208
A2M5.5725.7525.58910.1235.522
A3GALT25.8735.8575.9655.8375.827
A4GALT5.8335.6856.5638.2225.593

PromoterMethylationModels.txt

Methylation values should also be provided in a similar tabular format with the first column specifying the gene and subsequent columns for each PDTX model. Values are % promoter methylation within the gene for a given model.

GeneAB521MAB555AB559AB564AB572
A1BG70.12570.10452.50082.31456.986
A1BG-AS176.42680.02669.42384.73077.039
A1CFNANANANANA
A2MNANANANANA
A2M-AS112.27818.1481.13628.2923.077
A2ML127.64350.14050.35759.10153.488

Sensitivity analysis

This section describes how to run the R scripts that carry out an analysis of the effect of a given alteration (copy number gain or loss, mutation) or the level of gene expression or promoter methylation on the sensitivity of the drugs tested on the PDTX models.

In the case of mutations, t-tests were carried out for each drug and gene combination, comparing the sensitivity of the drug within PDTX models with a mutation in that gene with those models where the gene is not mutated.

Similarly, t-tests were carried out to test the effect of copy number gains (gain versus no gain) and copy number losses (loss versus no loss) for each gene on the sensitivity of models to a given drug.

A linear model was fitted to the expression levels of a gene and the sensitivity of the models to a given drug, for every drug and gene combination. The effect size is the slope of the line fitted and the p-value tests the null hypothesis that the slope is equal to zero, i.e. no effect.

The same approach of fitting a linear model is applied to the methylation data.

In each of the above analyses, p-values are adjusted for multiple comparisons using the Benjamini and Hochberg method (p.adjust function with the "BH" method argument).

The R scripts for carrying out the above sensitivity analyses are run as follows, creating output files ending with the suffix Sensitivity.txt.

Rscript mutation_sensitivity.R DrugResponsesAUCModels.txt SNVsModels.txt MutationSensitivity.txt

Rscript copy_number_gain_sensitivity.R DrugResponsesAUCModels.txt CNAModels.txt CopyNumberGainSensitivity.txt

Rscript copy_number_loss_sensitivity.R DrugResponsesAUCModels.txt CNAModels.txt CopyNumberLossSensitivity.txt

Rscript expression_sensitivity.R DrugResponsesAUCModels.txt ExpressionModels.txt ExpressionSensitivity.txt

Rscript methylation_sensitivity.R DrugResponsesAUCModels.txt PromoterMethylationModels.txt MethylationSensitivity.txt

A large number of t-tests or linear regressions are carried out by these scripts and the computational work is distributed across multiple CPUs or cores using the R furrr package which in turn uses the futures package in its parallelized versions of the dplyr map functions. By default these scripts will use the maximum number of cores available. This works well on a HPC cluster where the number of cores allocated to a task is specified when that task is submitted via the job scheduler; the script then will pick up the number of cores so allocated as the number available to it and distribute the computational work accordingly. Otherwise, when running on a multi-core machine the number of cores can be limited so not to overload the computer by setting the MC_CORES environment variable, e.g.

MC_CORES=2 Rscript expression_sensitivity.R DrugResponsesAUCModels.txt ExpressionModels.txt ExpressionSensitivity.txt

The outputs from these sensitivity analyses are tab-delimited files with a row for each Gene and Drug pairing with t-statistics or slope coefficients from fitted linear models, p-values and false discovery rate (FDR) adjusted p-values. An excerpt from the output of the mutation sensitivity analysis is given below.

MutationSensitivity.txt

GeneDrugt.statisticp.valuemean.mutationn.mutationmean.nomutationn.nomutationfdr
PIK3CAJNK Inhibitor VIII-0.3060.7740.060540.0536150.975
PIK3CAJQ10.6480.5390.16140.192150.946
PIK3CAKU-559336.59.43e-60.10240.219150.00286
PIK3CALenalidomide0.160.8770.03840.0397150.983
PIK3CALY3176152.640.02170.026720.112120.245
PIK3CAMK-2206-2.30.03590.43240.305150.314

Multiple testing correction for copy number states

Tests for the effect of copy number state of genes on the sensitivity to a drug in a given PDTX model are applied separately for copy number gains and losses. Similarly the correction for multiple correction is applied for gains and losses separately but this correction can be re-applied taking into account both gains and losses together using the recalculate_copy_number_sensitivity_fdr.R script.

Rscript recalculate_copy_number_sensitivity_fdr.R

This creates files named CopyNumberGainSensitivity.adjusted.txt and CopyNumberLossSensitivity.adjusted.txt with updated FDR values.

Creating the SQLite database

The R script create_sqlite_database.R reads in all the aforementioned annotation and data files, and the outputs of the sensitivity analyses described above, and creates a SQLite database file called bcape.sqlite that is used by the Shiny app.

Rscript create_sqlite_database.R

This database is designed for use by the BCaPE Shiny app but can be accessed and queried using using SQLite at the command line as shown below.

$ sqlite3 bcape.sqlite

SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.

sqlite> .tables

copyNumberGainSensitivity  geneDetails
copyNumberLossSensitivity  methylation
copyNumberStates           methylationSensitivity
drugAnnotations            modelClassifications
drugSensitivity            mutationSensitivity
expression                 mutations
expressionSensitivity

sqlite> .schema copyNumberStates

CREATE TABLE `copyNumberStates` (
  `Gene` TEXT,
  `Model` TEXT,
  `State` TEXT
);
CREATE INDEX `copyNumberStates_Gene` ON `copyNumberStates` (`Gene`);
CREATE INDEX `copyNumberStates_Model` ON `copyNumberStates` (`Model`);

sqlite> select * from copyNumberStates limit 10;

MIR6859-1|AB521M|loss
MIR6859-2|AB521M|loss
LINC01002|AB521M|unknown
LOC100132287|AB521M|unknown
LOC100133331|AB521M|unknown
OR4F16|AB521M|unknown
OR4F29|AB521M|unknown
OR4F3|AB521M|unknown
RNU6-2|AB521M|unknown
KLHL17|AB521M|loss

sqlite> .quit