Skip to content

Commit

Permalink
Merge pull request #335 from Nesvilab/rc-v4.2.1
Browse files Browse the repository at this point in the history
Rc v4.2.1
  • Loading branch information
Felipe da Veiga Leprevost committed Apr 5, 2022
2 parents d65baad + 410a8ab commit ba170ca
Show file tree
Hide file tree
Showing 68 changed files with 1,814 additions and 1,676 deletions.
65 changes: 15 additions & 50 deletions cmd/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"philosopher/lib/msg"
"philosopher/lib/qua"
"philosopher/lib/rep"
"philosopher/lib/sys"

"github.com/davecgh/go-spew/spew"
"github.com/spf13/cobra"
"github.com/vmihailenco/msgpack"
)

var object string
Expand All @@ -34,90 +34,54 @@ var inspectCmd = &cobra.Command{
var o met.Data

target := fmt.Sprintf(".meta%smeta.bin", string(filepath.Separator))
file, _ := os.Open(target)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&o)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}
sys.Restore(&o, target, false)

if key == "session" {
fmt.Println(o.UUID)
} else {
spew.Dump(o)
}

case "psm":
var o rep.PSMEvidenceList

target := fmt.Sprintf(".meta%spsm.bin", string(filepath.Separator))
file, _ := os.Open(target)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&o)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}
sys.Restore(&o, target, false)
spew.Dump(o)

case "peptide":
var o rep.PeptideEvidenceList

target := fmt.Sprintf(".meta%spep.bin", string(filepath.Separator))
file, _ := os.Open(target)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&o)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}
sys.Restore(&o, target, false)
spew.Dump(o)

case "db":
var o dat.Base

target := fmt.Sprintf(".meta%sdb.bin", string(filepath.Separator))
file, _ := os.Open(target)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&o)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}
sys.Restore(&o, target, false)
spew.Dump(o.Records)

case "lfq":
var o qua.LFQ

target := fmt.Sprintf(".meta%slfq.bin", string(filepath.Separator))
file, _ := os.Open(target)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&o)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}
sys.Restore(&o, target, false)
spew.Dump(o.Intensities)

case "razor":
var o fil.RazorMap

target := fmt.Sprintf(".meta%srazor.bin", string(filepath.Separator))
file, _ := os.Open(target)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&o)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}
sys.Restore(&o, target, false)
spew.Dump(o)

case "protein":
var o rep.ProteinEvidenceList

target := fmt.Sprintf(".meta%spro.bin", string(filepath.Separator))
file, _ := os.Open(target)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&o)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}
sys.Restore(&o, target, false)

