[med-svn] [Git][med-team/mcaller][master] Adjusted patches.

Steffen Möller (@moeller) gitlab at salsa.debian.org
Sat Jun 19 23:24:09 BST 2021



Steffen Möller pushed to branch master at Debian Med / mcaller


Commits:
b524abd3 by Steffen Möller at 2021-06-20T00:23:29+02:00
Adjusted patches.

- - - - -


6 changed files:

- debian/changelog
- debian/control
- − debian/patches/pickl3latin.patch
- debian/patches/python2to3.patch
- debian/patches/series
- debian/patches/shebang.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -4,14 +4,13 @@ mcaller (1.0.3+git20210331.f7a616a-1) UNRELEASED; urgency=medium
 
  -- Steffen Möller <moeller at debian.org>  Sat, 19 Jun 2021 23:59:32 +0200
 
-mcaller (1.0-1) unstable; urgency=medium
+mcaller (1.0-1) UNRELEASED; urgency=medium
 
   * Initial release (Closes: #969558)
 
     BLOCKER:
     - installation should be done properly - needs setup.py ?!?
     - .py in executables (secondary)
-    - README and test files does seem to be in sync with current code.
   * New upstream version
   * Standards-Version: 4.5.1 (routine-update)
   * Remove trailing whitespace in debian/rules (routine-update)


=====================================
debian/control
=====================================
@@ -7,6 +7,7 @@ Build-Depends: debhelper-compat (= 13),
                dh-python,
                python3-all,
                python3-setuptools,
+               python3-seaborn,
                help2man
 Standards-Version: 4.5.1
 Vcs-Browser: https://salsa.debian.org/med-team/mcaller


=====================================
debian/patches/pickl3latin.patch deleted
=====================================
@@ -1,13 +0,0 @@
-Index: mcaller/extract_contexts.py
-===================================================================
---- mcaller.orig/extract_contexts.py
-+++ mcaller/extract_contexts.py
-@@ -120,7 +120,7 @@ def extract_features(tsv_input,fasta_inp
-     if not train:
-         tsv_output = '.'.join(tsv_input.split('.')[:-1])+'.diffs.'+str(k)+'.tmp'+str(startline)
-         modfi = open(modelfile,'rb')
--        model = pickle.load(modfi)
-+        model = pickle.load(modfi,encoding="latin1")
-         modfi.close()
-         if type(model) != dict:
-             model = {'general':model} #for compatibility with previously trained model


=====================================
debian/patches/python2to3.patch
=====================================
@@ -1,25 +1,3 @@
-Index: mcaller/compare_genomes.py
-===================================================================
---- mcaller.orig/compare_genomes.py
-+++ mcaller/compare_genomes.py
-@@ -28,7 +28,7 @@ def compare_by_position(bed1,bed2,xmfa):
-                 t,pval3 = 'none','missing df'
-             d,pval4 = ks_2samp(pos_dict[0][pos][1],pos_dict[0][pos][1])
-             if pval4 < 0.9:
--                print pos, pos_dict[0][pos][0], pos_dict[1][pos][0], pval, pval2, pval3, pval4
-+                print(pos, pos_dict[0][pos][0], pos_dict[1][pos][0], pval, pval2, pval3, pval4)
- 
- 
- 
-@@ -43,7 +43,7 @@ def main():
-     args = parser.parse_args()
- 
-     if args.version:
--        print 'mCallerNP 0.1'
-+        print('mCallerNP 0.1')
-         sys.exit(0)
- 
-     assert os.path.isfile(args.bed1), 'file not found at '+args.bed1
 Index: mcaller/make_bed.py
 ===================================================================
 --- mcaller.orig/make_bed.py
@@ -33,51 +11,11 @@ Index: mcaller/make_bed.py
              try:
                  csome,read,pos,context,values,strand,label,prob = tuple(line.split('\t'))
              except: #for backwards compatibility; does not work with verbose results
-@@ -157,9 +157,9 @@ def aggregate_by_pos(meth_fi,aggfi,depth
-                 outfi.write(out_line+'\n')
-     if not pos_list:
-         if not control:
--            print count, 'methylated loci found with min depth', depth_thresh, 'reads'
-+            print(count, 'methylated loci found with min depth', depth_thresh, 'reads')
-         else:
--            print count, 'unmethylated loci found with min depth', depth_thresh, 'reads'
-+            print(count, 'unmethylated loci found with min depth', depth_thresh, 'reads')
- 
- def main():
-     #parse command line options
-@@ -180,7 +180,7 @@ def main():
-     args = parser.parse_args()
- 
-     if args.version:
--        print 'mCallerNP 0.3'
-+        print('mCallerNP 0.3')
-         sys.exit(0)
- 
-     assert os.path.isfile(args.mCaller_file), 'file not found at '+args.mCaller_file
-@@ -197,7 +197,7 @@ def main():
-     if not os.path.isdir(args.plotdir):
-         os.mkdir(args.plotdir)
- 
--    print args.mCaller_file
-+    print(args.mCaller_file)
- 
-     aggregate_by_pos(args.mCaller_file,output_file,args.min_read_depth,args.mod_threshold,args.positions,args.control,args.vo,args.gff,args.ref,args.plot,args.plotdir,args.plotsummary)
- 
 Index: mcaller/extract_contexts.py
 ===================================================================
 --- mcaller.orig/extract_contexts.py
 +++ mcaller/extract_contexts.py
-@@ -2,8 +2,7 @@ from collections import defaultdict
- from Bio import SeqIO
- import scipy.stats as ss
- import numpy as np
--import cPickle
--#import _pickle as cPickle
-+import pickle
- import sys
- import re
- import os
-@@ -52,7 +51,7 @@ def methylate_positions(ref_seq,position
+@@ -52,7 +52,7 @@ def methylate_positions(ref_seq,position
        else:
           print('Base {} does not correspond to methylated base - check reference positions are 0-based - quitting thread now'.format(pos))
           sys.exit(0)
@@ -86,7 +24,7 @@ Index: mcaller/extract_contexts.py
     return meth_seq
  
  #extract signals around methylated positions from tsv
-@@ -61,7 +60,7 @@ def methylate_references(ref_seq,base,mo
+@@ -61,7 +61,7 @@ def methylate_references(ref_seq,base,mo
     if not positions and motif:
        meth_fwd = methylate_motifs(ref_seq,motif,base)
        meth_rev = methylate_motifs(ref_seq,revcomp(motif),base_comps[base])
@@ -95,48 +33,7 @@ Index: mcaller/extract_contexts.py
     elif positions:
        fwd_pos = [int(pos.split()[1]) for pos in open(positions,'r').read().split('\n') if len(pos.split()) > 1 and pos.split()[2] == '+' and pos.split()[0] == contig]
        rev_pos = [int(pos.split()[1]) for pos in open(positions,'r').read().split('\n') if len(pos.split()) > 1 and pos.split()[2] == '-' and pos.split()[0] == contig]
-@@ -121,7 +120,7 @@ def extract_features(tsv_input,fasta_inp
-     if not train:
-         tsv_output = '.'.join(tsv_input.split('.')[:-1])+'.diffs.'+str(k)+'.tmp'+str(startline)
-         modfi = open(modelfile,'rb')
--        model = cPickle.load(modfi)
-+        model = pickle.load(modfi)
-         modfi.close()
-         if type(model) != dict:
-             model = {'general':model} #for compatibility with previously trained model
-@@ -168,7 +167,7 @@ def extract_features(tsv_input,fasta_inp
-                 read_pos = int(read_pos)
-                 reference_kmer = meth_ref[read_pos:read_pos+k]
-                 #if read_name == last_read and (reference_kmer != revcomp('M'.join(ref_kmer.split('A')),rev) and reference_kmer != revcomp('M'.join(ref_kmer.split('T')),rev)) : #true at pseudomethylated positions (to check) TODO: remove this
--                #    print 'issue with reference kmer in line', line, reference_kmer, rev, revcomp('M'.join(ref_kmer.split('A')),rev)
-+                #    print('issue with reference kmer in line', line, reference_kmer, rev, revcomp('M'.join(ref_kmer.split('A')),rev))
-                 #    sys.exit(0)
- 
-                 #if finished context for previous potentially modified position, save and reset
-@@ -212,15 +211,15 @@ def extract_features(tsv_input,fasta_inp
-                                 towrite.append([chrom,last_read,str(mpos),context,','.join([str(diff) for diff in diffs]),strand(last_rev),label])
-                                 last_info = last_read+'\t'+str(mpos)+'\t'+context+'\t'+','.join([str(diff) for diff in diffs])+'\t'+strand(last_rev)
-                             except (IndexError,KeyError) as e:
--                                print last_read+'\t'+str(mpos)+'\t'+context+'\t'+','.join([str(diff) for diff in diffs])+'\t'+strand(last_rev),'- Index or Key Error'
--                                print model.keys(), base_model.keys(), context[int(len(context)/2):int(len(context)/2)+2]
--                                print e
--                                print model[twobase_model].predict_proba([diffs])
-+                                print(last_read+'\t'+str(mpos)+'\t'+context+'\t'+','.join([str(diff) for diff in diffs])+'\t'+strand(last_rev),'- Index or Key Error')
-+                                print(model.keys(), base_model.keys(), context[int(len(context)/2):int(len(context)/2)+2])
-+                                print(e)
-+                                print(model[twobase_model].predict_proba([diffs]))
-                                 sys.exit(0)
-                         else:
--                            print last_read+'\t'+str(mpos)+'\t'+context+'\t'+','.join([str(diff) for diff in diffs])+'\t'+strand(last_rev)
--                            print read_name, rev, last_read, last_rev, last_first
--                            print read_kmer,reference_kmer, ref_kmer, last_pos_in_kmer, mspacing, pos_in_kmer
-+                            print(last_read+'\t'+str(mpos)+'\t'+context+'\t'+','.join([str(diff) for diff in diffs])+'\t'+strand(last_rev))
-+                            print(read_name, rev, last_read, last_rev, last_first)
-+                            print(read_kmer,reference_kmer, ref_kmer, last_pos_in_kmer, mspacing, pos_in_kmer)
-                             sys.exit(0)
-                         num_observations += 1
-                         if num_observations%5000 == 0:
-@@ -229,7 +228,7 @@ def extract_features(tsv_input,fasta_inp
+@@ -233,7 +233,7 @@ def extract_features(tsv_input,fasta_inp
                          pos_set.add(mpos)
                          read_set.add(last_read)
                          if len(read_set)%1000 == 0 and len(read_set) > last_read_num:
@@ -145,48 +42,11 @@ Index: mcaller/extract_contexts.py
                              last_read_num = len(read_set)
                      else:
                          skipped_skips.add((last_read,mpos))
-@@ -252,12 +251,12 @@ def extract_features(tsv_input,fasta_inp
-                         diff_col = diffs
-                         if len(diff_col) != k:
-                             try:
--                                print last_info,'- n diffs off'
-+                                print(last_info,'- n diffs off')
-                             except:
-                                 pass
-                             #GGCGCM 613883 613878 False 2289b392-746e-4fa0-8226-d3ac661c9620_Basecall_2D_template 2289b392-746e-4fa0-8226-d3ac661c9620_Basecall_2D_template [[], [], [], [], [], [], []] 7
- 
--                            print reference_kmer,last_mpos,mpos,mspacing,read_pos,read_pos-last_mpos,read_name,last_read,diff_col,mspacing, last_diff_col, last_diff_col[:-mspacing]
-+                            print(reference_kmer,last_mpos,mpos,mspacing,read_pos,read_pos-last_mpos,read_name,last_read,diff_col,mspacing, last_diff_col, last_diff_col[:-mspacing])
-                             diff_col = [[] for i in range(k)]
-                             sys.exit(0)
- 
-Index: mcaller/mCaller.py
-===================================================================
---- mcaller.orig/mCaller.py
-+++ mcaller/mCaller.py
-@@ -3,8 +3,8 @@
- #Alexa McIntyre, 2016-2018
- 
- import sys
--assert sys.version_info >= (2,7) and sys.version_info < (3,0), 'please use python 2.7'
--import cPickle
-+#assert sys.version_info >= (2,7) and sys.version_info < (3,0), 'please use python 2.7'
-+import pickle
- #import _pickle as cPickle
- from collections import defaultdict
- import numpy as np
 Index: mcaller/train_model.py
 ===================================================================
 --- mcaller.orig/train_model.py
 +++ mcaller/train_model.py
-@@ -1,5 +1,4 @@
--import cPickle
--#import _pickle as cPickle
-+import pickle
- import numpy as np
- from plotlib import *
- from sklearn.model_selection import RandomizedSearchCV
-@@ -34,7 +33,7 @@ def report(results, n_top):
+@@ -33,7 +33,7 @@ def report(results, n_top):
  def train_classifier(signals,groups,modelfile,classifier='NN',plot=False): #TODO: set order of labels
      models = {}
      for twobase_model in signals:
@@ -195,35 +55,3 @@ Index: mcaller/train_model.py
          #sys.exit(0)
          #print(twobase_model)
          if classifier == 'RF':
-@@ -86,9 +85,9 @@ def train_classifier(signals,groups,mode
-             sigs = sigs + signals[twobase_model][label][:num_examples]
-             grps = grps + groups[twobase_model][label][:num_examples]
- 
--        print labs[:10]
--        print sigs[:10]
--        print grps[:10]
-+        print(labs[:10])
-+        print(sigs[:10])
-+        print(grps[:10])
- 
-         scores = cross_val_score(model,sigs,labs,cv=gfk,groups=grps)
-         print("%s %s model scores: %s" %(classifier,twobase_model,','.join([str(s) for s in scores])))
-@@ -109,7 +108,7 @@ def train_classifier(signals,groups,mode
-             plot_training_probabilities(prob_scores,twobase_model)      
- 
-     modfi = open(modelfile,'wb')
--    cPickle.dump(models,modfi)
-+    pickle.dump(models,modfi)
-     modfi.close()
-     return models
- 
-Index: mcaller/plotlib.py
-===================================================================
---- mcaller.orig/plotlib.py
-+++ mcaller/plotlib.py
-@@ -1,4 +1,4 @@
--#!/usr/bin/env python
-+#!/usr/bin/python3
- import sys
- import os
- import matplotlib.pyplot as plt


=====================================
debian/patches/series
=====================================
@@ -1,3 +1,2 @@
 shebang.patch
 python2to3.patch
-pickl3latin.patch


=====================================
debian/patches/shebang.patch
=====================================
@@ -28,3 +28,13 @@ Index: mcaller-0.0/make_bed.py
  import sys
  import numpy as np
  from Bio import SeqIO
+Index: mcaller/plotlib.py
+===================================================================
+--- mcaller.orig/plotlib.py
++++ mcaller/plotlib.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ import sys
+ import os
+ import matplotlib.pyplot as plt



View it on GitLab: https://salsa.debian.org/med-team/mcaller/-/commit/b524abd39247bdbec9d982c4d19a66787d05fe08

-- 
View it on GitLab: https://salsa.debian.org/med-team/mcaller/-/commit/b524abd39247bdbec9d982c4d19a66787d05fe08
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/20210619/4144abbe/attachment-0001.htm>


More information about the debian-med-commit mailing list