Skip to content

Commit

Permalink
Merge pull request #136 from Nesvilab/dev
Browse files Browse the repository at this point in the history
restoring the pipeline functions
  • Loading branch information
Felipe Leprevost committed May 20, 2020
2 parents 00bb132 + 8391699 commit c523573
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 89 deletions.
8 changes: 1 addition & 7 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
### Added
- Added keepold flag for PTMProphet.

### Changed
- Philosopher will ignore the interact file when interact.mod is present.
- Improved quantification mapping to all runs. The --mapmods option is only necessary to print mod reports.
- The number of tryptic ternmini is now determined by ProteinProphet.

### Fixed
- Error preventing iTRAQ quantification.
- Several formatting, typoes and Go-Vet issues were fixed.
- Pipeline functions were restored.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BINARY = philosopher
VERSION = $(shell date +%Y%m%d)
BUILD = $(shell date +%Y%m%d%H%M)

TAG = v3.2.4
TAG = v3.2.5

LDFLAGS = -ldflags "-w -s -X main.version=${TAG} -X main.build=${BUILD}"

Expand Down
35 changes: 22 additions & 13 deletions cmd/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"philosopher/lib/met"
"philosopher/lib/msg"
"philosopher/lib/pip"
"philosopher/lib/sla"
"philosopher/lib/sys"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -77,34 +78,42 @@ var pipelineCmd = &cobra.Command{
meta = pip.DatabaseSearch(meta, p, dir, args)
}

// PeptideProphet - PTMProphet - ProteinProphet
if p.PeptideProphet.Concurrent == true {
meta = pip.ParallelProphets(meta, p, dir, args)
} else {
meta = pip.Prophets(meta, p, dir, args)
// PeptideProphet
if p.Commands.PeptideProphet == "yes" {
meta = pip.PeptideProphet(meta, p, dir, args)
}

// PTMProphet
if p.Commands.PTMProphet == "yes" {
meta = pip.PTMProphet(meta, p, dir, args)
}

// ProteinProphet
if p.Commands.ProteinProphet == "yes" {
meta = pip.ProteinProphet(meta, p, dir, args)
}

// Abacus - combined pepxml
//meta = pip.CombinedPeptideList(meta, p, dir, args)
meta = pip.CombinedPeptideList(meta, p, dir, args)

// Abacus - combined protxml
//meta = pip.CombinedProteinList(meta, p, dir, args)
meta = pip.CombinedProteinList(meta, p, dir, args)

// Filter - Quantification - Clustering - Report
//meta = pip.FilterQuantifyReport(meta, p, dir, args)
meta = pip.FilterQuantifyReport(meta, p, dir, args)

// Abacus
//meta = pip.Abacus(meta, p, dir, args)
meta = pip.Abacus(meta, p, dir, args)

// TMT-Integrator
//meta = pip.TMTIntegrator(meta, p, dir, args)
meta = pip.TMTIntegrator(meta, p, dir, args)

// Backup and Clean
//pip.BackupAndClean(meta, p, dir, Version, Build, args)

// if len(p.SlackToken) > 0 {
// sla.Run("Philosopher", p.SlackToken, "Philosopher pipeline is done", p.SlackChannel, p.SlackUserID)
// }
if len(p.SlackToken) > 0 {
sla.Run("Philosopher", p.SlackToken, "Philosopher pipeline is done", p.SlackChannel, p.SlackUserID)
}

met.CleanTemp(meta.Temp)

Expand Down
Binary file modified lib/pip/bindata.go.zip
Binary file not shown.
198 changes: 132 additions & 66 deletions lib/pip/pip.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,95 +273,161 @@ func Prophets(meta met.Data, p Directives, dir string, data []string) met.Data {
return meta
}

// ParallelProphets execute the TPP Prophets
func ParallelProphets(meta met.Data, p Directives, dir string, data []string) met.Data {
// PeptideProphet executes PeptideProphet in Parallel mode
func PeptideProphet(meta met.Data, p Directives, dir string, data []string) met.Data {

var wg sync.WaitGroup
wg.Add(len(data))
if p.PeptideProphet.Concurrent == false {
for _, i := range data {

meta.Restore(sys.Meta())
meta.Database = p.Database
logrus.Info("Running the validation and inference on ", i)

if p.Commands.PeptideProphet == "yes" || p.Commands.ProteinProphet == "yes" || p.Commands.PTMProphet == "yes" {
// getting inside de the dataset folder
dsAbs, _ := filepath.Abs(i)
os.Chdir(dsAbs)

if p.Commands.PeptideProphet == "yes" {
for _, ds := range data {
// // reload the meta data
meta.Restore(sys.Meta())

db := p.Database.Annot
// PeptideProphet
if p.Commands.PeptideProphet == "yes" {
logrus.Info("Executing PeptideProphet on ", i)
meta.PeptideProphet = p.PeptideProphet
meta.PeptideProphet.Database = p.Database.Annot
meta.PeptideProphet.Decoy = p.Database.Tag
meta.PeptideProphet.Output = "interact"
meta.PeptideProphet.Combine = true
gobExt := fmt.Sprintf("*.%s", p.PeptideProphet.FileExtension)
files, e := filepath.Glob(gobExt)
if e != nil {
msg.Custom(e, "fatal")
}
peptideprophet.Run(meta, files)
meta.Serialize()
}

go func(ds, db string) {
defer wg.Done()
// return to the top level directory
os.Chdir(dir)
}
} else {

logrus.Info("Running the validation and inference on ", ds)
var wg sync.WaitGroup
wg.Add(len(data))

// getting inside de the dataset folder
dsAbs, _ := filepath.Abs(ds)
absMeta := fmt.Sprintf("%s%s%s", dsAbs, string(filepath.Separator), sys.Meta())
meta.Restore(sys.Meta())
meta.Database = p.Database

// reload the meta data
meta.Restore(absMeta)
for _, ds := range data {

// PeptideProphet
logrus.Info("Executing PeptideProphet on ", ds)
meta.PeptideProphet = p.PeptideProphet
meta.PeptideProphet.Database = p.Database.Annot
meta.PeptideProphet.Decoy = p.Database.Tag
meta.PeptideProphet.Output = "interact"
meta.PeptideProphet.Combine = true
db := p.Database.Annot

gobExt := fmt.Sprintf("%s%s*.%s", dsAbs, string(filepath.Separator), p.PeptideProphet.FileExtension)
go func(ds, db string) {
defer wg.Done()

files, e := filepath.Glob(gobExt)
if e != nil {
msg.Custom(e, "fatal")
}
logrus.Info("Running the validation and inference on ", ds)

peptideprophet.Run(meta, files)
// getting inside de the dataset folder
dsAbs, _ := filepath.Abs(ds)
absMeta := fmt.Sprintf("%s%s%s", dsAbs, string(filepath.Separator), sys.Meta())

// give a chance to the execution to untangle the output
time.Sleep(time.Second * 1)
// reload the meta data
meta.Restore(absMeta)

}(ds, db)
}
// PeptideProphet
logrus.Info("Executing PeptideProphet on ", ds)
meta.PeptideProphet = p.PeptideProphet
meta.PeptideProphet.Database = p.Database.Annot
meta.PeptideProphet.Decoy = p.Database.Tag
meta.PeptideProphet.Output = "interact"
meta.PeptideProphet.Combine = true

wg.Wait()
gobExt := fmt.Sprintf("%s%s*.%s", dsAbs, string(filepath.Separator), p.PeptideProphet.FileExtension)

files, e := filepath.Glob(gobExt)
if e != nil {
msg.Custom(e, "fatal")
}

peptideprophet.Run(meta, files)

// give a chance to the execution to untangle the output
time.Sleep(time.Second * 1)

}(ds, db)
}

// // PTMProphet
// if p.Commands.PTMProphet == "yes" {
// logrus.Info("Executing PTMProphet on ", i)
// meta.PTMProphet = p.PTMProphet
// var files []string
// files = append(files, "interact.pep.xml")
// meta.PTMProphet.InputFiles = files
// ptmprophet.Run(meta, files)
// meta.Serialize()
// }

// // ProteinProphet
// if p.Commands.ProteinProphet == "yes" {
// logrus.Info("Executing ProteinProphet on ", i)
// meta.ProteinProphet = p.ProteinProphet
// meta.ProteinProphet.Output = "interact"
// var files []string
// if p.Commands.PTMProphet == "yes" {
// files = append(files, "interact.mod.pep.xml")
// } else {
// files = append(files, "interact.pep.xml")
// }
// proteinprophet.Run(meta, files)
// meta.Serialize()
// }
wg.Wait()
}

// return to the top level directory
//os.Chdir(dir)
os.Chdir(dir)

return meta
}

// PTMProphet execute the TPP PTMProphet
func PTMProphet(meta met.Data, p Directives, dir string, data []string) met.Data {

for _, i := range data {

logrus.Info("Running the validation and inference on ", i)

// getting inside de the dataset folder
dsAbs, _ := filepath.Abs(i)
os.Chdir(dsAbs)

// reload the meta data
//meta.Restore(sys.Meta())
// /}
meta.Restore(sys.Meta())

// PTMProphet
if p.Commands.PTMProphet == "yes" {
logrus.Info("Executing PTMProphet on ", i)
meta.PTMProphet = p.PTMProphet
var files []string
files = append(files, "interact.pep.xml")
meta.PTMProphet.InputFiles = files
ptmprophet.Run(meta, files)
meta.Serialize()
}

// return to the top level directory
os.Chdir(dir)
}

os.Chdir(dir)
return meta
}

// ProteinProphet execute the TPP ProteinProphet
func ProteinProphet(meta met.Data, p Directives, dir string, data []string) met.Data {

for _, i := range data {

logrus.Info("Running the validation and inference on ", i)

// getting inside de the dataset folder
dsAbs, _ := filepath.Abs(i)
os.Chdir(dsAbs)

// reload the meta data
meta.Restore(sys.Meta())

// ProteinProphet
if p.Commands.ProteinProphet == "yes" {
logrus.Info("Executing ProteinProphet on ", i)
meta.ProteinProphet = p.ProteinProphet
meta.ProteinProphet.Output = "interact"
var files []string
if p.Commands.PTMProphet == "yes" {
files = append(files, "interact.mod.pep.xml")
} else {
files = append(files, "interact.pep.xml")
}
proteinprophet.Run(meta, files)
meta.Serialize()
met.CleanTemp(meta.Temp)
}

// return to the top level directory
os.Chdir(dir)
}

return meta
}
Expand Down
5 changes: 3 additions & 2 deletions philosopher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ abacus:
uniqueOnly: false # report TMT quantification based on only unique peptides
reprint: false # create abacus reports using the Reprint format

tmtintegrator: # v1.1.8
tmtintegrator: # v1.1.10
path: # path to TMT-Integrator jar
memory: 6 # memory allocation, in Gb
output: # the location of output files
Expand All @@ -282,4 +282,5 @@ tmtintegrator: # v1.1.8
top3_pep: true # use top 3 most intense peptide ions as part of the reference sample abundance estimation
print_RefInt: false # print individual reference sample abundance estimates for each multiplex in the final reports (in addition to the combined reference sample abundance estimate)
add_Ref: -1 # add an artificial reference channel if there is no reference channel (-1: don't add the reference; 0: use summation as the reference; 1: use average as the reference; 2: use median as the reference)
max_pep_prob_thres: 0 # the threshold for maximum peptide probability
max_pep_prob_thres: 0 # the threshold for maximum peptide probability
min_ntt: 0 # minimum allowed number of enzymatic termini

0 comments on commit c523573

Please sign in to comment.