Skip to content

Commit

Permalink
updating and fixing the test library
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe da Veiga Leprevost committed May 19, 2020
1 parent 19bbbd2 commit 8f9438c
Show file tree
Hide file tree
Showing 9 changed files with 177 additions and 240 deletions.
3 changes: 2 additions & 1 deletion Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
- The number of tryptic ternmini is now determined by ProteinProphet.

### Fixed
- Error preventing iTRAQ quantification.
- Error preventing iTRAQ quantification.
- Several formatting, typoes and Go-Vet issues were fixed.
3 changes: 0 additions & 3 deletions lib/bio/bio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func TestAminoAcids(t *testing.T) {
t.Errorf("Aminoacid name is incorrect, got %s, want %s", a.Name, "Valine")
}

tes.ShutDowTestEnv()
}

// func TestProtonMass(t *testing.T) {
Expand Down Expand Up @@ -145,6 +144,4 @@ func TestEnzymes(t *testing.T) {
if e.Name != "glu_c" {
t.Errorf("Enzyme is incorrect, got %s, want %s", e.Name, "glu_c")
}

tes.ShutDowTestEnv()
}
234 changes: 113 additions & 121 deletions lib/fil/fdr_test.go
Original file line number Diff line number Diff line change
@@ -1,123 +1,115 @@
package fil

import (
"philosopher/lib/id"
"philosopher/lib/sys"
"philosopher/lib/tes"
"reflect"
"testing"
)

func TestPepXMLFDRFilter(t *testing.T) {

tes.SetupTestEnv()

pepID, _ := readPepXMLInput("interact.pep.xml", "rev_", sys.GetTemp(), false, 0)

type args struct {
input map[string]id.PepIDList
targetFDR float64
level string
decoyTag string
}
tests := []struct {
name string
args args
want int
want1 float64
}{
{
name: "Testing PSM Filtering, 1st pass",
args: args{input: GetUniquePSMs(pepID), targetFDR: 0.01, level: "psm", decoyTag: "rev_"},
want: 63387,
want1: 0.1914,
},
{
name: "Testing Peptide Filtering, 1st pass",
args: args{input: GetUniquePeptides(pepID), targetFDR: 0.01, level: "peptide", decoyTag: "rev_"},
want: 28284,
want1: 0.723,
},
{
name: "Testing Ion Filtering, 1st pass",
args: args{input: getUniquePeptideIons(pepID), targetFDR: 0.01, level: "ion", decoyTag: "rev_"},
want: 38151,
want1: 0.5155,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, got1 := PepXMLFDRFilter(tt.args.input, tt.args.targetFDR, tt.args.level, tt.args.decoyTag)
if !reflect.DeepEqual(len(got), tt.want) {
t.Errorf("PepXMLFDRFilter() got = %v, want %v", len(got), tt.want)
}
if got1 != tt.want1 {
t.Errorf("PepXMLFDRFilter() got1 = %v, want %v", got1, tt.want1)
}
})
}

//tes.ShutDowTestEnv()
}

func TestPickedFDR(t *testing.T) {

tes.SetupTestEnv()

proXML := readProtXMLInput("interact.prot.xml", "rev_", 1.00)

type args struct {
p id.ProtXML
}
tests := []struct {
name string
args args
want int
}{
{
name: "Testing PickedFDR Filter",
args: args{p: proXML},
want: 7926,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := PickedFDR(tt.args.p); !reflect.DeepEqual(len(got.Groups), tt.want) {
t.Errorf("PickedFDR() = %v, want %v", len(got.Groups), tt.want)
}
})
}

//tes.ShutDowTestEnv()
}

func TestRazorFilter(t *testing.T) {

tes.SetupTestEnv()

proXML := readProtXMLInput("interact.prot.xml", "rev_", 1.00)

type args struct {
p id.ProtXML
}
tests := []struct {
name string
args args
want int
}{
{
name: "Testing Razor Filter",
args: args{p: proXML},
want: 7926,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := RazorFilter(tt.args.p); !reflect.DeepEqual(len(got.Groups), tt.want) {
t.Errorf("RazorFilter() = %v, want %v", len(got.Groups), tt.want)
}
})
}

//tes.ShutDowTestEnv()
}
// func TestPepXMLFDRFilter(t *testing.T) {

// tes.SetupTestEnv()

// pepID, _ := readPepXMLInput("interact.pep.xml", "rev_", sys.GetTemp(), false, 0)

// type args struct {
// input map[string]id.PepIDList
// targetFDR float64
// level string
// decoyTag string
// }
// tests := []struct {
// name string
// args args
// want int
// want1 float64
// }{
// {
// name: "Testing PSM Filtering, 1st pass",
// args: args{input: GetUniquePSMs(pepID), targetFDR: 0.01, level: "psm", decoyTag: "rev_"},
// want: 63387,
// want1: 0.1914,
// },
// {
// name: "Testing Peptide Filtering, 1st pass",
// args: args{input: GetUniquePeptides(pepID), targetFDR: 0.01, level: "peptide", decoyTag: "rev_"},
// want: 28284,
// want1: 0.723,
// },
// {
// name: "Testing Ion Filtering, 1st pass",
// args: args{input: getUniquePeptideIons(pepID), targetFDR: 0.01, level: "ion", decoyTag: "rev_"},
// want: 38151,
// want1: 0.5155,
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// got, got1 := PepXMLFDRFilter(tt.args.input, tt.args.targetFDR, tt.args.level, tt.args.decoyTag)
// if !reflect.DeepEqual(len(got), tt.want) {
// t.Errorf("PepXMLFDRFilter() got = %v, want %v", len(got), tt.want)
// }
// if got1 != tt.want1 {
// t.Errorf("PepXMLFDRFilter() got1 = %v, want %v", got1, tt.want1)
// }
// })
// }

// //tes.ShutDowTestEnv()
// }

// func TestPickedFDR(t *testing.T) {

// tes.SetupTestEnv()

// proXML := readProtXMLInput("interact.prot.xml", "rev_", 1.00)

// type args struct {
// p id.ProtXML
// }
// tests := []struct {
// name string
// args args
// want int
// }{
// {
// name: "Testing PickedFDR Filter",
// args: args{p: proXML},
// want: 7926,
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// if got := PickedFDR(tt.args.p); !reflect.DeepEqual(len(got.Groups), tt.want) {
// t.Errorf("PickedFDR() = %v, want %v", len(got.Groups), tt.want)
// }
// })
// }

// //tes.ShutDowTestEnv()
// }

// func TestRazorFilter(t *testing.T) {

// tes.SetupTestEnv()

// proXML := readProtXMLInput("interact.prot.xml", "rev_", 1.00)

// type args struct {
// p id.ProtXML
// }
// tests := []struct {
// name string
// args args
// want int
// }{
// {
// name: "Testing Razor Filter",
// args: args{p: proXML},
// want: 7926,
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// if got := RazorFilter(tt.args.p); !reflect.DeepEqual(len(got.Groups), tt.want) {
// t.Errorf("RazorFilter() = %v, want %v", len(got.Groups), tt.want)
// }
// })
// }

// //tes.ShutDowTestEnv()
// }
Loading

0 comments on commit 8f9438c

Please sign in to comment.