Exemple #1
0
 def get_info(cls):
     '''Implements ISynthesizer.get_info.'''
     if cls.INFO is None:
         out = iterpipes.run(iterpipes.linecmd('speak --voices'))
         # get voices from fixed width columns
         voices = [ln[40:52].strip() for i, ln in enumerate(out) if i > 0]
         # generate all variants for voices
         variants = ['', '+f1', '+f2', '+f3', '+f4', '+m1', '+m2', '+m3', 
             '+m4', '+m5', '+m6', '+whisper', '+croak']
         voices = itertools.chain(*[
             [voice+variant for voice in voices] 
             for variant in variants
         ])
         cls.INFO = {
             'rate' : {
                 'minimum' : cls.MIN_RATE, 
                 'maximum' : cls.MAX_RATE,
                 'default' : 200
             },
             'pitch' : {
                 'minimum' : 0.0, 
                 'maximum' : 1.0,
                 'default' : 0.5
             }, 
             'voices' : {
                 'values' : list(voices),
                 'default' : 'default'
             }
         }
     return cls.INFO
def runIgBlastp( query, germlineSpecie = GERMLINE_HUMAN, domainSystem = DOMAIN_IMGT,
                 additionalDB = None, numThreads = 4, numAlignments = 10, outfmt = 3, out = None ):
    igblastp = os.path.join(os.path.join('.', IGBLAST_BIN), "igblastp")
    params = []

    if query == "" or germlineSpecie == "" or domainSystem not in [DOMAIN_IMGT, DOMAIN_KABAT]:
        return None

    # Query
    query = os.path.abspath(query)
    igblastp += " -query {}"
    params.append(query)

    # Germline
    germlineSpecie = "{0}/{1}_gl_V".format(IGBLAST_GERMLINE, germlineSpecie)
    igblastp += " -germline_db_V {}"
    params.append(germlineSpecie)

    # Domain
    igblastp += " -domain_system {}"
    params.append(domainSystem)

    # Database
    if additionalDB != None:
        additionalDB = os.path.join(BLASTDB_PATH, additionalDB)
        igblastp += " -db {}"
        params.append(additionalDB)

    # Threads
    igblastp += " -num_threads {}"
    params.append(str(numThreads))

    # Alignments
    igblastp += " -num_alignments {}"
    params.append(str(numAlignments))

    # Output format
    igblastp += " -outfmt {}"
    params.append(str(outfmt))

    # Output file
    if out != None:
        igblastp += " -out {}"
        params.append(out)

    # RUN IGBLASTP
    cur = os.path.curdir
    os.chdir(IGBLAST_PATH)
    runLine = iterpipes.linecmd(igblastp, *params)
    result = iterpipes.run(runLine)
    os.chdir(cur)

    returnResult = ""
    for line in result:
        returnResult += line

    return returnResult
Exemple #3
0
 def get_info(cls):
     """Implements ISynthesizer.get_info."""
     if cls.INFO is None:
         out = iterpipes.run(iterpipes.linecmd("speak --voices"))
         # get voices from fixed width columns
         voices = [ln[40:52].strip() for i, ln in enumerate(out) if i > 0]
         # generate all variants for voices
         variants = ["", "+f1", "+f2", "+f3", "+f4", "+m1", "+m2", "+m3", "+m4", "+m5", "+m6", "+whisper", "+croak"]
         voices = itertools.chain(*[[voice + variant for voice in voices] for variant in variants])
         cls.INFO = {
             "rate": {"minimum": cls.MIN_RATE, "maximum": cls.MAX_RATE, "default": 200},
             "pitch": {"minimum": 0.0, "maximum": 1.0, "default": 0.5},
             "voices": {"values": list(voices), "default": "default"},
         }
     return cls.INFO
Exemple #4
0
  def CreatePipFreezeRequest( self ):
    """The property to call the commandline, using an iteration from iterpipes run command.
The rest of overloading definition from PipFreezeDict __setitems__ will by handle by property
GetPipRunCmd, this one simply call the command and put it a queue-list until a iteration
mechanism read from this run statement ."""
    self.pip_freeze = run( linecmd( self.PipCommand ) )
Exemple #5
0
        # write wave file into path
        wav = os.path.join(self._path, hashFn + ".wav")
        if not os.path.isfile(wav):
            args = self._opts + [wav]
            c = iterpipes.cmd("speak -s{} -p{} -v{} -w{}", *args, encoding="utf-8")
            ret = iterpipes.call(c, utterance)
        return hashFn

    @classmethod
    def get_info(cls):
        """Implements ISynthesizer.get_info."""
        if cls.INFO is None:
            out = iterpipes.run(iterpipes.linecmd("speak --voices"))
            # get voices from fixed width columns
            voices = [ln[40:52].strip() for i, ln in enumerate(out) if i > 0]
            # generate all variants for voices
            variants = ["", "+f1", "+f2", "+f3", "+f4", "+m1", "+m2", "+m3", "+m4", "+m5", "+m6", "+whisper", "+croak"]
            voices = itertools.chain(*[[voice + variant for voice in voices] for variant in variants])
            cls.INFO = {
                "rate": {"minimum": cls.MIN_RATE, "maximum": cls.MAX_RATE, "default": 200},
                "pitch": {"minimum": 0.0, "maximum": 1.0, "default": 0.5},
                "voices": {"values": list(voices), "default": "default"},
            }
        return cls.INFO


SynthClass = EspeakSynth

# Make sure that espeak is installed and functioning by asking for voices.
iterpipes.check_call(iterpipes.linecmd("speak --voices"))