In [1]:
import NotebookImport
from TCGA_analysis_BRCA_import import *
import matplotlib.pyplot
from IPython.display import HTML


importing IPython notebook from TCGA_analysis_BRCA_import.ipynb
Loading Focal Amplification data
Loading RNASeq data
Loading RNASeq data of controls
Loading CNV Data
Loading Somatic Mutation Data
TCGA-A8-A07C-01A not found
TCGA-BH-A0HN-01A not found
TCGA-BH-A0B8-01A not found
TCGA-BH-A0HF-01A not found
TCGA-A7-A4SC-01A not found
TCGA-AR-A0TU-01A not found
TCGA-AR-A1AT-01A not found
TCGA-E2-A1LS-01A not found
TCGA-A2-A0CZ-01A not found
TCGA-BH-A0HL-01A not found
TCGA-AN-A0G0-01A not found
TCGA-BH-A0B1-01A not found
TCGA-B6-A0I8-01A not found
TCGA-B6-A0I6-01A not found
Loading Clinical Data
Samples: 1086
  --Focal Data: 1086
  --CNV:        1086
  --RNASeq:     1081
  --Somatic:    968
  --Clinical:   1058

BRCA Focal amplifications and clinical variables

Check receptor status of MYC focally amplified samples


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)


 1) check hormone receptor status of MYC focally amplified and MYC negative samples
   Estrogen receptor:
     - Positive:
        -MYC amplified: 23
        -MYC not amplified: 751
     - Negative:
        -MYC amplified: 27
        -MYC not amplified: 200
     - Fisher's ecaxt Test
        -Odd's ratio: 0.226858016472
        -p-value: 7.37729172165e-07
   Progesteron receptor:
     - Positive:
        -MYC amplified: 16
        -MYC not amplified: 655
     - Negative:
        -MYC amplified: 34
        -MYC not amplified: 293
     - Fisher's ecaxt Test
        -Odd's ratio: 0.21050740907
        -p-value: 2.11476115924e-07
   HER2:
     - Positive:
        -MYC amplified: 11
        -MYC not amplified: 142
     - Negative:
        -MYC amplified: 27
        -MYC not amplified: 514
     - Fisher's ecaxt Test
        -Odd's ratio: 1.47470005216
        -p-value: 0.314116176538

Check hormone receptor status of MYC samples with copynumber > 4 and MYC negative samples


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)


 2) check hormone receptor status of MYC CN>4 samples and samples having MYC CN<4
   Estrogen receptor:
     - Positive:
        -MYC CN>4: 72
        -MYC CN<4: 711
     - Negative:
        -MYC CN>4: 42
        -MYC CN<4: 184
     - Fisher's ecaxt Test
        -Odd's ratio: 0.443640747438
        -p-value: 0.000189694007507
   Progesteron receptor:
     - Positive:
        -MYC CN>4: 58
        -MYC CN<4: 622
     - Negative:
        -MYC CN>4: 56
        -MYC CN<4: 270
     - Fisher's ecaxt Test
        -Odd's ratio: 0.449586587046
        -p-value: 0.000111726212774
   HER2:
     - Positive:
        -MYC CN>4: 18
        -MYC CN<4: 137
     - Negative:
        -MYC CN>4: 63
        -MYC CN<4: 482
     - Fisher's ecaxt Test
        -Odd's ratio: 1.00521376434
        -p-value: 1.0

Check hormone receptor status of MYC samples with copynumber > 4 and TP53 mutations


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)


 2) check hormone receptor status of MYC CN>4 samples and samples having MYC CN<4
   Estrogen receptor:
     - Positive:
        -MYC CN>4 TP53 mut: 28
        -MYC CN>4 TP53 wt: 41
     - Negative:
        -MYC CN>4 TP53 mut: 34
        -MYC CN>4 TP53 wt: 7
     - Fisher's ecaxt Test
        -Odd's ratio: 0.140602582496
        -p-value: 2.11633589562e-05
   Progesteron receptor:
     - Positive:
        -MYC CN>4 TP53 mut: 25
        -MYC CN>4 TP53 wt: 31
     - Negative:
        -MYC CN>4 TP53 mut: 37
        -MYC CN>4 TP53 wt: 17
     - Fisher's ecaxt Test
        -Odd's ratio: 0.370531822145
        -p-value: 0.0132961468148
   HER2:
     - Positive:
        -MYC CN>4 TP53 mut: 11
        -MYC CN>4 TP53 wt: 7
     - Negative:
        -MYC CN>4 TP53 mut: 34
        -MYC CN>4 TP53 wt: 27
     - Fisher's ecaxt Test
        -Odd's ratio: 1.24789915966
        -p-value: 0.789598320204

Check how many MYC CN>4 and TP53 mutated samples are triple negative


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)


 2) check hormone receptor status of MYC CN>4 TP53 mutated samples vs. CN>4 TP53 WT samples
   Triple negative:
        -MYC CN>4 TP53 mut: 16
        -MYC CN>4 TP53 wt: 2
   Non-triple negative:
        -MYC CN>4 TP53 mut: 0
        -MYC CN>4 TP53 wt: 47

