Ejemplo n.º 1
0
    def make_master_fasta(self, output_fasta=None, force=None):
        '''
        Directly create a fasta file from the master sequences of each
        cluster of a list.

        @param:    output_fasta
        @pdef:     name of the Fasta file
        @pdefault: input fasta + threshold + '.fa'
        @ptype:    {String}

        @param:    force
        @pdef:     overwrite previous files with the same name
        @pdefault: _SBIglobals.overwrite_
        @ptype:    {Boolean}

        @return: {Fasta}
        '''
        if output_fasta is None:
            output_fasta = self.master_fasta_file
        clist = self.parse()
        prots = set()
        fs = Fasta(self._input)
        for c in clist.clusters:
            prots.add(c.master.name)
        seq = fs.retrieve(prots)
        return Fasta.build_multifasta(output_fasta, seq, force=force)
Ejemplo n.º 2
0
 def get_PDBseq_filtered(self, resolution_threshold, output_file):
     resolutions = self.get_resolutions()
     names = [
         k for k, v in resolutions.iteritems()
         if float(v) <= float(resolution_threshold)
     ]
     sequences = Fasta(os.path.join(self.PDBseq, 'PDBseq.fa'))
     selectedseq = sequences.retrieve(copy.deepcopy(names), prefix_size=4)
     return Fasta.build_multifasta(output_file, selectedseq, True)