[med-svn] [Git][med-team/fitgcp][master] 6 commits: Add examples

Pranav Ballaney gitlab at salsa.debian.org
Mon May 11 22:06:21 BST 2020



Pranav Ballaney pushed to branch master at Debian Med / fitgcp


Commits:
bef30559 by Pranav Ballaney at 2020-05-11T21:24:27+05:30
Add examples

- - - - -
db3098de by Pranav Ballaney at 2020-05-11T21:25:26+05:30
Add autopkgtests

- - - - -
25451d29 by Pranav Ballaney at 2020-05-11T21:57:11+05:30
Some changes that 2to3 probably missed

- - - - -
6c6449c5 by Pranav Ballaney at 2020-05-11T23:23:45+05:30
Install sources and docs

- - - - -
3b470dc3 by Pranav Ballaney at 2020-05-12T02:31:23+05:30
Add more autopkgtests

- - - - -
a1b3c6db by Pranav Ballaney at 2020-05-12T02:32:57+05:30
Update changelog

- - - - -


10 changed files:

- + debian/README.test
- debian/changelog
- debian/docs
- + debian/examples
- + debian/patches/2to3_additions.patch
- debian/patches/series
- + debian/tests/README.test_data
- + debian/tests/control
- + debian/tests/data/NC_004830.2.sam
- + debian/tests/run-unit-test


Changes:

=====================================
debian/README.test
=====================================
@@ -0,0 +1,8 @@
+Notes on how this package can be tested.
+────────────────────────────────────────
+
+This package can be tested by running the provided test:
+
+    sh run-unit-test
+
+in order to confirm its integrity.


=====================================
debian/changelog
=====================================
@@ -1,3 +1,20 @@
+fitgcp (0.0.20150429-4) UNRELEASED; urgency=medium
+
+  [ Steffen Möller ]
+  * Could not find ref to conda
+
+  [ Steffen Moeller ]
+  * d/u/metadata: yamllint
+
+  [ Pranav Ballaney ]
+  * Add examples
+  * Add autopkgtests
+  * Some changes that 2to3 probably missed
+  * Install sources and docs
+  * Add more autopkgtests
+
+ -- Pranav Ballaney <ballaneypranav at gmail.com>  Tue, 12 May 2020 02:32:07 +0530
+
 fitgcp (0.0.20150429-3) unstable; urgency=medium
 
   * Use 2to3 to port to Python3


=====================================
debian/docs
=====================================
@@ -1 +1,4 @@
 README*
+debian/README.test
+debian/tests/run-unit-test
+debian/tests/README.test_data
\ No newline at end of file


