In [1]:
import NotebookImport
from TCGA_analysis_BRCA_import import *
import matplotlib.pyplot
from IPython.display import HTML
In [2]:
# 1) check hormone receptor status of MYC focally amplified and MYC negative samples
MYC_amp_er_pos = 0
MYC_amp_er_neg = 0
MYC_amp_pr_pos = 0
MYC_amp_pr_neg = 0
MYC_amp_her2_pos = 0
MYC_amp_her2_neg = 0
MYC_no_amp_er_pos = 0
MYC_no_amp_er_neg = 0
MYC_no_amp_pr_pos = 0
MYC_no_amp_pr_neg = 0
MYC_no_amp_her2_pos = 0
MYC_no_amp_her2_neg = 0
for sample in samples.values():
if not sample.clinical:
continue
if sample.checkFocalGeneAmp("MYC") and not sample.checkFocalGeneAmp("CCND1"):
if sample.er_status == "positive":
MYC_amp_er_pos += 1
if sample.er_status == "negative":
MYC_amp_er_neg += 1
if sample.pr_status == "positive":
MYC_amp_pr_pos += 1
if sample.pr_status == "negative":
MYC_amp_pr_neg += 1
if sample.her2_status == "positive":
MYC_amp_her2_pos += 1
if sample.her2_status == "negative":
MYC_amp_her2_neg += 1
if not sample.checkFocalGeneAmp("MYC"):
if sample.er_status == "positive":
MYC_no_amp_er_pos += 1
if sample.er_status == "negative":
MYC_no_amp_er_neg += 1
if sample.pr_status == "positive":
MYC_no_amp_pr_pos += 1
if sample.pr_status == "negative":
MYC_no_amp_pr_neg += 1
if sample.her2_status == "positive":
MYC_no_amp_her2_pos += 1
if sample.her2_status == "negative":
MYC_no_amp_her2_neg += 1
oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[MYC_amp_er_pos, MYC_amp_er_neg], [MYC_no_amp_er_pos, MYC_no_amp_er_neg]])
oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[MYC_amp_pr_pos, MYC_amp_pr_neg], [MYC_no_amp_pr_pos, MYC_no_amp_pr_neg]])
oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[MYC_amp_her2_pos, MYC_amp_her2_neg], [MYC_no_amp_her2_pos, MYC_no_amp_her2_neg]])
print ""
print " 1) check hormone receptor status of MYC focally amplified and MYC negative samples"
print " Estrogen receptor:"
print " - Positive:"
print " -MYC amplified: "+str(MYC_amp_er_pos)
print " -MYC not amplified: "+str(MYC_no_amp_er_pos)
print " - Negative:"
print " -MYC amplified: "+str(MYC_amp_er_neg)
print " -MYC not amplified: "+str(MYC_no_amp_er_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_er)
print " -p-value: "+str(pvalue_er)
print " Progesteron receptor:"
print " - Positive:"
print " -MYC amplified: "+str(MYC_amp_pr_pos)
print " -MYC not amplified: "+str(MYC_no_amp_pr_pos)
print " - Negative:"
print " -MYC amplified: "+str(MYC_amp_pr_neg)
print " -MYC not amplified: "+str(MYC_no_amp_pr_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_pr)
print " -p-value: "+str(pvalue_pr)
print " HER2:"
print " - Positive:"
print " -MYC amplified: "+str(MYC_amp_her2_pos)
print " -MYC not amplified: "+str(MYC_no_amp_her2_pos)
print " - Negative:"
print " -MYC amplified: "+str(MYC_amp_her2_neg)
print " -MYC not amplified: "+str(MYC_no_amp_her2_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_her2)
print " -p-value: "+str(pvalue_her2)
In [3]:
# 2 check hormone receptor status of MYC samples with copynumber > 4 and MYC negative samples
MYC_amp_er_pos = 0
MYC_amp_er_neg = 0
MYC_amp_pr_pos = 0
MYC_amp_pr_neg = 0
MYC_amp_her2_pos = 0
MYC_amp_her2_neg = 0
MYC_no_amp_er_pos = 0
MYC_no_amp_er_neg = 0
MYC_no_amp_pr_pos = 0
MYC_no_amp_pr_neg = 0
MYC_no_amp_her2_pos = 0
MYC_no_amp_her2_neg = 0
for sample in samples.values():
if not sample.clinical:
continue
copynumber_MYC = "n/a"
log2_MYC = sample.getLog2FromGene(gene_positions['MYC'].chrom,gene_positions['MYC'].start, gene_positions['MYC'].end)
if (log2_MYC != None):
copynumber_MYC = 2.0 * 2.0 ** log2_MYC
else:
copynumber_MYC="n/a"
if copynumber_MYC != "n/a" and copynumber_MYC > 4:
if sample.er_status == "positive":
MYC_amp_er_pos += 1
if sample.er_status == "negative":
MYC_amp_er_neg += 1
if sample.pr_status == "positive":
MYC_amp_pr_pos += 1
if sample.pr_status == "negative":
MYC_amp_pr_neg += 1
if sample.her2_status == "positive":
MYC_amp_her2_pos += 1
if sample.her2_status == "negative":
MYC_amp_her2_neg += 1
if copynumber_MYC != "n/a" and copynumber_MYC < 4:
if sample.er_status == "positive":
MYC_no_amp_er_pos += 1
if sample.er_status == "negative":
MYC_no_amp_er_neg += 1
if sample.pr_status == "positive":
MYC_no_amp_pr_pos += 1
if sample.pr_status == "negative":
MYC_no_amp_pr_neg += 1
if sample.her2_status == "positive":
MYC_no_amp_her2_pos += 1
if sample.her2_status == "negative":
MYC_no_amp_her2_neg += 1
oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[MYC_amp_er_pos, MYC_amp_er_neg], [MYC_no_amp_er_pos, MYC_no_amp_er_neg]])
oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[MYC_amp_pr_pos, MYC_amp_pr_neg], [MYC_no_amp_pr_pos, MYC_no_amp_pr_neg]])
oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[MYC_amp_her2_pos, MYC_amp_her2_neg], [MYC_no_amp_her2_pos, MYC_no_amp_her2_neg]])
print ""
print " 2) check hormone receptor status of MYC CN>4 samples and samples having MYC CN<4"
print " Estrogen receptor:"
print " - Positive:"
print " -MYC CN>4: "+str(MYC_amp_er_pos)
print " -MYC CN<4: "+str(MYC_no_amp_er_pos)
print " - Negative:"
print " -MYC CN>4: "+str(MYC_amp_er_neg)
print " -MYC CN<4: "+str(MYC_no_amp_er_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_er)
print " -p-value: "+str(pvalue_er)
print " Progesteron receptor:"
print " - Positive:"
print " -MYC CN>4: "+str(MYC_amp_pr_pos)
print " -MYC CN<4: "+str(MYC_no_amp_pr_pos)
print " - Negative:"
print " -MYC CN>4: "+str(MYC_amp_pr_neg)
print " -MYC CN<4: "+str(MYC_no_amp_pr_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_pr)
print " -p-value: "+str(pvalue_pr)
print " HER2:"
print " - Positive:"
print " -MYC CN>4: "+str(MYC_amp_her2_pos)
print " -MYC CN<4: "+str(MYC_no_amp_her2_pos)
print " - Negative:"
print " -MYC CN>4: "+str(MYC_amp_her2_neg)
print " -MYC CN<4: "+str(MYC_no_amp_her2_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_her2)
print " -p-value: "+str(pvalue_her2)
In [9]:
# 2 check hormone receptor status of MYC samples with copynumber > 4 and MYC negative samples
MYC_amp_TP53_mut_er_pos = 0
MYC_amp_TP53_mut_er_neg = 0
MYC_amp_TP53_mut_pr_pos = 0
MYC_amp_TP53_mut_pr_neg = 0
MYC_amp_TP53_mut_her2_pos = 0
MYC_amp_TP53_mut_her2_neg = 0
MYC_amp_TP53_wt_er_pos = 0
MYC_amp_TP53_wt_er_neg = 0
MYC_amp_TP53_wt_pr_pos = 0
MYC_amp_TP53_wt_pr_neg = 0
MYC_amp_TP53_wt_her2_pos = 0
MYC_amp_TP53_wt_her2_neg = 0
for sample in samples.values():
if not sample.clinical:
continue
if not sample.somatic_mutation_data:
continue
copynumber_MYC = "n/a"
log2_MYC = sample.getLog2FromGene(gene_positions['MYC'].chrom,gene_positions['MYC'].start, gene_positions['MYC'].end)
if (log2_MYC != None):
copynumber_MYC = 2.0 * 2.0 ** log2_MYC
else:
copynumber_MYC="n/a"
if copynumber_MYC != "n/a" and copynumber_MYC > 4 and "TP53" in sample.genes_affected:
if sample.er_status == "positive":
MYC_amp_TP53_mut_er_pos += 1
if sample.er_status == "negative":
MYC_amp_TP53_mut_er_neg += 1
if sample.pr_status == "positive":
MYC_amp_TP53_mut_pr_pos += 1
if sample.pr_status == "negative":
MYC_amp_TP53_mut_pr_neg += 1
if sample.her2_status == "positive":
MYC_amp_TP53_mut_her2_pos += 1
if sample.her2_status == "negative":
MYC_amp_TP53_mut_her2_neg += 1
if copynumber_MYC != "n/a" and copynumber_MYC > 4 and not "TP53" in sample.genes_affected:
if sample.er_status == "positive":
MYC_amp_TP53_wt_er_pos += 1
if sample.er_status == "negative":
MYC_amp_TP53_wt_er_neg += 1
if sample.pr_status == "positive":
MYC_amp_TP53_wt_pr_pos += 1
if sample.pr_status == "negative":
MYC_amp_TP53_wt_pr_neg += 1
if sample.her2_status == "positive":
MYC_amp_TP53_wt_her2_pos += 1
if sample.her2_status == "negative":
MYC_amp_TP53_wt_her2_neg += 1
oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_er_pos, MYC_amp_TP53_mut_er_neg], [MYC_amp_TP53_wt_er_pos, MYC_amp_TP53_wt_er_neg]])
oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_pr_pos, MYC_amp_TP53_mut_pr_neg], [MYC_amp_TP53_wt_pr_pos, MYC_amp_TP53_wt_pr_neg]])
oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_her2_pos, MYC_amp_TP53_mut_her2_neg], [MYC_amp_TP53_wt_her2_pos, MYC_amp_TP53_wt_her2_neg]])
print ""
print " 2) check hormone receptor status of MYC CN>4 TP53 mutated samples vs. CN>4 TP53 WT samples"
print " Estrogen receptor:"
print " - Positive:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_er_pos)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_er_pos)
print " - Negative:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_er_neg)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_er_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_er)
print " -p-value: "+str(pvalue_er)
print " Progesteron receptor:"
print " - Positive:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_pr_pos)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_pr_pos)
print " - Negative:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_pr_neg)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_pr_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_pr)
print " -p-value: "+str(pvalue_pr)
print " HER2:"
print " - Positive:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_her2_pos)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_her2_pos)
print " - Negative:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_her2_neg)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_her2_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_her2)
print " -p-value: "+str(pvalue_her2)
In [2]:
# 2 check hormone receptor status of MYC samples with copynumber > 4 and MYC negative samples
MYC_amp_TP53_mut_triple_negative = 0
MYC_amp_TP53_mut_non_triple_negative = 0
MYC_amp_TP53_wt_triple_negative = 0
MYC_amp_TP53_wt_non_triple_negative = 0
for sample in samples.values():
if not sample.clinical:
continue
if not sample.somatic_mutation_data:
continue
copynumber_MYC = "n/a"
log2_MYC = sample.getLog2FromGene(gene_positions['MYC'].chrom,gene_positions['MYC'].start, gene_positions['MYC'].end)
if (log2_MYC != None):
copynumber_MYC = 2.0 * 2.0 ** log2_MYC
else:
copynumber_MYC="n/a"
if copynumber_MYC != "n/a" and copynumber_MYC > 4 and "TP53" in sample.genes_affected:
if sample.er_status == "negative" and sample.pr_status == "negative" and sample.her2_status == "negative":
MYC_amp_TP53_mut_triple_negative += 1
else:
MYC_amp_TP53_mut_non_triple_negative
if copynumber_MYC != "n/a" and copynumber_MYC > 4 and not "TP53" in sample.genes_affected:
if sample.er_status == "negative" and sample.pr_status == "negative" and sample.her2_status == "negative":
MYC_amp_TP53_wt_triple_negative += 1
else:
MYC_amp_TP53_wt_non_triple_negative += 1
#oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_er_pos, MYC_amp_TP53_mut_er_neg], [MYC_amp_TP53_wt_er_pos, MYC_amp_TP53_wt_er_neg]])
#oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_pr_pos, MYC_amp_TP53_mut_pr_neg], [MYC_amp_TP53_wt_pr_pos, MYC_amp_TP53_wt_pr_neg]])
#oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_her2_pos, MYC_amp_TP53_mut_her2_neg], [MYC_amp_TP53_wt_her2_pos, MYC_amp_TP53_wt_her2_neg]])
print ""
print " 2) check hormone receptor status of MYC CN>4 TP53 mutated samples vs. CN>4 TP53 WT samples"
print " Triple negative:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_triple_negative)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_triple_negative)
print " Non-triple negative:"
print " -MYC CN>4 TP53 mut: "+str(MYC_amp_TP53_mut_non_triple_negative)
print " -MYC CN>4 TP53 wt: "+str(MYC_amp_TP53_wt_non_triple_negative)
In [3]:
# 2 check hormone receptor status of MYC samples with copynumber > 4 and MYC negative samples
MYC_amp_TP53_mut_triple_negative = 0
MYC_amp_TP53_mut_non_triple_negative = 0
MYC_amp_TP53_wt_triple_negative = 0
MYC_amp_TP53_wt_non_triple_negative = 0
for sample in samples.values():
if not sample.clinical:
continue
if not sample.somatic_mutation_data:
continue
if sample.checkFocalGeneAmp("MYC") and "TP53" in sample.genes_affected:
if sample.er_status == "negative" and sample.pr_status == "negative" and sample.her2_status == "negative":
MYC_amp_TP53_mut_triple_negative += 1
else:
MYC_amp_TP53_mut_non_triple_negative
if sample.checkFocalGeneAmp("MYC") and not "TP53" in sample.genes_affected:
if sample.er_status == "negative" and sample.pr_status == "negative" and sample.her2_status == "negative":
MYC_amp_TP53_wt_triple_negative += 1
else:
MYC_amp_TP53_wt_non_triple_negative += 1
#oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_er_pos, MYC_amp_TP53_mut_er_neg], [MYC_amp_TP53_wt_er_pos, MYC_amp_TP53_wt_er_neg]])
#oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_pr_pos, MYC_amp_TP53_mut_pr_neg], [MYC_amp_TP53_wt_pr_pos, MYC_amp_TP53_wt_pr_neg]])
#oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[MYC_amp_TP53_mut_her2_pos, MYC_amp_TP53_mut_her2_neg], [MYC_amp_TP53_wt_her2_pos, MYC_amp_TP53_wt_her2_neg]])
print ""
print " 2) check hormone receptor status of MYC CN>4 TP53 mutated samples vs. CN>4 TP53 WT samples"
print " Triple negative:"
print " -MYC focal TP53 mut: "+str(MYC_amp_TP53_mut_triple_negative)
print " -MYC focal TP53 wt: "+str(MYC_amp_TP53_wt_triple_negative)
print " Non-triple negative:"
print " -MYC focal TP53 mut: "+str(MYC_amp_TP53_mut_non_triple_negative)
print " -MYC focal TP53 wt: "+str(MYC_amp_TP53_wt_non_triple_negative)
In [4]:
# 3) check hormone receptor status of CCND1 focally amplified and MYC negative samples
CCND1_amp_er_pos = 0
CCND1_amp_er_neg = 0
CCND1_amp_pr_pos = 0
CCND1_amp_pr_neg = 0
CCND1_amp_her2_pos = 0
CCND1_amp_her2_neg = 0
CCND1_no_amp_er_pos = 0
CCND1_no_amp_er_neg = 0
CCND1_no_amp_pr_pos = 0
CCND1_no_amp_pr_neg = 0
CCND1_no_amp_her2_pos = 0
CCND1_no_amp_her2_neg = 0
for sample in samples.values():
if not sample.clinical:
continue
if sample.checkFocalGeneAmp("CCND1") and not sample.checkFocalGeneAmp("MYC") :
if sample.er_status == "positive":
CCND1_amp_er_pos += 1
if sample.er_status == "negative":
CCND1_amp_er_neg += 1
if sample.pr_status == "positive":
CCND1_amp_pr_pos += 1
if sample.pr_status == "negative":
CCND1_amp_pr_neg += 1
if sample.her2_status == "positive":
CCND1_amp_her2_pos += 1
if sample.her2_status == "negative":
CCND1_amp_her2_neg += 1
if not sample.checkFocalGeneAmp("CCND1"):
if sample.er_status == "positive":
CCND1_no_amp_er_pos += 1
if sample.er_status == "negative":
CCND1_no_amp_er_neg += 1
if sample.pr_status == "positive":
CCND1_no_amp_pr_pos += 1
if sample.pr_status == "negative":
CCND1_no_amp_pr_neg += 1
if sample.her2_status == "positive":
CCND1_no_amp_her2_pos += 1
if sample.her2_status == "negative":
CCND1_no_amp_her2_neg += 1
oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[CCND1_amp_er_pos, CCND1_amp_er_neg], [CCND1_no_amp_er_pos, CCND1_no_amp_er_neg]])
oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[CCND1_amp_pr_pos, CCND1_amp_pr_neg], [CCND1_no_amp_pr_pos, CCND1_no_amp_pr_neg]])
oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[CCND1_amp_her2_pos, CCND1_amp_her2_neg], [CCND1_no_amp_her2_pos, CCND1_no_amp_her2_neg]])
print ""
print " 3) check hormone receptor status of CCND1 focally amplified and CCND1 negative samples"
print " Estrogen receptor:"
print " - Positive:"
print " -CCND1 amplified: "+str(CCND1_amp_er_pos)
print " -CCND1 not amplified: "+str(CCND1_no_amp_er_pos)
print " - Negative:"
print " -CCND1 amplified: "+str(CCND1_amp_er_neg)
print " -CCND1 not amplified: "+str(CCND1_no_amp_er_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_er)
print " -p-value: "+str(pvalue_er)
print " Progesteron receptor:"
print " - Positive:"
print " -CCND1 amplified: "+str(CCND1_amp_pr_pos)
print " -CCND1 not amplified: "+str(CCND1_no_amp_pr_pos)
print " - Negative:"
print " -CCND1 amplified: "+str(CCND1_amp_pr_neg)
print " -CCND1 not amplified: "+str(CCND1_no_amp_pr_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_pr)
print " -p-value: "+str(pvalue_pr)
print " HER2:"
print " - Positive:"
print " -CCND1 amplified: "+str(CCND1_amp_her2_pos)
print " -CCND1 not amplified: "+str(CCND1_no_amp_her2_pos)
print " - Negative:"
print " -CCND1 amplified: "+str(CCND1_amp_her2_neg)
print " -CCND1 not amplified: "+str(CCND1_no_amp_her2_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_her2)
print " -p-value: "+str(pvalue_her2)
In [5]:
# 4 check hormone receptor status of CCND1 samples with copynumber > 4 and CCND1 negative samples
CCND1_amp_er_pos = 0
CCND1_amp_er_neg = 0
CCND1_amp_pr_pos = 0
CCND1_amp_pr_neg = 0
CCND1_amp_her2_pos = 0
CCND1_amp_her2_neg = 0
CCND1_no_amp_er_pos = 0
CCND1_no_amp_er_neg = 0
CCND1_no_amp_pr_pos = 0
CCND1_no_amp_pr_neg = 0
CCND1_no_amp_her2_pos = 0
CCND1_no_amp_her2_neg = 0
for sample in samples.values():
if not sample.clinical:
continue
copynumber_CCND1 = "n/a"
log2_CCND1 = sample.getLog2FromGene(gene_positions['CCND1'].chrom,gene_positions['CCND1'].start, gene_positions['CCND1'].end)
if (log2_CCND1 != None):
copynumber_CCND1 = 2.0 * 2.0 ** log2_CCND1
else:
copynumber_CCND1="n/a"
if copynumber_CCND1 != "n/a" and copynumber_CCND1 > 4:
if sample.er_status == "positive":
CCND1_amp_er_pos += 1
if sample.er_status == "negative":
CCND1_amp_er_neg += 1
if sample.pr_status == "positive":
CCND1_amp_pr_pos += 1
if sample.pr_status == "negative":
CCND1_amp_pr_neg += 1
if sample.her2_status == "positive":
CCND1_amp_her2_pos += 1
if sample.her2_status == "negative":
CCND1_amp_her2_neg += 1
if copynumber_CCND1 != "n/a" and copynumber_CCND1 < 4:
if sample.er_status == "positive":
CCND1_no_amp_er_pos += 1
if sample.er_status == "negative":
CCND1_no_amp_er_neg += 1
if sample.pr_status == "positive":
CCND1_no_amp_pr_pos += 1
if sample.pr_status == "negative":
CCND1_no_amp_pr_neg += 1
if sample.her2_status == "positive":
CCND1_no_amp_her2_pos += 1
if sample.her2_status == "negative":
CCND1_no_amp_her2_neg += 1
oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[CCND1_amp_er_pos, CCND1_amp_er_neg], [CCND1_no_amp_er_pos, CCND1_no_amp_er_neg]])
oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[CCND1_amp_pr_pos, CCND1_amp_pr_neg], [CCND1_no_amp_pr_pos, CCND1_no_amp_pr_neg]])
oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[CCND1_amp_her2_pos, CCND1_amp_her2_neg], [CCND1_no_amp_her2_pos, CCND1_no_amp_her2_neg]])
print ""
print " 4) check hormone receptor status of CCND1 CN>4 samples and samples having CCND1 CN<4"
print " Estrogen receptor:"
print " - Positive:"
print " -CCND1 CN>4: "+str(CCND1_amp_er_pos)
print " -CCND1 CN<4: "+str(CCND1_no_amp_er_pos)
print " - Negative:"
print " -CCND1 CN>4: "+str(CCND1_amp_er_neg)
print " -CCND1 CN<4: "+str(CCND1_no_amp_er_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_er)
print " -p-value: "+str(pvalue_er)
print " Progesteron receptor:"
print " - Positive:"
print " -CCND1 CN>4: "+str(CCND1_amp_pr_pos)
print " -CCND1 CN<4: "+str(CCND1_no_amp_pr_pos)
print " - Negative:"
print " -CCND1 CN>4: "+str(CCND1_amp_pr_neg)
print " -CCND1 CN<4: "+str(CCND1_no_amp_pr_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_pr)
print " -p-value: "+str(pvalue_pr)
print " HER2:"
print " - Positive:"
print " -CCND1 CN>4: "+str(CCND1_amp_her2_pos)
print " -CCND1 CN<4: "+str(CCND1_no_amp_her2_pos)
print " - Negative:"
print " -CCND1 CN>4: "+str(CCND1_amp_her2_neg)
print " -CCND1 CN<4: "+str(CCND1_no_amp_her2_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_her2)
print " -p-value: "+str(pvalue_her2)
In [6]:
# 5) check stages of MYC focal amplification
MYC_stages = list()
CCND1_stages = list()
noFocal_stages = list()
for sample in samples.values():
if not sample.clinical:
continue
if sample.checkFocalGeneAmp("MYC") and not sample.checkFocalGeneAmp("CCND1"):
MYC_stages.append(sample.stage)
elif sample.checkFocalGeneAmp("CCND1") and not sample.checkFocalGeneAmp("MYC"):
CCND1_stages.append(sample.stage)
elif not sample.checkFocalGeneAmp("CCND1") and not sample.checkFocalGeneAmp("MYC"):
noFocal_stages.append(sample.stage)
MYC_stages_series = pandas.Categorical(sorted(MYC_stages))
CCND1_stages_series = pandas.Categorical(sorted(CCND1_stages))
noFocal_stages_series = pandas.Categorical(sorted(noFocal_stages))
fig_stages_MYC=MYC_stages_series.describe().counts.plot(kind='pie', figsize=(6, 6),colors=['b', 'g', 'r', 'c', 'm', 'y','k','w'])
print ""
print " 5) check stages of MYC focal amplification"
print " "
count = 0
s = "<table><tr><th>Category</th><th>Count</th><th>Frequency</th></tr>"
for i in MYC_stages_series.categories:
s += "<tr><td>"+i+"</td><td>"+str(MYC_stages_series.describe()['counts'][count])+"</td><td>"+str(MYC_stages_series.describe()['freqs'][count])+"</td></tr>"
count += 1
s += "</table>"
h = HTML(s);h
Out[6]:
In [7]:
# 6) check hormone receptor status of ERBB2 focally amplified and ERBB2 negative samples
ERBB2_amp_er_pos = 0
ERBB2_amp_er_neg = 0
ERBB2_amp_pr_pos = 0
ERBB2_amp_pr_neg = 0
ERBB2_amp_her2_pos = 0
ERBB2_amp_her2_neg = 0
ERBB2_no_amp_er_pos = 0
ERBB2_no_amp_er_neg = 0
ERBB2_no_amp_pr_pos = 0
ERBB2_no_amp_pr_neg = 0
ERBB2_no_amp_her2_pos = 0
ERBB2_no_amp_her2_neg = 0
for sample in samples.values():
if not sample.clinical:
continue
if sample.checkFocalGeneAmp("ERBB2"):
if sample.er_status == "positive":
ERBB2_amp_er_pos += 1
if sample.er_status == "negative":
ERBB2_amp_er_neg += 1
if sample.pr_status == "positive":
ERBB2_amp_pr_pos += 1
if sample.pr_status == "negative":
ERBB2_amp_pr_neg += 1
if sample.her2_status == "positive":
ERBB2_amp_her2_pos += 1
if sample.her2_status == "negative":
ERBB2_amp_her2_neg += 1
if not sample.checkFocalGeneAmp("ERBB2"):
if sample.er_status == "positive":
ERBB2_no_amp_er_pos += 1
if sample.er_status == "negative":
ERBB2_no_amp_er_neg += 1
if sample.pr_status == "positive":
ERBB2_no_amp_pr_pos += 1
if sample.pr_status == "negative":
ERBB2_no_amp_pr_neg += 1
if sample.her2_status == "positive":
ERBB2_no_amp_her2_pos += 1
if sample.her2_status == "negative":
ERBB2_no_amp_her2_neg += 1
oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[ERBB2_amp_er_pos, ERBB2_amp_er_neg], [ERBB2_no_amp_er_pos, ERBB2_no_amp_er_neg]])
oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[ERBB2_amp_pr_pos, ERBB2_amp_pr_neg], [ERBB2_no_amp_pr_pos, ERBB2_no_amp_pr_neg]])
oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[ERBB2_amp_her2_pos, ERBB2_amp_her2_neg], [ERBB2_no_amp_her2_pos, ERBB2_no_amp_her2_neg]])
print ""
print " 6) check hormone receptor status of ERBB2 focally amplified and ERBB2 negative samples"
print " Estrogen receptor:"
print " - Positive:"
print " -ERBB2 amplified: "+str(ERBB2_amp_er_pos)
print " -ERBB2 not amplified: "+str(ERBB2_no_amp_er_pos)
print " - Negative:"
print " -ERBB2 amplified: "+str(ERBB2_amp_er_neg)
print " -ERBB2 not amplified: "+str(ERBB2_no_amp_er_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_er)
print " -p-value: "+str(pvalue_er)
print " Progesteron receptor:"
print " - Positive:"
print " -ERBB2 amplified: "+str(ERBB2_amp_pr_pos)
print " -ERBB2 not amplified: "+str(ERBB2_no_amp_pr_pos)
print " - Negative:"
print " -ERBB2 amplified: "+str(ERBB2_amp_pr_neg)
print " -ERBB2 not amplified: "+str(ERBB2_no_amp_pr_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_pr)
print " -p-value: "+str(pvalue_pr)
print " HER2:"
print " - Positive:"
print " -ERBB2 amplified: "+str(ERBB2_amp_her2_pos)
print " -ERBB2 not amplified: "+str(ERBB2_no_amp_her2_pos)
print " - Negative:"
print " -ERBB2 amplified: "+str(ERBB2_amp_her2_neg)
print " -ERBB2 not amplified: "+str(ERBB2_no_amp_her2_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_her2)
print " -p-value: "+str(pvalue_her2)
In [8]:
# 7) check hormone receptor status of ERBB2 samples with copynumber > 4 and ERBB2 negative samples
ERBB2_amp_er_pos = 0
ERBB2_amp_er_neg = 0
ERBB2_amp_pr_pos = 0
ERBB2_amp_pr_neg = 0
ERBB2_amp_her2_pos = 0
ERBB2_amp_her2_neg = 0
ERBB2_no_amp_er_pos = 0
ERBB2_no_amp_er_neg = 0
ERBB2_no_amp_pr_pos = 0
ERBB2_no_amp_pr_neg = 0
ERBB2_no_amp_her2_pos = 0
ERBB2_no_amp_her2_neg = 0
for sample in samples.values():
if not sample.clinical:
continue
copynumber_ERBB2 = "n/a"
log2_ERBB2 = sample.getLog2FromGene(gene_positions['ERBB2'].chrom,gene_positions['ERBB2'].start, gene_positions['ERBB2'].end)
if (log2_ERBB2 != None):
copynumber_ERBB2 = 2.0 * 2.0 ** log2_ERBB2
else:
copynumber_ERBB2="n/a"
if copynumber_ERBB2 != "n/a" and copynumber_ERBB2 > 4:
if sample.er_status == "positive":
ERBB2_amp_er_pos += 1
if sample.er_status == "negative":
ERBB2_amp_er_neg += 1
if sample.pr_status == "positive":
ERBB2_amp_pr_pos += 1
if sample.pr_status == "negative":
ERBB2_amp_pr_neg += 1
if sample.her2_status == "positive":
ERBB2_amp_her2_pos += 1
if sample.her2_status == "negative":
ERBB2_amp_her2_neg += 1
if copynumber_ERBB2 != "n/a" and copynumber_ERBB2 < 4:
if sample.er_status == "positive":
ERBB2_no_amp_er_pos += 1
if sample.er_status == "negative":
ERBB2_no_amp_er_neg += 1
if sample.pr_status == "positive":
ERBB2_no_amp_pr_pos += 1
if sample.pr_status == "negative":
ERBB2_no_amp_pr_neg += 1
if sample.her2_status == "positive":
ERBB2_no_amp_her2_pos += 1
if sample.her2_status == "negative":
ERBB2_no_amp_her2_neg += 1
oddsratio_er, pvalue_er = scipy.stats.fisher_exact([[ERBB2_amp_er_pos, ERBB2_amp_er_neg], [ERBB2_no_amp_er_pos, ERBB2_no_amp_er_neg]])
oddsratio_pr, pvalue_pr = scipy.stats.fisher_exact([[ERBB2_amp_pr_pos, ERBB2_amp_pr_neg], [ERBB2_no_amp_pr_pos, ERBB2_no_amp_pr_neg]])
oddsratio_her2, pvalue_her2 = scipy.stats.fisher_exact([[ERBB2_amp_her2_pos, ERBB2_amp_her2_neg], [ERBB2_no_amp_her2_pos, ERBB2_no_amp_her2_neg]])
print ""
print " 7) check hormone receptor status of ERBB2 CN>4 samples and samples having ERBB2 CN<4"
print " Estrogen receptor:"
print " - Positive:"
print " -ERBB2 CN>4: "+str(ERBB2_amp_er_pos)
print " -ERBB2 CN<4: "+str(ERBB2_no_amp_er_pos)
print " - Negative:"
print " -ERBB2 CN>4: "+str(ERBB2_amp_er_neg)
print " -ERBB2 CN<4: "+str(ERBB2_no_amp_er_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_er)
print " -p-value: "+str(pvalue_er)
print " Progesteron receptor:"
print " - Positive:"
print " -ERBB2 CN>4: "+str(ERBB2_amp_pr_pos)
print " -ERBB2 CN<4: "+str(ERBB2_no_amp_pr_pos)
print " - Negative:"
print " -ERBB2 CN>4: "+str(ERBB2_amp_pr_neg)
print " -ERBB2 CN<4: "+str(ERBB2_no_amp_pr_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_pr)
print " -p-value: "+str(pvalue_pr)
print " HER2:"
print " - Positive:"
print " -ERBB2 CN>4: "+str(ERBB2_amp_her2_pos)
print " -ERBB2 CN<4: "+str(ERBB2_no_amp_her2_pos)
print " - Negative:"
print " -ERBB2 CN>4: "+str(ERBB2_amp_her2_neg)
print " -ERBB2 CN<4: "+str(ERBB2_no_amp_her2_neg)
print " - Fisher's ecaxt Test"
print " -Odd's ratio: "+str(oddsratio_her2)
print " -p-value: "+str(pvalue_her2)
In [8]: