comparison GCMS/combine_output.py @ 16:fe4682eb938c

small improvement
author pieter.lukasse@wur.nl
date Mon, 23 Mar 2015 08:40:42 +0100
parents 346ff9ad8c7a
children
comparison
equal deleted inserted replaced
15:05ff1c55db84 16:fe4682eb938c
3 ''' 3 '''
4 Module to combine output from two GCMS Galaxy tools (RankFilter and CasLookup) 4 Module to combine output from two GCMS Galaxy tools (RankFilter and CasLookup)
5 ''' 5 '''
6 6
7 import csv 7 import csv
8 import re
9 import sys 8 import sys
10 import math 9 import math
11 import pprint 10 import pprint
12 11
13 __author__ = "Marcel Kempenaar" 12 __author__ = "Marcel Kempenaar"
79 @param caslookup: matching record (dictionary) of one compound in the CasLookup output 78 @param caslookup: matching record (dictionary) of one compound in the CasLookup output
80 ''' 79 '''
81 # The ID in the RankFilter output contains the following 5 fields: 80 # The ID in the RankFilter output contains the following 5 fields:
82 rf_id = rankfilter['ID'].split('-') 81 rf_id = rankfilter['ID'].split('-')
83 try: 82 try:
83 if 'Formula' not in rankfilter:
84 raise Exception("Error: old Rankfilter format detected (the selected Rankfilter data does not contain the column 'Formula'). Solution: rerun Rankfilter again.")
84 hit = [rf_id[0], # Centrotype 85 hit = [rf_id[0], # Centrotype
85 rf_id[1], # cent.Factor 86 rf_id[1], # cent.Factor
86 rf_id[2], # scan nr 87 rf_id[2], # scan nr
87 rf_id[3], # R.T. (umin) 88 rf_id[3], # R.T. (umin)
88 rf_id[4], # nr. Peaks 89 rf_id[4], # nr. Peaks
90 rankfilter['R.T.'],
89 # Appending other fields 91 # Appending other fields
90 rankfilter['R.T.'],
91 rankfilter['Name'], 92 rankfilter['Name'],
92 rankfilter['Formula'], 93 rankfilter['Formula'],
93 rankfilter['Library'].strip(), 94 rankfilter['Library'].strip(),
94 rankfilter['CAS'].strip(), 95 rankfilter['CAS'].strip(),
95 rankfilter['Forward'], 96 rankfilter['Forward'],