=====================================
debian/examples
=====================================
@@ -0,0 +1 @@
+debian/tests/data/*
\ No newline at end of file


=====================================
debian/patches/2to3_additions.patch
=====================================
@@ -0,0 +1,56 @@
+Description: Some changes that 2to3 probably missed
+Author: Pranav Ballaney <ballaneypranav at gmail.com>
+Last-Update: Tue, 11 May 2020 21:53:00 +0530
+
+--- a/fitGCP.py
++++ b/fitGCP.py
+@@ -128,7 +128,7 @@ class NBinom(Distribution):
+ 		return stats.nbinom.pmf(x,self._p1,self._p2)
+ 
+ 	def estimate_par(self, data, weights=None):
+-		if weights == None:
++		if weights is None:
+ 			weights = data*0. + 1.
+ 		norm = np.sum(weights)
+ 		mean = np.sum(data*weights)/(norm + 10**(-25))
+@@ -338,7 +338,7 @@ class DataSet:
+ 	
+ 	def read_from_pickle(self,filename):
+ 		""" read a genome coverage profile from a pickle file. """
+-		data = pickle.load(open(filename,'r'))
++		data = pickle.load(open(filename,'rb'))
+ 
+ 		self.cov = np.array(data[0],dtype=np.int)
+ 		self.count = np.array(data[1],dtype=np.int)
+@@ -363,7 +363,7 @@ class DataSet:
+ 			if not read.is_unmapped:
+ 				r_start = start_pos[read.tid] + read.pos # start position 
+ 				r_end = start_pos[read.tid] + read.pos + read.qlen # end 
+-				cov[r_start:r_end] += 1 
++				cov[int(r_start):int(r_end)] += 1
+ 				num_reads += 1
+ 				read_length += r_end-r_start
+ 		self.fname = filename
+@@ -376,7 +376,7 @@ class DataSet:
+ 	def write_to_pickle(self, filename):
+ 		""" store dataset in a pickle file. """
+ 		return pickle.dump([self.cov, self.count, self.rlen, self.rds,
+-							 self.glen, self.fname], open(filename,'w'))
++							 self.glen, self.fname], open(filename,'wb'))
+ 	
+ 
+ 
+@@ -446,11 +446,11 @@ def iterative_fitting(data_set, mixture_
+ 
+ 		# maximum CDF difference
+ 		xs = np.arange(np.max(data_set.cov)+1)
+-		ref_pdf = np.zeros((np.max(data_set.cov)+1,))
++		ref_pdf = np.zeros((int(np.max(data_set.cov))+1,))
+ 		for dist in mixture_model:
+ 			ref_pdf += dist.pmf(xs)*dist.alpha
+ 		
+-		obs_pdf = np.zeros((np.max(data_set.cov)+1,))
++		obs_pdf = np.zeros((int(np.max(data_set.cov))+1,))
+ 		obs_pdf[data_set.cov.astype(np.int)] = data_set.count/float(np.sum(data_set.count))
+ 		max_cdf_diff = np.max(np.abs(np.cumsum(ref_pdf)-np.cumsum(obs_pdf)))
+ 


=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
 2to3.patch
+2to3_additions.patch


=====================================
debian/tests/README.test_data
=====================================
@@ -0,0 +1,12 @@
+File: NC_004830.2.sam
+This file was obtained using mason and bowtie as described 
+in the supplementary data for the following publication:
+    http://dx.doi.org/10.1093/bioinformatics/btt147
+
+A fasta file was downloaded from:
+    https://www.ncbi.nlm.nih.gov/nuccore/NC_004830
+and the following operations were performed on it: 
+    mason illumina -N 100000 -n 75 -sq -o NC_004830.2.fastq NC_004830.2.fa
+    bowtie -p 20 -q -k 1 -S NC_004830.2.fa NC_004830.2.fastq NC_004830.2.sam
+
+-- Pranav Ballaney <ballaneypranav at gmail.com>
\ No newline at end of file


=====================================
debian/tests/control
=====================================
@@ -0,0 +1,3 @@
+Tests: run-unit-test
+Depends: @, python3-matplotlib
+Restrictions: allow-stderr


=====================================
debian/tests/data/NC_004830.2.sam
=====================================
The diff for this file was not included because it is too large.

=====================================
debian/tests/run-unit-test
=====================================
@@ -0,0 +1,34 @@
+#!/bin/bash
+set -e
+
+pkg=fitgcp
+
+export LC_ALL=C.UTF-8
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+  # Double quote below to expand the temporary directory variable now versus
+  # later is on purpose.
+  # shellcheck disable=SC2064
+  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cp -a /usr/share/doc/${pkg}/examples/* "${AUTOPKGTEST_TMP}"
+
+cd "${AUTOPKGTEST_TMP}"
+
+gunzip -r *
+
+echo -e "\e[93m\e[1mTest 1: Verbose with a plot\e[0m"
+fitgcp -l -p NC_004830.2.sam
+test -f "NC_004830.2_zn.png"
+test -f "NC_004830.2_zn_log.txt"
+test -f "NC_004830.2_zn_results.txt"
+rm NC_004830.2_zn.png NC_004830.2_zn_log.txt NC_004830.2_zn_results.txt
+echo -e "\e[92m\e[1mPassed\e[0m"
+echo
+
+echo -e "\e[93m\e[1mTest 2: Only ten iterations\e[0m"
+fitgcp -i 10 NC_004830.2.sam
+test -f NC_004830.2_zn_results.txt
+echo -e "\e[92m\e[1mPassed\e[0m"
+echo



View it on GitLab: https://salsa.debian.org/med-team/fitgcp/-/compare/a6997381dbbf1de8f0b897bec247a1440162994d...a1b3c6db184655b706e1df70e2013d0b6b48b064

-- 
View it on GitLab: https://salsa.debian.org/med-team/fitgcp/-/compare/a6997381dbbf1de8f0b897bec247a1440162994d...a1b3c6db184655b706e1df70e2013d0b6b48b064
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200511/1ca66316/attachment-0001.html>


More information about the debian-med-commit mailing list