comparison commons/core/parsing/VarscanFileForGnpSNP.py @ 38:2c0c0a89fad7

Uploaded
author m-zytnicki
date Thu, 02 May 2013 09:56:47 -0400
parents 769e306b7933
children
comparison
equal deleted inserted replaced
37:d22fadc825e3 38:2c0c0a89fad7
1 # Copyright INRA (Institut National de la Recherche Agronomique)
2 # http://www.inra.fr
3 # http://urgi.versailles.inra.fr
4 #
5 # This software is governed by the CeCILL license under French law and
6 # abiding by the rules of distribution of free software. You can use,
7 # modify and/ or redistribute the software under the terms of the CeCILL
8 # license as circulated by CEA, CNRS and INRIA at the following URL
9 # "http://www.cecill.info".
10 #
11 # As a counterpart to the access to the source code and rights to copy,
12 # modify and redistribute granted by the license, users are provided only
13 # with a limited warranty and the software's author, the holder of the
14 # economic rights, and the successive licensors have only limited
15 # liability.
16 #
17 # In this respect, the user's attention is drawn to the risks associated
18 # with loading, using, modifying and/or developing or reproducing the
19 # software by the user in light of its specific status of free software,
20 # that may mean that it is complicated to manipulate, and that also
21 # therefore means that it is reserved for developers and experienced
22 # professionals having in-depth computer knowledge. Users are therefore
23 # encouraged to load and test the software's suitability as regards their
24 # requirements in conditions enabling the security of their systems and/or
25 # data to be ensured and, more generally, to use and operate it in the
26 # same conditions as regards security.
27 #
28 # The fact that you are presently reading this means that you have had
29 # knowledge of the CeCILL license and that you accept its terms.
30
31
32 from commons.core.parsing.VarscanHitForGnpSNP import VarscanHitForGnpSNP
33 from commons.core.parsing.VarscanFile import VarscanFile
34
35 class VarscanFileForGnpSNP(VarscanFile):
36
37 def __init__(self, varscanFileName, fastqFileName="", refFastaFileName="", taxonName=""):
38 VarscanFile.__init__(self, varscanFileName)
39 self._fastqFileName = fastqFileName
40 self._refFastaFileName = refFastaFileName
41 self._taxonName = taxonName
42 self._previousVarscanHit = None
43
44 ## Equal operator
45 #
46 # @param o a VarscanFileAnalysis instance
47 #
48 def __eq__(self, o):
49 return VarscanFile.__eq__(self, o) and self._fastqFileName == o._fastqFileName \
50 and self._refFastaFileName == o._refFastaFileName and self._taxonName == o._taxonName
51
52 def getVarscanFieldSeparator(self):
53 return self._varscanFieldSeparator
54
55 def getFastqFileName(self):
56 return self._fastqFileName
57
58 def getRefFastaFileName(self):
59 return self._refFastaFileName
60
61 def getTaxonName(self):
62 return self._taxonName
63
64 def createVarscanHit(self, line, currentLineNumber):
65 line = line.strip()
66 lResults = line.split(self._varscanFieldSeparator)
67 iVarscanHit = VarscanHitForGnpSNP()
68 iVarscanHit.setAttributes(lResults, currentLineNumber)
69 iVarscanHit.formatAlleles2GnpSnp()
70 iVarscanHit.manageOccurrence(self._previousVarscanHit)
71 self._previousVarscanHit = iVarscanHit
72 return iVarscanHit