[med-svn] [pipasic] 01/03: Upstream contains several private path specifications. Try to find sensible defaults
Andreas Tille
tille at debian.org
Thu Oct 1 19:50:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository pipasic.
commit 10393d73cc3383fa40b402e8c89248a23f063a43
Author: Andreas Tille <tille at debian.org>
Date: Thu Oct 1 14:34:46 2015 +0200
Upstream contains several private path specifications. Try to find sensible defaults
---
debian/patches/debug.patch | 31 +++++++++++
debian/patches/inspect_files.patch | 100 ++++++++++++++++++++++++++++++++++
debian/patches/series | 2 +
debian/pipasic-examples.README.Debian | 2 +
debian/pipasic-examples.postinst | 13 +++++
debian/pipasic.1 | 4 +-
debian/rules | 10 +++-
debian/tests/run-unit-test | 17 +++---
8 files changed, 169 insertions(+), 10 deletions(-)
diff --git a/debian/patches/debug.patch b/debian/patches/debug.patch
new file mode 100644
index 0000000..bd2aa7c
--- /dev/null
+++ b/debian/patches/debug.patch
@@ -0,0 +1,31 @@
+--- a/pipasic.py
++++ b/pipasic.py
+@@ -129,7 +129,7 @@ Note: Pipasic requires two .fasta for ea
+ sample_counts.append(count)
+ correction = True
+ except:
+- print "Could not find PSM-file for %s and %s" %(spec,DB)
++ print "Could not find PSM-file '%s' for %s and %s" %(inspectOut,spec,DB)
+ sample_counts.append(0)
+ countList.append(sample_counts)
+ np.array(countList).dump(os.path.splitext(outfile)[0]+"_counts.dat")
+@@ -193,7 +193,7 @@ Note: Pipasic requires two .fasta for ea
+ count = parseInspect(inpath=inspectOut,fdr_countcut=fdr,silent=False)[1]
+ sample_counts.append(count)
+ except:
+- print "Could not find PSM-file for %s and %s" %(spec,DB)
++ print "Could not find PSM-file for Inspect '%s' for %s and %s" %(inspectOut,spec,DB)
+ sample_counts.append(0)
+ countList.append(sample_counts)#np.transpose(sample_counts))
+ Counts = np.array(countList)
+--- a/trypticpeptides.py
++++ b/trypticpeptides.py
+@@ -448,7 +448,7 @@ def weightedMatrix(spectra_name, dbList,
+ if Tide:
+ identifiedPeptides = os.path.splitext(spectra_name)[0] +"_"+ os.path.splitext(os.path.basename(DBi))[0] +"_TideOut_parsed.txt"
+ if not os.path.exists(identifiedPeptides):
+- print "Could not find PSM-file for %s and %s" %(spectra_name,DBi)
++ print "Could not find PSM-file '%s' for %s and %s" %(identifiedPeptides,spectra_name,DBi)
+ continue
+ else:
+ inspectOut = os.path.splitext(spectra_name)[0] +"_"+ os.path.splitext(os.path.basename(DBi))[0] +"_InspectOut.txt"
diff --git a/debian/patches/inspect_files.patch b/debian/patches/inspect_files.patch
new file mode 100644
index 0000000..3430900
--- /dev/null
+++ b/debian/patches/inspect_files.patch
@@ -0,0 +1,100 @@
+Author: Andreas Tille <tille at debian.org>
+Last-update: Tue, 29 Sep 2015 15:21:50 +0200
+Description: Upstream code contains a lot of private dirs as
+ kind of default. Try to find sensible defaults here.
+
+--- a/simulation_based_similarity.py
++++ b/simulation_based_similarity.py
+@@ -115,7 +115,7 @@ from readMGF import sampleMGF as samplSp
+ '''
+
+ # 5.a prepare decoyDB input for Inspect (def)
+-def prepDB(fastaDB, path="/home/franziska/bin/Inspect/"):
++def prepDB(fastaDB, path="/usr/share/inspect/"):
+ if not os.path.exists(os.path.join(path,"PrepDB.py")):
+ print "InsPecT files not found, please correct path!"
+ return 0
+@@ -137,9 +137,9 @@ def run_inspect(configfile, outputfile,
+ return 1
+
+ # 1.-6. go all steps
+-def calculateSimilarityMatrix(DBs, db_path="/data/NG4/anke/proteome/", nProt=100, nSpec=1000,
++def calculateSimilarityMatrix(DBs, db_path="/var/lib/pipasic/proteome/", nProt=100, nSpec=1000,
+ sim_out_path="/data/NG4/anke/MSSim/sampled_data/", MSSim_ini="/data/NG4/anke/MSSim/mscconf_sebio02.ini",
+- inspect_config="/data/NG4/anke/Inspect/config_Inspect_MSSim.txt", inspect_dir="/home/franziska/bin/Inspect/"):
++ inspect_config="/data/NG4/anke/Inspect/config_Inspect_MSSim.txt", inspect_dir="/usr/share/inspect/"):
+ """
+ """
+ rng = range(len(DBs))
+@@ -204,11 +204,11 @@ and calculate FDR from Inspect output.
+ sys.stdout.flush()
+ # configure the parser
+ optparser = optparse.OptionParser(usage=usage)
+- optparser.add_option('-d', '--dbdir', type='string', dest='db_dir', default="/data/NG4/anke/proteome/", help='directory of proteinDBs. [default: %default]')
++ optparser.add_option('-d', '--dbdir', type='string', dest='db_dir', default="/var/lib/pipasic/proteome/", help='directory of proteinDBs. [default: %default]')
+ optparser.add_option('-p', '--proteinnumber', type='int', dest='nprot', default=100, help='number of samples from proteinDB. [default: %default]')
+ optparser.add_option('-n', '--numberspectra', type='int', dest='nspec', default=1000, help='number of samples from spectra. [default: %default]')
+ optparser.add_option('-c', '--configfile', type='string', dest='MSSim_ini', default="/data/NG4/anke/MSSim/mscconf_sebio02.ini", help='configuration file for MSSImulator. [default: %default]')
+- optparser.add_option('-i', '--inspectdir', type='string', dest='insp_dir', default="/home/franziska/bin/Inspect/", help="path to 'inspect.exe'. [default: %default]")
++ optparser.add_option('-i', '--inspectdir', type='string', dest='insp_dir', default="/usr/share/inspect/", help="path to 'inspect.exe'. [default: %default]")
+ optparser.add_option('-o', '--outfile', type='string', dest='out', default="/data/NG4/anke/Inspect/collectOutput.txt", help='name of file resulting matrix is written to. [default: %default]')
+ # parse options and arguments
+ options, args = optparser.parse_args()
+--- a/runInspect_user_config.py
++++ b/runInspect_user_config.py
+@@ -15,9 +15,9 @@ import optparse
+ #from InspectParser_FDRcut import parseInspect
+ from simulation_based_similarity import prepDB, run_inspect
+
+-def runInspect_config(spectra, DBs, spec_path, db_path="/data/NG4/anke/proteome/",
+- inspect_dir = "/home/franziska/bin/Inspect/",
+- conf = "/data/NG4/anke/Inspect/config_Inspect_py.txt", user_mods=""):
++def runInspect_config(spectra, DBs, spec_path, db_path="/var/lib/pipasic/proteome/",
++ inspect_dir = "/usr/share/inspect/",
++ conf = "/etc/pipasic/config_Inspect_py.txt", user_mods=""):
+ """
+ run Inspect for each pair of spectrum dataset and proteome database using
+ modifications according to the dataset in the configuration file.
+@@ -139,11 +139,11 @@ DB_LIST: ','-separated proteome-filename
+
+ # configure the parser
+ optparser = optparse.OptionParser(usage=usage)
+- optparser.add_option('-s', '--specdir', type='string', dest='spec_dir', default="/data/NG4/anke/spectra/", help='directory of specFiles (absolute path!). [default: %default]')
+- optparser.add_option('-d', '--dbdir', type='string', dest='db_dir', default="/data/NG4/anke/proteome/", help='directory of proteinDBs (absolute path!). [default: %default]')
+- optparser.add_option('-c', '--configfile', type='string', dest='config', default="/data/NG4/anke/Inspect/config_Inspect_py.txt", help='a txt-file for Inspect configuration, will be written. [default: %default]')
++ optparser.add_option('-s', '--specdir', type='string', dest='spec_dir', default="/var/lib/pipasic/spectra/", help='directory of specFiles (absolute path!). [default: %default]')
++ optparser.add_option('-d', '--dbdir', type='string', dest='db_dir', default="/var/lib/pipasic/proteome/", help='directory of proteinDBs (absolute path!). [default: %default]')
++ optparser.add_option('-c', '--configfile', type='string', dest='config', default="/etc/pipasic/config_Inspect_py.txt", help='a txt-file for Inspect configuration, will be written. [default: %default]')
+ optparser.add_option('-m', '--mods', type='string', dest='mods', default="", help='a string containing all modifications in question, modification choice by filename if "". [default: %default]')
+- optparser.add_option('-i', '--inspect_dir', type='string', dest='ins_dir', default="/home/franziska/bin/Inspect", help='directory of Inspect.exe. [default: %default]')
++ optparser.add_option('-i', '--inspect_dir', type='string', dest='ins_dir', default="/usr/share/inspect", help='directory of Inspect.exe. [default: %default]')
+
+ # parse options and arguments
+ options, args = optparser.parse_args()
+@@ -161,4 +161,4 @@ DB_LIST: ','-separated proteome-filename
+ mods = options.mods
+ inspect_dir = options.ins_dir'''
+ runInspect_config(spectra=spectra, DBs=db_list, spec_path=options.spec_dir, db_path=options.db_dir, inspect_dir=options.ins_dir, conf=options.config, user_mods=options.mods)
+-
+\ No newline at end of file
++
+--- a/trypticpeptides.py
++++ b/trypticpeptides.py
+@@ -298,7 +298,7 @@ def weightPeptides(identifiedPeptides, t
+ notfound = 0
+
+ '''# monitoring not found sequences
+- with open("/data/NG4/anke/spectra/Shigella_dysenteriae/out/testOutput.txt","w") as f:
++ with open("/var/lib/pipasic/spectra/Shigella_dysenteriae/out/testOutput.txt","w") as f:
+ f.write("")'''
+ if verbose: print "reading and searching sequences of identified peptides ..."
+ inF = open(identifiedPeptides,"r")
+@@ -340,7 +340,7 @@ def weightPeptides(identifiedPeptides, t
+ else:
+ notfound += 1
+ '''# monitoring not found sequences
+- with open("/data/NG4/anke/spectra/Shigella_dysenteriae/out/testOutput.txt","a") as f:
++ with open("/var/lib/pipasic/spectra/Shigella_dysenteriae/out/testOutput.txt","a") as f:
+ f.write(pep + "\tfrom\t" + line.split(sep)[2] + "\n")'''
+ # calculate weights from counts
+ if verbose: print "not found: %i of %i"%(notfound,sum(counts)+notfound)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..9ab31c7
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,2 @@
+inspect_files.patch
+debug.patch
diff --git a/debian/pipasic-examples.README.Debian b/debian/pipasic-examples.README.Debian
new file mode 100644
index 0000000..560be69
--- /dev/null
+++ b/debian/pipasic-examples.README.Debian
@@ -0,0 +1,2 @@
+The *.mgf file from the pipasic examples was moved to the
+spectra dir /var/lib/pipasic/spectra.
diff --git a/debian/pipasic-examples.postinst b/debian/pipasic-examples.postinst
new file mode 100644
index 0000000..487c7ff
--- /dev/null
+++ b/debian/pipasic-examples.postinst
@@ -0,0 +1,13 @@
+#!/bin/sh
+set -e
+
+pipasicdatadir=/var/lib/pipasic/
+
+case "$1" in
+ configure)
+ # enable write permission to everybody in pipasic data dir
+ find ${pipasicdatadir} -type d -exec chmod 777 \{\} \;
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/pipasic.1 b/debian/pipasic.1
index d6465e8..9610dc9 100644
--- a/debian/pipasic.1
+++ b/debian/pipasic.1
@@ -52,11 +52,11 @@ results.txt]
.TP
\fB\-s\fR SPEC_DIR, \fB\-\-spec_dir\fR=\fI\,SPEC_DIR\/\fR
Directory of SPECTRA (mgf) files. Search in current
-directory, if not given. [default: none]
+directory, if not given. [default: /var/lib/pipasic/spectra]
.TP
\fB\-d\fR DB_DIR, \fB\-\-db_dir\fR=\fI\,DB_DIR\/\fR
Directory of proteinDBs. Search for DB files current
-directory, if not given. [default: none]
+directory, if not given. [default: /var/lib/pipasic/proteome]
.TP
\fB\-m\fR MODS, \fB\-\-mods\fR=\fI\,MODS\/\fR
A string containing all modifications in question,
diff --git a/debian/rules b/debian/rules
index 5adafdd..4637b45 100755
--- a/debian/rules
+++ b/debian/rules
@@ -4,6 +4,8 @@
DEBPKGNAME := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')
pkgexample := $(DEBPKGNAME)-example
+spectradir := /var/lib/pipasic/spectra/
+proteomedir := /var/lib/pipasic/proteome/
%:
dh $@ --with python2
@@ -11,7 +13,13 @@ pkgexample := $(DEBPKGNAME)-example
override_dh_install:
dh_install
mkdir -p debian/$(pkgexample)/usr/share/doc/$(DEBPKGNAME)
+ mkdir -p debian/$(pkgexample)/$(spectradir)
+ mkdir -p debian/$(pkgexample)/$(proteomedir)
cd debian/$(pkgexample)/usr/share/doc/$(DEBPKGNAME) && \
tar xaf $(CURDIR)/examples/example.tar.gz && \
mv example examples && \
- find examples -type f -exec chmod 644 \{\} \;
+ find examples -type f -exec chmod 644 \{\} \; && \
+ mv examples/data/*.mgf $(CURDIR)/debian/$(pkgexample)/$(spectradir) && \
+ mv examples/ref/*.fasta $(CURDIR)/debian/$(pkgexample)/$(proteomedir) && \
+ rmdir examples/data && \
+ rmdir examples/ref
diff --git a/debian/tests/run-unit-test b/debian/tests/run-unit-test
index 3038906..04e3c9f 100644
--- a/debian/tests/run-unit-test
+++ b/debian/tests/run-unit-test
@@ -1,8 +1,4 @@
#!/bin/sh -e
-
-echo "Seems this programm really needs either inspect or tide."
-exit
-
pkg=pipasic
if [ "$ADTTMP" = "" ] ; then
@@ -10,6 +6,13 @@ if [ "$ADTTMP" = "" ] ; then
fi
cd $ADTTMP
cp -a /usr/share/doc/$pkg/examples/* $ADTTMP
-find . -name "*.gz" -exec gunzip \{\} \;
-pipasic dataset species1,species2 -s data/ -d ref/ -I -i /path/to/inspect/ -o test_results/ -V
-rm -rf *
+# find . -name "*.gz" -exec gunzip \{\} \;
+# present example dir similar to original to stick to example syntax if wanted
+ln -s /var/lib/pipasic/spectra data
+ln -s /var/lib/pipasic/proteome ref
+# pipasic dataset species1,species2 -s data/ -d ref/ -I -i /usr/lib/debian-med/bin/ -o test_results/ -V
+# code was set to default spectra dir /var/lib/pipasic/spectra - so we can drop the -s option
+# pipasic dataset species1,species2 -d ref/ -I -i /usr/lib/debian-med/bin/ -o test_results/ -V
+# code was set to default proteome dir /var/lib/pipasic/proteome - so we can drop the -s option
+pipasic dataset species1,species2 -I -i /usr/lib/debian-med/bin/ -o test_results/ -V
+# rm -rf *
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/pipasic.git
More information about the debian-med-commit
mailing list