Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/davolilab/Proteogenomic-Analysis-of-Aneuploidy
06 September 2022, 07:29:28 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    No releases to show
  • 2a69fb3
  • /
  • Scripts
  • /
  • Figure4
  • /
  • purity.R
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:0411a0223197afdd6031f1f330094938fe30af77
origin badgedirectory badge
swh:1:dir:618d995563295c84c2547bbfac702a264a621815
origin badgerevision badge
swh:1:rev:9aa99245ac462b4134976293e52f56650ecb5c00
origin badgesnapshot badge
swh:1:snp:b6538a05374b43498f080a72fde216d3c2244d9f

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 9aa99245ac462b4134976293e52f56650ecb5c00 authored by breezyzhao on 23 August 2022, 23:15:57 UTC
Delete license
Tip revision: 9aa9924
purity.R
### this script is used to organize CPTAC purity data
### two kinds of purity data
### first: estimated from RNA
### second: tumor nuclei from HE stain

setwd("/Users/pc2644/Documents/DM_Aneuploidy/Compensation/PanAnalysis")

library(ggplot2)
library(dplyr)

rm(list=ls())

### first organize estimate purity data
### colon2
path_colon <- "/Volumes/davolt01lab/davolt01labspace/Data/CPTAC_PanCan/CPTAC_PanCan_Clinical_Data/CO/AWG_data_freeze/Human__CPTAC_COAD__MS__Clinical__Clinical__03_01_2017__CPTAC__Clinical__BCM.tsi"
sample <- read.delim(path_colon)
sample <- data.frame(t(sample))
colnames(sample) <- sample[1,]
sample <- sample[-1,]
purity_colon <- data.frame(samples=rownames(sample),
                           estiPurity=sample$TumorPurity)
rm(sample, path_colon)

### breast2
path_breast <- "/Volumes/davolt01lab/davolt01labspace/Data/CPTAC_PanCan/CPTAC_PanCan_Clinical_Data/BR/AWG_data_freeze/prosp-brca-v5.3-sample-annotation.csv"
sample <- read.csv(path_breast)
purity_breast <- data.frame(samples=sample$Sample.ID,
                            estiPurity=sample$ESTIMATE.TumorPurity)
rm(sample, path_breast)

### ovarian2
# path_ovarian <- "/Volumes/davolt01lab/davolt01labspace/Data/CPTAC_PanCan/CPTAC_PanCan_Clinical_Data/OV/AWG_data_freeze/Ovary One Year Clinical Data_20160927.txt"
# sample <- read.delim(path_ovarian)
# rm(sample, path_ovarian)

### ccrcc
# path_ccrcc <- "/Volumes/davolt01lab/davolt01labspace/Data/CPTAC_PanCan/CPTAC_PanCan_Clinical_Data/ccRCC/AWG_data_freeze/CCRCC_September2018_case.tsv"
# sample <- read.delim(path_ccrcc)
# rm(sample, path_ccrcc)

### endometrial
path_endometrial <- "/Volumes/davolt01lab/davolt01labspace/Data/CPTAC_PanCan/CPTAC_PanCan_Clinical_Data/EC/AWG_data_freeze/HS_CPTAC_UCEC_CLI.txt"
sample <- read.delim(path_endometrial)
purity_endometrial <- data.frame(samples=gsub("-",".",sample$Proteomics_Participant_ID),
                            estiPurity=sample$Purity_Cancer)
rm(sample, path_endometrial)

### hnscc
path_hnscc <- "/Volumes/davolt01lab/davolt01labspace/Data/CPTAC_PanCan/CPTAC_PanCan_Clinical_Data/HNSCC/AWG_data_freeze/Meta_table.tsv"
sample <- read.delim(path_hnscc)
purity_hnscc <- data.frame(samples=gsub("-",".",sample$case_id),
                           estiPurity=sample$tumor_proportion)

rm(sample, path_hnscc)

### luad
path_luad <- "/Volumes/davolt01lab/davolt01labspace/Data/CPTAC_PanCan/CPTAC_PanCan_Clinical_Data/LUAD/AWG_data_freeze/luad-v3.2-sample-annotation.csv"
sample <- read.csv(path_luad)
purity_luad <- data.frame(samples=sample$Sample.ID,
                          estiPurity=sample$Tumor.Purity.byESTIMATE.RNAseq)
rm(sample, path_luad)

purity_estimate <- rbind(purity_colon, purity_breast, purity_endometrial, purity_hnscc, purity_luad)
purity_estimate <- na.omit(purity_estimate)

### read aneuploidy score
load("/Users/pc2644/Documents/DM_Aneuploidy/Compensation/PanAnalysis/pan_aneuploidy.RData")

indep_pan2 <- merge(indep_pan, purity_estimate, by.x="patients", by.y="samples", all.x=T, sort=F)

### read purity data from image
path_cohort <- "/Volumes/davolt01lab/davolt01labspace/Data/Proteogenomic_Fenyo/CPTAC3/CPTAC3_cohort.csv"
sample <- read.csv(path_cohort)
sample <- sample[sample$Specimen_Type=="tumor_tissue",]
### there are some tissues from the same patients, calculate the average of them
patients <- unique(sample$Patient_ID)
purity_nuclei <- data.frame(samples=patients,
                            nucleiPurity=rep(NA,length(patients)))
rownames(purity_nuclei) <- purity_nuclei$samples
# i=patients[1]
for (i in patients) {
  index <- sample$Patient_ID==i
  purity_nuclei[i,"nucleiPurity"] <- mean(sample$Percent_Tumor_Nuclei[index])
  
}
purity_nuclei$samples <- gsub("-", "." , purity_nuclei$samples)
rm(sample, path_cohort)

indep_pan2 <- merge(indep_pan2, purity_nuclei, by.x="patients", by.y="samples", all.x=T, sort=F)
indep_pan2$estiPurity <- as.numeric(indep_pan2$estiPurity)
indep_pan2$nucleiPurity <- as.numeric(indep_pan2$nucleiPurity)
save(indep_pan2, file = "CPTAC_purity.RData")

indep_pan2_plot <- na.omit(indep_pan2)
ggplot(indep_pan2_plot, aes(x=estiPurity, y=nucleiPurity, color=cancer)) + 
  geom_point() +
  labs(x="purity from genomic data", y="purity from nuclei")

ggplot(indep_pan2, aes(x=cancer, y=estiPurity, color=cancer)) + geom_jitter()

ggplot(indep_pan2, aes(x=cancer, y=nucleiPurity, color=cancer)) + geom_jitter()

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API