Beispiel #1
0
    def actionPerformed(self, event):
        output = open("profelis.query.fas", "w")
        for gene in self.panel.outGenes.model.elements():
            print gene.location
            if gene.location[0] < gene.location[1]:
                proteins = utils.translate(self.panel.genome[gene.location[0]-1:gene.location[1]])
            else:
                proteins = utils.translate(utils.reverseComplement(self.panel.genome[gene.location[1]-1:gene.location[0]]))
            output.write(">profelis" + ":" + "-".join(map(str, gene.location)) + "\n")
            for i in xrange(0, len(proteins), 50):
                output.write(proteins[i:min(i+50, len(proteins))] + "\n")
        output.close()
        
        self.panel.frame.blastLocation.background = Color.white
        self.panel.frame.databaseLocation.background = Color.white
        try:
            utils.cachedBlast("profelis.query.blastp.xml", self.panel.frame.blastLocation.text, self.panel.frame.databaseLocation.text + "/" + self.panel.database, self.panel.evalue, "profelis.query.fas", self.panel, True)
        except OSError:
            self.panel.frame.blastLocation.background = Color.red
            self.panel.frame.databaseLocation.background = Color.red
            return

        genes = utils.parseBlast("profelis.query.blastp.xml")[2]
        self.panel.outGenes.model.clear()
        [self.panel.inGenes.model.add(0, gene) for gene in genes[::-1]]

        xml.addGenes(self.panel.name + ".blastp.xml", "profelis.query.blastp.xml")
        xml.writeHTML(self.panel.name + ".blastp.xml")
        self.panel.writeArtemisFile()
Beispiel #2
0
    def actionPerformed(self, event):
        output = open("profelis.query.fas", "w")
        for gene in self.panel.outGenes.model.elements():
            print gene.location
            if gene.location[0] < gene.location[1]:
                proteins = utils.translate(
                    self.panel.genome[gene.location[0] - 1:gene.location[1]])
            else:
                proteins = utils.translate(
                    utils.reverseComplement(
                        self.panel.genome[gene.location[1] -
                                          1:gene.location[0]]))
            output.write(">profelis" + ":" +
                         "-".join(map(str, gene.location)) + "\n")
            for i in xrange(0, len(proteins), 50):
                output.write(proteins[i:min(i + 50, len(proteins))] + "\n")
        output.close()

        self.panel.frame.blastLocation.background = Color.white
        self.panel.frame.databaseLocation.background = Color.white
        try:
            utils.cachedBlast(
                "profelis.query.blastp.xml",
                self.panel.frame.blastLocation.text,
                self.panel.frame.databaseLocation.text + "/" +
                self.panel.database, self.panel.evalue, "profelis.query.fas",
                self.panel, True)
        except OSError:
            self.panel.frame.blastLocation.background = Color.red
            self.panel.frame.databaseLocation.background = Color.red
            return

        genes = utils.parseBlast("profelis.query.blastp.xml")[2]
        self.panel.outGenes.model.clear()
        [self.panel.inGenes.model.add(0, gene) for gene in genes[::-1]]

        xml.addGenes(self.panel.name + ".blastp.xml",
                     "profelis.query.blastp.xml")
        xml.writeHTML(self.panel.name + ".blastp.xml")
        self.panel.writeArtemisFile()
Beispiel #3
0
    def loadFile(self):
        self.inGenes.model.clear()
        self.database, self.evalue, genes = utils.parseBlast(self.name + ".blastp.xml")
        [self.inGenes.model.addElement(gene) for gene in genes]

        artemisInput = open(self.name + ".art", "r")
        lines = artemisInput.readlines()
        artemisInput.close()
        self.restOfFile = self.genome = []
        while lines:
            if re.match("\s+CDS\s+(complement\()?\d+\.\.\d+\)?\n", lines[0]):
                lines = lines[4:]
            elif lines[0].find("ORIGIN") == 0:
                self.genome = map(lambda x: re.sub("\s+", "", x), lines[1:])
                lines = []
            else:
                if lines[0].strip():
                    self.restOfFile.append(lines[0])
                lines = lines[1:]
                
        self.genome = "".join(self.genome)
        self.restOfFile = "".join(self.restOfFile)
Beispiel #4
0
    def loadFile(self):
        self.inGenes.model.clear()
        self.database, self.evalue, genes = utils.parseBlast(self.name +
                                                             ".blastp.xml")
        [self.inGenes.model.addElement(gene) for gene in genes]

        artemisInput = open(self.name + ".art", "r")
        lines = artemisInput.readlines()
        artemisInput.close()
        self.restOfFile = self.genome = []
        while lines:
            if re.match("\s+CDS\s+(complement\()?\d+\.\.\d+\)?\n", lines[0]):
                lines = lines[4:]
            elif lines[0].find("ORIGIN") == 0:
                self.genome = map(lambda x: re.sub("\s+", "", x), lines[1:])
                lines = []
            else:
                if lines[0].strip():
                    self.restOfFile.append(lines[0])
                lines = lines[1:]

        self.genome = "".join(self.genome)
        self.restOfFile = "".join(self.restOfFile)