Commit 8fdf1bf1 authored by Eduardo Miranda's avatar Eduardo Miranda

Merge branch 'fadi' into dev

# Conflicts:
#	LipidXplorer.py
#	lx/fileReader/mzAPI/__init__.py
#	lx/fileReader/mzAPI/mzML.py
parents 105a9fb1 1d9ad0dc
......@@ -1712,7 +1712,7 @@ def mkMSMSEntriesHeuristic(scan, listPolarity, numLoops = None, isPIS = False, r
def linearAlignment(listSamples, dictSamples, tolerance, merge = None, mergeTolerance = None,
mergeDeltaRes = None, charge = None, deltaRes = None, minocc = None, msThreshold = None,
intensityWeightedAvg = False, minMass = None, fadi_denominator = None, fadi_percentage = 0.0):
intensityWeightedAvg = False, minMass = None, fadi_denominator = None, jaco_percentage = 0.0):
#using fadi_denominator, fadi_percentage, becayse nbofscans and msthreshold variables are already in use !!!
# these varuables are used to implement fadi filter
'''
......@@ -1874,14 +1874,6 @@ def linearAlignment(listSamples, dictSamples, tolerance, merge = None, mergeTole
for i in bin:
resultingSpecEntries += i[1]
#filtering starts here, default setings imply no filtering
fadi_ratio = 1.0
if fadi_denominator is not None and fadi_denominator > 0.0:
fadi_ratio = cnt / float(fadi_denominator) if fadi_denominator is not None and fadi_denominator is not 0.0 else 1.0
if fadi_ratio >= fadi_percentage:
listResult[count + 1].append([avg,
resultingSpecEntries])
# if 'current' is last entry of our non-merged spectrum (count)
# just add it to the bin
......@@ -1924,28 +1916,18 @@ def linearAlignment(listSamples, dictSamples, tolerance, merge = None, mergeTole
else:
cluster[sample] = clusterToMerge[sample][0]
no_of_peaks = len(cluster) # before it gets filled with empty data
# fill cluster with empty masses to have a full entry
for sample in listSamples:
if sample not in cluster:
cluster[sample] = specEntry(
mass = entry[1][0].mass)
#for sample in listSamples:
# if not cluster.has_key(sample):
# if mass:
# cluster[sample] = specEntry(
# mass = mass,
# content = None)
# else:
# for s in listSamples:
# if i.content.has_key(s):
# mass = i.mass
# break
# cluster[sample] = specEntry(
# mass = mass,
# content = None)
listOutput.append(cluster)
#"filter" out clusters that dont have anough peaks, as a ration not an absolute count
no_of_samples = len(listSamples)
jaco_ratio = no_of_peaks / float(no_of_samples)
if jaco_ratio >= jaco_percentage:
listOutput.append(cluster)
### gen output ###
##################
......
......@@ -260,7 +260,7 @@ def add_Sample(
options['MSresolution'],
merge = mergeSumIntensity,
mergeTolerance = options['MSresolution'],
mergeDeltaRes = options['MSresolutionDelta'], fadi_denominator= fadi_denominator, fadi_percentage = fadi_percentage)
mergeDeltaRes = options['MSresolutionDelta'], fadi_denominator= fadi_denominator, jaco_percentage = fadi_percentage)
# free memory
del dictSpecEntry
......
......@@ -1046,7 +1046,7 @@ MStolerance to an arbitrary value"""
# if the threshold is given as a relative value make absolute value
if threshold_type == 'relative':
t[sample] = threshold * dictBasePeakIntensity[sample]
t[sample] = threshold * dictBasePeakIntensity[sample] if dictBasePeakIntensity[sample] is not None else 0 # if its none there where no peaks
else:
t[sample] = threshold
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment