diff options
author | Andreas Tille <tille@debian.org> | 2021-09-09 08:01:13 +0200 |
---|---|---|
committer | Andreas Tille <tille@debian.org> | 2021-09-09 08:01:13 +0200 |
commit | 5c14fc32f7f22b5d80fac706c187893df07173ff (patch) | |
tree | dd6856e26c07cf50a748332d31875ce08c1166fa | |
parent | bfae2823a9ac6672748c3e9d405fa0558896f44a (diff) |
Use 2to3 to port to Python3
Bug-Debian: https://bugs.debian.org/938415
Last-Update: Thu, 12 Sep 2019 11:26:11 +0200
Gbp-Pq: Name 2to3.patch
-rw-r--r-- | pRSEM/Gene.py | 4 | ||||
-rw-r--r-- | pRSEM/Param.py | 4 | ||||
-rw-r--r-- | pRSEM/Prsem.py | 8 | ||||
-rw-r--r-- | pRSEM/Transcript.py | 8 | ||||
-rw-r--r-- | pRSEM/Util.py | 6 | ||||
-rwxr-xr-x | pRSEM/prsem-calculate-expression | 2 | ||||
-rwxr-xr-x | pRSEM/prsem-prepare-reference | 2 | ||||
-rwxr-xr-x | pRSEM/prsem-testing-procedure | 2 | ||||
-rwxr-xr-x | rsem-gff3-to-gtf | 2 | ||||
-rwxr-xr-x | rsem-refseq-extract-primary-assembly | 2 |
10 files changed, 20 insertions, 20 deletions
diff --git a/pRSEM/Gene.py b/pRSEM/Gene.py index c5c177e..eaf1868 100644 --- a/pRSEM/Gene.py +++ b/pRSEM/Gene.py @@ -124,7 +124,7 @@ def constructGenesFromTranscripts(transcripts): genes = [] gene_dict_id = {} for tr in transcripts: - if gene_dict_id.has_key(tr.gene_id): + if tr.gene_id in gene_dict_id: gene_dict_id[tr.gene_id].transcripts.append(tr) tr.gene = gene_dict_id[tr.gene_id] else: @@ -137,7 +137,7 @@ def constructGenesFromTranscripts(transcripts): gene_dict_id[tr.gene_id] = gene tr.gene = gene - map(lambda gene: gene.getStartEndTSSTESFromTranscripts(), genes); + list(map(lambda gene: gene.getStartEndTSSTESFromTranscripts(), genes)); return genes; diff --git a/pRSEM/Param.py b/pRSEM/Param.py index d93a234..88ecae5 100644 --- a/pRSEM/Param.py +++ b/pRSEM/Param.py @@ -98,7 +98,7 @@ class Param: def __str__(self): - ss = [ "%-33s %s\n" % (key, val) for (key, val) in self.argdict.items()] + \ + ss = [ "%-33s %s\n" % (key, val) for (key, val) in list(self.argdict.items())] + \ [ "%-33s %s\n" % ('RSEM_temp_dir', self.temp_dir ) ] + \ [ "%-33s %s\n" % ('pRSEM_scr_dir', self.prsem_scr_dir) ] return ''.join(ss) @@ -109,7 +109,7 @@ class Param: import os prm = cls() prm.argdict = argdict - for (key, val) in argdict.items(): + for (key, val) in list(argdict.items()): setattr(prm, key, val) if prm.imd_name is not None: diff --git a/pRSEM/Prsem.py b/pRSEM/Prsem.py index 16f060a..cfaa63c 100644 --- a/pRSEM/Prsem.py +++ b/pRSEM/Prsem.py @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/python3 __doc__=""" @@ -65,9 +65,9 @@ def buildTrainingSet(prm): The order is required by rsem-run-gibbs so that prior can be assigned to transcript correctly """ - ogot_genes = filter(lambda g: len(g.transcripts) == 1 and + ogot_genes = [g for g in prm.genes if len(g.transcripts) == 1 and (g.end - g.start + 1) >= - prm.TRAINING_GENE_MIN_LEN, prm.genes) + prm.TRAINING_GENE_MIN_LEN] trs = [tr for g in ogot_genes for tr in g.transcripts] @@ -127,7 +127,7 @@ def genPriorByCombinedTSSSignals(prm): """ f_fout = open(prm.finfo_multi_targets, 'w') f_fout.write("targetid\tfaln\tfftrs\n") - for (tgtid, faln) in prm.targetid2fchipseq_alignment.items(): + for (tgtid, faln) in list(prm.targetid2fchipseq_alignment.items()): fftrs = prm.imd_name + '_prsem.' + tgtid + '.all_tr_features' f_fout.write("%s\t%s\t%s\n" % (tgtid, faln, fftrs)) f_fout.close() diff --git a/pRSEM/Transcript.py b/pRSEM/Transcript.py index 9638ffe..185f19a 100644 --- a/pRSEM/Transcript.py +++ b/pRSEM/Transcript.py @@ -41,7 +41,7 @@ class Transcript: for (start, end) in self.exon_ranges: s += " %d %d" % (start, end); s += "\n"; - for key in self.gtf_attr.keys(): + for key in list(self.gtf_attr.keys()): for val in self.gtf_attr[key]: s += '%s "%s"; ' % (key, val); s = s.rstrip(); @@ -58,7 +58,7 @@ class Transcript: for feature_word in feature_words: feature_word.lstrip(); (key, val) = feature_word.split(); - if not self.gtf_attr.has_key(key): + if key not in self.gtf_attr: self.gtf_attr[key] = []; self.gtf_attr[key].append(val.strip('"')); @@ -160,7 +160,7 @@ def readRSEMTI(fin): tr.constructFromRSEMTI(lines[i*6+1:i*6+7]); transcripts.append(tr); if (i > 0) and (i % 20000 == 0): - print "processed %d transcripts" % i; + print("processed %d transcripts" % i); return transcripts; @@ -183,7 +183,7 @@ def quicklyReadRSEMTI(fin): tr.quicklyConstructFromRSEMTI(lines[i*6+1:i*6+7]); transcripts.append(tr); if (i > 0) and (i % 20000 == 0): - print "processed %d transcripts" % i; + print("processed %d transcripts" % i); return transcripts; diff --git a/pRSEM/Util.py b/pRSEM/Util.py index 9107a36..7df4427 100644 --- a/pRSEM/Util.py +++ b/pRSEM/Util.py @@ -60,7 +60,7 @@ def runCommandAndGetOutput(*args, **kwargs): try: output = subprocess.check_output(str_args) - except subprocess.CalledProcessError, e: + except subprocess.CalledProcessError as e: sys.exit("\nExecution failed: %s\n" % e.output) return output @@ -123,14 +123,14 @@ def runMPOverAList(nprocs, func, args): if len(args[0]) > nprocs: chunksize = len(args[0])/nprocs + 1 procs = [] - for i in xrange(nprocs): + for i in range(nprocs): list_args = [args[0][chunksize*i:chunksize*(i+1)]] + args[1:] + [out_q] p = mp.Process(target = func, args = tuple(list_args)) procs.append(p) p.start() dict_to_return = {} - for i in xrange(nprocs): + for i in range(nprocs): dict_to_return.update(out_q.get()) for p in procs: diff --git a/pRSEM/prsem-calculate-expression b/pRSEM/prsem-calculate-expression index 0b56904..d13c0b6 100755 --- a/pRSEM/prsem-calculate-expression +++ b/pRSEM/prsem-calculate-expression @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/python3 __doc__=""" diff --git a/pRSEM/prsem-prepare-reference b/pRSEM/prsem-prepare-reference index cef6bdb..705a010 100755 --- a/pRSEM/prsem-prepare-reference +++ b/pRSEM/prsem-prepare-reference @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/python3 __doc__=""" diff --git a/pRSEM/prsem-testing-procedure b/pRSEM/prsem-testing-procedure index 7e9a0f6..fe5d604 100755 --- a/pRSEM/prsem-testing-procedure +++ b/pRSEM/prsem-testing-procedure @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/python3 __doc__=""" diff --git a/rsem-gff3-to-gtf b/rsem-gff3-to-gtf index ce6e1fd..943e411 100755 --- a/rsem-gff3-to-gtf +++ b/rsem-gff3-to-gtf @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 # Copyright (c) 2016 # Bo Li (University of California, Berkeley) diff --git a/rsem-refseq-extract-primary-assembly b/rsem-refseq-extract-primary-assembly index 8289e70..d3b7f97 100755 --- a/rsem-refseq-extract-primary-assembly +++ b/rsem-refseq-extract-primary-assembly @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python3 from sys import argv, exit |