comparison smRtools.py @ 1:ca3845fb0b31 draft default tip

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/msp_sr_bowtie_parser commit 70312b58ba246c07e70cdbd0a097f274f1386d09
author drosofff
date Mon, 18 Apr 2016 10:09:08 -0400
parents b996480cd604
children
comparison
equal deleted inserted replaced
0:b996480cd604 1:ca3845fb0b31
2 # version 1 7-5-2012 unification of the SmRNAwindow class 2 # version 1 7-5-2012 unification of the SmRNAwindow class
3 3
4 import sys, subprocess 4 import sys, subprocess
5 from collections import defaultdict 5 from collections import defaultdict
6 from numpy import mean, median, std 6 from numpy import mean, median, std
7 from scipy import stats 7 ##Disable scipy import temporarily, as no working scipy on toolshed.
8 ##from scipy import stats
8 9
9 def get_fasta (index="/home/galaxy/galaxy-dist/bowtie/5.37_Dmel/5.37_Dmel"): 10 def get_fasta (index="/home/galaxy/galaxy-dist/bowtie/5.37_Dmel/5.37_Dmel"):
10 '''This function will return a dictionary containing fasta identifiers as keys and the 11 '''This function will return a dictionary containing fasta identifiers as keys and the
11 sequence as values. Index must be the path to a fasta file.''' 12 sequence as values. Index must be the path to a fasta file.'''
12 p = subprocess.Popen(args=["bowtie-inspect","-a", "0", index], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # bowtie-inspect outputs sequences on single lines 13 p = subprocess.Popen(args=["bowtie-inspect","-a", "0", index], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # bowtie-inspect outputs sequences on single lines
271 Rbarycenter = (weigthAverage (reverseTuppleList) - upstream_coord) / window_size 272 Rbarycenter = (weigthAverage (reverseTuppleList) - upstream_coord) / window_size
272 return Fbarycenter, Rbarycenter 273 return Fbarycenter, Rbarycenter
273 274
274 def correlation_mapper (self, reference, window_size): 275 def correlation_mapper (self, reference, window_size):
275 '''to map correlation with a sliding window 26-2-2013''' 276 '''to map correlation with a sliding window 26-2-2013'''
277 from scipy import stats
278
276 if window_size > self.size: 279 if window_size > self.size:
277 return [] 280 return []
278 F=open(reference, "r") 281 F=open(reference, "r")
279 reference_forward = [] 282 reference_forward = []
280 reference_reverse = [] 283 reference_reverse = []