Some small changes to Quality Filter tool.

This commit is contained in:
Guruprasad Anada
2008-03-20 14:49:18 +00:00
parent c0f960fe0c
commit 211673cf3b
2 changed files with 18 additions and 16 deletions
+15 -12
View File
@@ -1,5 +1,5 @@
#! /usr/bin/python
#Guruprasad Ananda
"""
Filter based on nucleotide quality (PHRED score).
@@ -21,7 +21,6 @@ import psyco_full
import sys
import os, os.path
from UserDict import DictMixin
import bx.wiggle
from bx.binned_array import BinnedArray, FileBinnedArray
from bx.bitset import *
from bx.bitset_builders import *
@@ -111,6 +110,10 @@ def main():
print >>sys.stderr, "No primary species selected. Try again by selecting at least one primary species."
sys.exit()
if mask_species == 'None':
print >>sys.stderr, "No mask species selected. Try again by selecting at least one species to mask."
sys.exit()
mask_chr_count = 0
mask_chr_dict = {0:'#', 1:'$', 2:'^', 3:'*', 4:'?'}
mask_reg_dict = {0:'Current pos', 1:'Current+Downstream', 2:'Current+Upstream', 3:'Current+Both sides'}
@@ -172,25 +175,25 @@ def main():
else: #enter if the species is a primary species
index = pspecies.index(dbkey)
sequence = block.components[seq].text
start = block.components[seq].start
s_start = block.components[seq].start
size = len(sequence) #this includes the gaps too
end = start + size
status_str = '1'*size
status_list = list(status_str)
if status_strings == []:
status_strings.append(status_str)
pos = start
ind = 0
while pos < end:
#scores_by_chrom = load_scores_ba_dir( file.strip() )
s_end = block.components[seq].end
#Get scores for the entire sequence
try:
scores = scores_by_chrom[index][chr][s_start:s_end]
except:
continue
pos = 0
while pos < (s_end-s_start):
if sequence[ind] == '-': #No score for GAPS
pos += 1
ind += 1
continue
try:
score = scores_by_chrom[index][chr][pos] #Get score for the current n.t position
except Exception, e:
score = 0
score = scores[pos]
if score < qual_cutoff:
score = 0
+3 -4
View File
@@ -1,4 +1,4 @@
<tool id="qualityFilter" name="Filter nucleotides">
<tool id="qualityFilter" name="Filter nucleotides" version="1.0.1">
<description> based on quality scores</description>
<command interpreter="python2.4">
quality_filter.py
@@ -11,6 +11,8 @@
${mask_region.region}
#if $mask_region.region == "3"
${mask_region.lengthr},${mask_region.lengthl}
#elif $mask_region.region == "0"
1
#else
${mask_region.length}
#end if
@@ -44,9 +46,6 @@
<option value="3">Corresponding column + neighbors on both sides</option>
</param>
<when value="0">
<param name="length" type="select" value="1">
<option value="1" selected="true">1</option>
</param>
</when>
<when value="1">
<param name="length" size="10" type="integer" value="2" label="Number of right-side neighbors"/>