Mercurial > repos > yufei-luo > s_mart
comparison commons/pyRepetUnit/hmmer/hmmOutput/HmmscanOutputProcessing.py @ 31:0ab839023fe4
Uploaded
author | m-zytnicki |
---|---|
date | Tue, 30 Apr 2013 14:33:21 -0400 |
parents | 94ab73e8a190 |
children |
comparison
equal
deleted
inserted
replaced
30:5677346472b5 | 31:0ab839023fe4 |
---|---|
1 import re | |
2 from commons.pyRepetUnit.hmmer.hmmOutput.HmmOutput import HmmOutput | |
3 from commons.pyRepetUnit.hmmer.hmmOutput.HmmOutputProcessing import HmmOutputProcessing | |
4 | |
5 ##Concrete implementation for hmmscan output specific methods | |
6 # | |
7 class HmmscanOutputProcessing (HmmOutputProcessing): | |
8 | |
9 ## read an hmmscan output from a file, return a array with results useful to build a .align file | |
10 # | |
11 # @param file handle of file generated by software searching hmm profiles | |
12 # | |
13 def readHmmOutput( self, hmmerOutputFile ): | |
14 #Tested with HMMER 3 on Linux | |
15 line = hmmerOutputFile.readline() | |
16 tabResult = None | |
17 if (line == ""): | |
18 tabResult = None | |
19 return tabResult | |
20 tabResult = HmmOutput() | |
21 | |
22 while line != "": | |
23 line = hmmerOutputFile.readline() | |
24 if not(re.match("^#.*$", line)) and line != "": | |
25 lLines = re.split("\s+", line) | |
26 seqName = lLines[3] | |
27 profilName = lLines[0] | |
28 iValue = lLines[12] | |
29 score = lLines[13] | |
30 queryCoordStart =lLines[17] | |
31 queryCoordEnd = lLines[18] | |
32 subjectCoordStart = lLines[15] | |
33 subjectCoordEnd = lLines[16] | |
34 tabResult.append([seqName, queryCoordStart, queryCoordEnd, profilName, subjectCoordStart, subjectCoordEnd, iValue, score]) | |
35 return tabResult | |
36 |