Check how many focal MYC and TP53 mutated samples are 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)


 2) check hormone receptor status of MYC CN>4 TP53 mutated samples vs. CN>4 TP53 WT samples
   Triple negative:
        -MYC focal TP53 mut: 10
        -MYC focal TP53 wt: 3
   Non-triple negative:
        -MYC focal TP53 mut: 0
        -MYC focal TP53 wt: 22

Check receptor status of CCND1 focally amplified samples


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)


 3) check hormone receptor status of CCND1 focally amplified and CCND1 negative samples
   Estrogen receptor:
     - Positive:
        -CCND1 amplified: 176
        -CCND1 not amplified: 598
     - Negative:
        -CCND1 amplified: 15
        -CCND1 not amplified: 212
     - Fisher's ecaxt Test
        -Odd's ratio: 4.1596432553
        -p-value: 4.84056842499e-09
   Progesteron receptor:
     - Positive:
        -CCND1 amplified: 151
        -CCND1 not amplified: 520
     - Negative:
        -CCND1 amplified: 40
        -CCND1 not amplified: 287
     - Fisher's ecaxt Test
        -Odd's ratio: 2.08350961538
        -p-value: 7.75506820612e-05
   HER2:
     - Positive:
        -CCND1 amplified: 35
        -CCND1 not amplified: 118
     - Negative:
        -CCND1 amplified: 93
        -CCND1 not amplified: 448
     - Fisher's ecaxt Test
        -Odd's ratio: 1.42883178422
        -p-value: 0.124582916372

Check hormone receptor status of samples with copynumber > 4 in CCND1 and CCND1 negative samples


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)


 4) check hormone receptor status of CCND1 CN>4 samples and samples having CCND1 CN<4
   Estrogen receptor:
     - Positive:
        -CCND1 CN>4: 123
        -CCND1 CN<4: 657
     - Negative:
        -CCND1 CN>4: 9
        -CCND1 CN<4: 217
     - Fisher's ecaxt Test
        -Odd's ratio: 4.51395230847
        -p-value: 5.42599346238e-07
   Progesteron receptor:
     - Positive:
        -CCND1 CN>4: 106
        -CCND1 CN<4: 571
     - Negative:
        -CCND1 CN>4: 26
        -CCND1 CN<4: 299
     - Fisher's ecaxt Test
        -Odd's ratio: 2.13485113835
        -p-value: 0.000656575876763
   HER2:
     - Positive:
        -CCND1 CN>4: 28
        -CCND1 CN<4: 126
     - Negative:
        -CCND1 CN>4: 65
        -CCND1 CN<4: 478
     - Fisher's ecaxt Test
        -Odd's ratio: 1.63418803419
        -p-value: 0.0592464799879

Check clinical stage and MYC focal amplification samples


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


 5) check stages of MYC focal amplification
   
Out[6]:
CategoryCountFrequency
stage i40.078431372549
stage ia30.0588235294118
stage iia210.411764705882
stage iib160.313725490196
stage iiia50.0980392156863
stage iiib10.0196078431373
stage iiic10.0196078431373

Check hormone receptor status of samples with focal ERBB2 amplification and ERBB2 negative samples


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)


 6) check hormone receptor status of ERBB2 focally amplified and ERBB2 negative samples
   Estrogen receptor:
     - Positive:
        -ERBB2 amplified: 79
        -ERBB2 not amplified: 704
     - Negative:
        -ERBB2 amplified: 40
        -ERBB2 not amplified: 187
     - Fisher's ecaxt Test
        -Odd's ratio: 0.524609375
        -p-value: 0.00325233297807
   Progesteron receptor:
     - Positive:
        -ERBB2 amplified: 61
        -ERBB2 not amplified: 619
     - Negative:
        -ERBB2 amplified: 60
        -ERBB2 not amplified: 267
     - Fisher's ecaxt Test
        -Odd's ratio: 0.438529886914
        -p-value: 3.096094396e-05
   HER2:
     - Positive:
        -ERBB2 amplified: 79
        -ERBB2 not amplified: 77
     - Negative:
        -ERBB2 amplified: 13
        -ERBB2 not amplified: 532
     - Fisher's ecaxt Test
        -Odd's ratio: 41.986013986
        -p-value: 3.08512741547e-46

Check hormone receptor status of samples with copynumber > 4 in ERBB2 and ERBB2 negative samples


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)


 7) check hormone receptor status of ERBB2 CN>4 samples and samples having ERBB2 CN<4
   Estrogen receptor:
     - Positive:
        -ERBB2 CN>4: 63
        -ERBB2 CN<4: 713
     - Negative:
        -ERBB2 CN>4: 33
        -ERBB2 CN<4: 189
     - Fisher's ecaxt Test
        -Odd's ratio: 0.506056355986
        -p-value: 0.00424365528706
   Progesteron receptor:
     - Positive:
        -ERBB2 CN>4: 43
        -ERBB2 CN<4: 629
     - Negative:
        -ERBB2 CN>4: 54
        -ERBB2 CN<4: 268
     - Fisher's ecaxt Test
        -Odd's ratio: 0.339280456928
        -p-value: 9.92283759144e-07
   HER2:
     - Positive:
        -ERBB2 CN>4: 72
        -ERBB2 CN<4: 76
     - Negative:
        -ERBB2 CN>4: 4
        -ERBB2 CN<4: 539
     - Fisher's ecaxt Test
        -Odd's ratio: 127.657894737
        -p-value: 1.7302350272e-50

In [8]: