changeset 26:cbe4551cdc27 draft

Uploaded
author bzonnedda
date Thu, 06 Jul 2017 06:28:47 -0400
parents abdc05fae16e
children 02091c92f4f1
files conifer_functions.py
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/conifer_functions.py	Thu Jul 06 06:28:33 2017 -0400
+++ b/conifer_functions.py	Thu Jul 06 06:28:47 2017 -0400
@@ -25,7 +25,7 @@
 #######################################################################
 
 import csv
-#from tables import *
+from tables import *
 import numpy as np
 import operator
 
@@ -79,7 +79,7 @@
 
 def loadProbeList(CF_probe_filename):
 	# Load data files
-	probefile = open(CF_probe_filename, 'rb')
+	probefile = open(CF_probe_filename)
 	s = csv.Sniffer()
 	header = s.has_header(probefile.read(1024))
 	probefile.seek(0)
@@ -145,9 +145,9 @@
 	import operator
 	import locale
 	exon_set = rpkm_data.exons
-	genomic_coords = np.array(map(operator.itemgetter("start"),exon_set))
+	genomic_coords = np.array(list(map(operator.itemgetter("start"),exon_set)))
 	
-	ticks = range(0,len(exon_set),len(exon_set)/5)
+	ticks = list(range(0,len(exon_set),len(exon_set)/5))
 	
 	ticks[-1] -= 1 # the last tick is going to be off the chart, so we estimate it as the second to last genomic coord.
 	labels = [locale.format("%d", genomic_coords[i], grouping=True) for i in ticks if i < len(genomic_coords)]
@@ -177,7 +177,7 @@
 		return []
 	
 	out_calls = []
-	calls=np.array(calls)[np.argsort(np.array(map(operator.itemgetter("start"),calls),dtype=np.int))]
+	calls=np.array(calls)[np.argsort(np.array(list(map(operator.itemgetter("start"),calls)),dtype=np.int))]
 	pstart = calls[0]["start"]
 	pstop = calls[0]["stop"]
 	for d in calls:
@@ -202,7 +202,7 @@
 		
 	def smooth(self, window = 15, padded = False): #todo, fix the padding here
 		if self.isGenotype:
-			print "Warning: the data in this rpkm_data container are single genotype values. Smoothing will have no effect!"
+			print("Warning: the data in this rpkm_data container are single genotype values. Smoothing will have no effect!")
 			return self.rpkm
 		
 		if window > 0:
@@ -249,7 +249,7 @@
 		"""Initialize an rpkm_reader instance. Specify the location of the data file"""
 		
 		if rpkm_fn == None:
-			print "Must specify RPKM HDF5 file!"
+			print("Must specify RPKM HDF5 file!")
 			return 0
 		# set up file access
 		self.h5file = openFile(rpkm_fn, mode='r')
@@ -367,4 +367,4 @@
 	def getExonIDs(self, chromosome, start, stop):
 		probe_tbl = self.h5file.root.probes._f_getChild("probes_chr" + str(chromosome))
 		exons = probe_tbl.getWhereList('(start >= %d) & (stop <= %d)' % (start,stop))
-		return exons
+		return exons
\ No newline at end of file