if len(key) > 0 {

Expand All @@ -130,6 +94,7 @@ var inspectCmd = &cobra.Command{
} else {
spew.Dump(o)
}

default:
msg.Custom(errors.New("the option is not available"), "fatal")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/proproph.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func init() {
proprophCmd.Flags().BoolVarP(&m.ProteinProphet.Glyc, "glyc", "", false, "highlight peptide N-glycosylation motif")
proprophCmd.Flags().BoolVarP(&m.ProteinProphet.Fpkm, "fpkm", "", false, "model protein FPKM values")
proprophCmd.Flags().BoolVarP(&m.ProteinProphet.NonSP, "nonsp", "", false, "do not use NSP model")
proprophCmd.Flags().BoolVarP(&m.ProteinProphet.Subgroups, "subgroups", "", false, "do not use NOGROUPS")
proprophCmd.Flags().IntVarP(&m.ProteinProphet.Minindep, "minindep", "", 0, "minimum percentage of independent peptides required for a protein")
proprophCmd.Flags().Float64VarP(&m.ProteinProphet.Minprob, "minprob", "", 0.05, "PeptideProphet probability threshold")
proprophCmd.Flags().IntVarP(&m.ProteinProphet.Maxppmdiff, "maxppmdiff", "", 2000000, "maximum peptide mass difference in ppm")
Expand Down
6 changes: 1 addition & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.13
require (
github.com/ajstarks/svgo v0.0.0-20200204031535-0cbcf57ea1d8 // indirect
github.com/davecgh/go-spew v1.1.1
github.com/golang/protobuf v1.3.4 // indirect
github.com/gorilla/websocket v1.4.1 // indirect
github.com/jpillora/go-ogle-analytics v0.0.0-20161213085824-14b04e0594ef
github.com/jung-kurt/gofpdf v1.16.2 // indirect
Expand All @@ -22,15 +21,12 @@ require (
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.6
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.5.1 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible
github.com/vmihailenco/msgpack/v5 v5.3.5
golang.org/x/exp v0.0.0-20200228211341-fcea875c7e85 // indirect
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
golang.org/x/net v0.0.0-20200301022130-244492dfa37a // indirect
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
gonum.org/v1/netlib v0.0.0-20200229103305-d71f404090bf // indirect
gonum.org/v1/plot v0.7.0
google.golang.org/appengine v1.6.5 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.2.8
)
23 changes: 10 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4er
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
Expand Down Expand Up @@ -100,6 +98,8 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.6.0 h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=
github.com/pkg/profile v1.6.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
Expand Down Expand Up @@ -139,12 +139,14 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU=
github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc=
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
Expand Down Expand Up @@ -179,10 +181,7 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -202,11 +201,9 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
Expand All @@ -223,8 +220,6 @@ gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZ
gonum.org/v1/plot v0.7.0 h1:Otpxyvra6Ie07ft50OX5BrCfS/BWEMvhsCUHwPEJmLI=
gonum.org/v1/plot v0.7.0/go.mod h1:2wtU6YrrdQAhAF9+MTd5tOQjrov/zF70b1i99Npjvgo=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
Expand All @@ -239,6 +234,8 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
Expand Down
13 changes: 5 additions & 8 deletions lib/aba/pep.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"philosopher/lib/mod"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -104,9 +105,6 @@ func peptideLevelAbacus(m met.Data, args []string) {
// processPeptideCombinedFile reads and filter the combined peptide report
func processPeptideCombinedFile(a met.Abacus) {

var pepID id.PepIDList
var filteredPeptides id.PepIDList

if _, e := os.Stat("combined.pep.xml"); os.IsNotExist(e) {

msg.NoParametersFound(errors.New("cannot find the combined.pep.xml file"), "fatal")
Expand All @@ -116,13 +114,12 @@ func processPeptideCombinedFile(a met.Abacus) {
var pep id.PepXML
pep.DecoyTag = a.Tag

pepID, _ = id.ReadPepXMLInput("combined.pep.xml", a.Tag, sys.GetTemp(), false)

pepID, _ := id.ReadPepXMLInput("combined.pep.xml", a.Tag, sys.GetTemp(), false)
//uniqPsms := fil.GetUniquePSMs(pepID)
uniqPeps := fil.GetUniquePeptides(pepID)

//filteredPSMs, _ := fil.PepXMLFDRFilter(uniqPsms, 0.01, "PSM", a.Tag)
filteredPeptides, _ = fil.PepXMLFDRFilter(uniqPeps, 0.01, "Peptide", a.Tag)
filteredPeptides, _ := fil.PepXMLFDRFilter(uniqPeps, 0.01, "Peptide", a.Tag)
filteredPeptides.Serialize("pep")

}
Expand Down Expand Up @@ -179,8 +176,8 @@ func SummarizeAttributes(evidences rep.CombinedPeptideEvidenceList, datasets map

for _, j := range evi.Peptides {

for _, k := range j.Modifications.Index {
if k.Type == "Assigned" {
for _, k := range j.Modifications.IndexSlice {
if k.Type == mod.Assigned {
mass := strconv.FormatFloat(k.MassDiff, 'f', 6, 64)
ModsMap[j.Sequence] = append(ModsMap[j.Sequence], mass)
}
Expand Down
13 changes: 6 additions & 7 deletions lib/aba/pro.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"os"
"path/filepath"
"sort"
"strconv"
"strings"

"philosopher/lib/iso"
Expand Down Expand Up @@ -196,7 +195,7 @@ func processProteinCombinedFile(a met.Abacus, database dat.Base) rep.CombinedPro

ce.SupportingSpectra = make(map[string]string)
ce.ProteinName = j.ProteinName
ce.Length, _ = strconv.Atoi(j.Length)
ce.Length = j.Length
ce.Coverage = j.PercentCoverage
ce.GroupNumber = j.GroupNumber
ce.SiblingID = j.GroupSiblingID
Expand Down Expand Up @@ -312,9 +311,9 @@ func getProteinLabelIntensities(combined rep.CombinedProteinEvidenceList, datase
for i := range combined {
for _, j := range v.Proteins {
if combined[i].ProteinID == j.ProteinID && !strings.Contains(j.OriginalHeader, decoyTag) {
combined[i].TotalLabels[k] = j.TotalLabels
combined[i].UniqueLabels[k] = j.UniqueLabels
combined[i].URazorLabels[k] = j.URazorLabels
combined[i].TotalLabels[k] = *j.TotalLabels
combined[i].UniqueLabels[k] = *j.UniqueLabels
combined[i].URazorLabels[k] = *j.URazorLabels
break
}
}
Expand All @@ -330,9 +329,9 @@ func sumProteinIntensities(combined rep.CombinedProteinEvidenceList, datasets ma

for k, v := range datasets {

var ions = make(map[string]float64)
var ions = make(map[id.IonFormType]float64)
for _, i := range v.Ions {
ions[i.IonForm] = i.Intensity
ions[i.IonForm()] = i.Intensity
}

for _, i := range combined {
Expand Down
26 changes: 4 additions & 22 deletions lib/dat/dat.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"philosopher/lib/sys"

"github.com/sirupsen/logrus"
"github.com/vmihailenco/msgpack"
"github.com/vmihailenco/msgpack/v5"
)

// Base main structure
Expand Down Expand Up @@ -234,7 +234,7 @@ func (d *Base) Create(temp, add, enz, tag string, crap, noD, cTag bool) {

for k, v := range crapMap {

if cTag {
if cTag && !strings.Contains(k, "_HUMAN") && !strings.Contains(k, "OX=9606") {
k = "contam_" + k
}

Expand Down Expand Up @@ -361,33 +361,15 @@ func (d *Base) Serialize() {

// Restore reads philosopher results files and restore the data sctructure
func (d *Base) Restore() {

b, e := ioutil.ReadFile(sys.DBBin())
if e != nil {
msg.MarshalFile(e, "warning")
}

e = msgpack.Unmarshal(b, &d)
if e != nil {
msg.SerializeFile(e, "warning")
}

sys.Restore(d, sys.DBBin(), false)
}

// RestoreWithPath reads philosopher results files and restore the data sctructure
func (d *Base) RestoreWithPath(p string) {

path := fmt.Sprintf("%s%s%s", p, string(filepath.Separator), sys.DBBin())
path, _ = filepath.Abs(path)

file, _ := os.Open(path)

dec := msgpack.NewDecoder(file)
e := dec.Decode(&d)
if e != nil {
msg.DecodeMsgPck(e, "fatal")
}

sys.Restore(d, path, false)
}

// reverseSeq returns its argument string reversed rune-wise left to right.
Expand Down
2 changes: 1 addition & 1 deletion lib/dat/dat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func TestBase_ProcessDB(t *testing.T) {
}
d.ProcessDB(tt.args.file, tt.args.decoyTag)

if len(d.Records) != 20360 {
if len(d.Records) != 20361 {
t.Errorf("Number of FASTA entries is incorrect, got %d, want %d", len(d.Records), 20360)
}
})
Expand Down
Loading

0 comments on commit ba170ca

Please sign in to comment.