Exemplo n.º 1
0
    def build_dot_bracket(self):
        # get all the positions
        results = db_session \
            .query(Structure, Transcript) \
            .filter(
                Structure.id==self.structure_id,
                Transcript.id==Structure.transcript_id
            ) \
            .all()

        # Get position values from Structure entity
        positions = results[0][0].get_values()
        seq_str = results[0][1].get_sequence_str()
        dot_bracket_str = build_dot_bracket(positions)

        return {
            "sequence": seq_str.replace("T", "U"),
            "structure": dot_bracket_str
        }
Exemplo n.º 2
0
    def build_dot_bracket(self):
        # get all the positions
        results = db_session \
            .query(Structure, Transcript) \
            .filter(
                Structure.id==self.structure_id,
                Transcript.id==Structure.transcript_id
            ) \
            .all()

        # Get position values from Structure entity
        positions = results[0][0].get_values()
        seq_str = results[0][1].get_sequence_str()
        dot_bracket_str = build_dot_bracket(positions)

        return {
            "sequence": seq_str.replace("T", "U"),
            "structure": dot_bracket_str
        }
Exemplo n.º 3
0
    def generate_txt(self, results):
        # first we must extract and display the sequence, using the transcript object. output
        # in fasta-like format
        transcript = results[0][2]
        buf = ">" + self.transcript_id + "\n"
        buf += insert_newlines(transcript.get_sequence_str()) + "\n"

        for result in results:
            structure = result[0]
            run = result[1]
            transcript = result[2]
            positions = structure.get_values()

            # generate and add the header text for this structure
            buf += (">sid_" + str(structure.id) + "\t" + "ENERGY:" +
                    str(structure.energy) + " kcal/mol\t" + run.description +
                    "\n")

            # generate and add dot bracket text
            buf += insert_newlines(build_dot_bracket(positions)) + "\n"

        return buf
Exemplo n.º 4
0
    def generate_txt(self, results):
        # first we must extract and display the sequence, using the transcript object. output
        # in fasta-like format
        transcript = results[0][2]
        buf = ">"+self.transcript_id+"\n"
        buf += insert_newlines(transcript.get_sequence_str())+"\n"

        for result in results:
            structure = result[0]
            run = result[1]
            transcript = result[2]
            positions = structure.get_values()

            # generate and add the header text for this structure
            buf += (
                ">sid_"+str(structure.id)+"\t"+
                "ENERGY:"+str(structure.energy)+" kcal/mol\t"+
                run.description+"\n")

            # generate and add dot bracket text
            buf += insert_newlines(build_dot_bracket(positions))+"\n"
            
        return buf