Skip to content

Commit

Permalink
add classification
Browse files Browse the repository at this point in the history
  • Loading branch information
MeenaChoi committed Jul 2, 2018
1 parent 9622d81 commit dd64735
Show file tree
Hide file tree
Showing 12 changed files with 1,200 additions and 1,040 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: MSstats
Title: Protein Significance Analysis in DDA, SRM and DIA for Label-free
or Label-based Proteomics Experiments
Version: 3.13.3
Date: 2018-06-01
Version: 3.13.4
Date: 2018-07-02
Description: A set of tools for statistical relative protein significance analysis in DDA, SRM and DIA experiments.
Authors@R: c(
person("Meena","Choi", , "[email protected]", c("aut", "cre")),
Expand Down
17 changes: 14 additions & 3 deletions R/DIAUmpiretoMSstatsFormat.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,22 @@ DIAUmpiretoMSstatsFormat <- function(raw.frag, raw.pep, raw.pro,

if (is.null(annotation)) {
stop('** Please prepare \'annotation\' as one of input.')
} else {
## check annotation
required.annotation <- c('Condition', 'BioReplicate', 'Run')

if (!all(required.annotation %in% colnames(annotation))) {

missedAnnotation <- which(!(required.annotation %in% colnames(annotation)))

stop(paste("**", toString(required.annotation[missedAnnotation]),
"is not provided in Annotation. Please check the annotation file."))
} else {
### annotation.txt : Condition, BioReplicate, Run,
annot <- annotation
}
}

### annotation.txt : Raw.file, Condition, BioReplicate, Run, (IsotopeLabelType)
annot <- annotation

########################
## 1. get selected frag from DIA-Umpire
########################
Expand Down
11 changes: 11 additions & 0 deletions R/MaxQtoMSstatsFormat.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ MaxQtoMSstatsFormat <- function(evidence,
## annotation.txt : Raw.file, Condition, BioReplicate, Run, (IsotopeLabelType)
annot <- annotation

## check annotation
required.annotation <- c('Raw.file', 'Condition', 'BioReplicate', 'Run', 'IsotopeLabelType')

if (!all(required.annotation %in% colnames(annot))) {

missedAnnotation <- which(!(required.annotation %in% colnames(annot)))

stop(paste("**", toString(required.annotation[missedAnnotation]),
"is not provided in Annotation. Please check the annotation file."))
}

################################################
## 1.1 remove contaminant, reverse proteinID
## Contaminant, Reverse column in evidence
Expand Down
14 changes: 13 additions & 1 deletion R/OpenMStoMSstatsFormat.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ OpenMStoMSstatsFormat <- function(input,
if (is.null(annotation)) {
annotinfo <- unique(input[, c("Run", "Condition", 'BioReplicate')])
} else {
annotinfo <- annotation

## check annotation
required.annotation <- c('Condition', 'BioReplicate', 'Run')

if (!all(required.annotation %in% colnames(annotation))) {

missedAnnotation <- which(!(required.annotation %in% colnames(annotation)))

stop(paste("**", toString(required.annotation[missedAnnotation]),
"is not provided in Annotation. Please check the annotation file."))
} else {
annotinfo <- annotation
}
}

##############################
Expand Down
14 changes: 13 additions & 1 deletion R/OpenSWATHtoMSstatsFormat.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ OpenSWATHtoMSstatsFormat <- function(input,
if (is.null(annotation)) {
stop('** Please prepare \'annotation\' as one of input.')
} else {
annotinfo <- annotation

## check annotation
required.annotation <- c('Condition', 'BioReplicate', 'Run')

if (!all(required.annotation %in% colnames(annotation))) {

missedAnnotation <- which(!(required.annotation %in% colnames(annotation)))

stop(paste("**", toString(required.annotation[missedAnnotation]),
"is not provided in Annotation. Please check the annotation file."))
} else {
annotinfo <- annotation
}
}

## Check correct option or input
Expand Down
47 changes: 45 additions & 2 deletions R/PDtoMSstatsFormat.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ PDtoMSstatsFormat <- function(input,
which.proteinid = 'Protein.Group.Accessions',
which.sequence = 'Sequence'){

## check annotation
required.annotation <- c('Condition', 'BioReplicate', 'Run')

if (!all(required.annotation %in% colnames(annotation))) {

missedAnnotation <- which(!(required.annotation %in% colnames(annotation)))

stop(paste("**", toString(required.annotation[missedAnnotation]),
"is not provided in Annotation. Please check the annotation file.",
"'Run' will be matched with 'Spectrum.File' "))
}

################################################
## 0.1. which intensity : Precursor.Area vs. Intensity vs Area
################################################
Expand Down Expand Up @@ -244,7 +256,38 @@ PDtoMSstatsFormat <- function(input,
rm(input.final)

##############################
## 6. remove features which has 1 or 2 measurements across runs
## 6. remove featuares with all na or zero
## some rows have all zero values across all MS runs. They should be removed.
##############################

input$fea <- paste(input$PeptideModifiedSequence,
input$PrecursorCharge,
input$FragmentIon,
input$ProductCharge,
sep="_")

inputtmp <- input[!is.na(input$Intensity) & input$Intensity > 1, ]

count <- inputtmp %>% group_by(fea) %>% summarise(length=length(Intensity))

## get feature with all NA or zeros
getfea <- count[count$length > 0, 'fea']

if (nrow(getfea) > 0) {

nfea.remove <- length(unique(input$fea))-nrow(getfea)
input <- input[which(input$fea %in% getfea$fea), ]

message(paste0('** ', nfea.remove, ' features have all NAs or zero intensity values and are removed.'))

}

rm(inputtmp)
input <- input[, -which(colnames(input) %in% c('fea'))]


##############################
## 7. remove features which has 1 or 2 measurements across runs
##############################
if (fewMeasurements=="remove") {

Expand All @@ -265,7 +308,7 @@ PDtoMSstatsFormat <- function(input,
}

##############################
## 7. remove proteins with only one peptide and charge per protein
## 8. remove proteins with only one peptide and charge per protein
##############################

if (removeProtein_with1Peptide) {
Expand Down
Loading

0 comments on commit dd64735

Please sign in to comment.