def get_version(self):
        help_string1 = E.run("{self.path_manta} --version".format(**locals()),
                             return_stdout=True).strip()

        help_string2 = E.run(
            "{self.path_strelka} --version".format(**locals()),
            return_stdout=True).strip()
        return "-".join([help_string1, help_string2])
 def get_version(self):
     help_string = E.run("{self.path}".format(**locals()),
                         return_stderr=True).strip()
     if "USAGE: pbsim" in help_string:
         return "unknown"
     else:
         raise ValueError("pbsim not found")
示例#3
0
 def get_version(self):
     help_string = E.run("{self.path} -h".format(**locals()),
                         return_stderr=True).strip()
     if "vcf-concat [OPTIONS]" in help_string:
         return "unknown"
     else:
         raise ValueError("vcf-concat not found")
示例#4
0
def expand_globs(config, is_test=False):
    """detect and expand glob expressions in the input section.

    A glob expression is any filename that contains a '*'. Multiple
    glob expressions can be combined on the same line by a ','.

    A "find" expression is detected starting with 'find'. These
    expressions will be evaluated in a shell and the results insterted
    into the dictionary.

    If a filename starts with "file=", the contents of the file
    following the "=" are read and inserted. Multiple files can be
    separated by a ','.

    If a glob or find expression is evaluated to nothing, an exception
    is raised unless ``is_test`` is set. In that case, two files will be
    returned called "test1" and "test2".
    """

    for d, key, value in IOTools.nested_iter(config):
        if isinstance(value, str):
            if value.startswith("find"):
                try:
                    data = E.run(value, return_stdout=True)
                except Exception as e:
                    data = e.output
                d[key] = [x for x in data.split("\n") if x]
            elif "*" in value:
                if "," in value:
                    v = [glob.glob(x.strip()) for x in value.split(",")]
                    v = [item for sublist in v for item in sublist]
                else:
                    v = glob.glob(value)
                d[key] = v
            elif value.startswith("file="):
                filenames = [x.strip() for x in value.split("=")[1].split(",")]
                paths = []
                for fn in filenames:
                    with IOTools.open_file(fn) as inf:
                        paths.extend([x.strip() for x in inf if x.strip()])
                d[key] = paths
            if len(d[key]) == 0:
                if not is_test:
                    raise ValueError(
                        "expression '{}' expanded to nothing".format(value))
                else:
                    # insert some random files for testing purposes:
                    if "*" in value:
                        # replace glob expressions
                        value = re.sub(",.*", "", value)
                        d[key] = [re.sub("[*]", "test1", value),
                                  re.sub("[*]", "test2", value)]
                    else:
                        if "bam" in value:
                            d[key] = ["test1.bam", "test2.bam"]
                        elif "vcf" in value:
                            d[key] = ["test1.vcf.gz", "test2.vcf.gz"]
                        else:
                            d[key] = ["test1.txt", "test2.txt"]
    return config
示例#5
0
 def get_version(self):
     version_bedtools = run_metric_bedtools_intersection.get_version(self)
     help_string = E.run(
         "{self.gat_path} --version 2> /dev/null".format(**locals()),
         return_stdout=True).strip()
     return "{} {}".format(
         version_bedtools,
         re.search(r"gat-run.py version: (\S+):", help_string).groups()[0])
 def get_version(self):
     help_text = E.run("{self.path} -version".format(**locals()),
                       return_stderr=True).strip()
     if help_text and "not found" not in help_text:
         return re.search(r"BBMap version (\S+)", help_text).groups()[0]
     else:
         raise ValueError("bbmap not found at/as {}: {}".format(
             self.path, help_text))
 def get_version(self):
     help_string = E.run("{self.path} --version".format(**locals()),
                         return_stderr=True).strip()
     if help_string and "not found" not in help_string:
         return re.search("Canu (.+)", help_string).groups()[0]
     else:
         raise ValueError("canu not found at/as {}: {}".format(
             self.path, help_string))
 def get_version(self):
     help_string = E.run("{self.path} ".format(**locals()),
                         return_stdout=True,
                         on_error="ignore").strip()
     if help_string:
         return re.search("Delly \(Version: (\S+)\)",
                          help_string).groups()[0]
     else:
         raise ValueError("delly not found at/as {}".format(self.path))
 def get_version(self):
     help_string = E.run("{self.path} ".format(**locals()),
                         return_stdout=True,
                         on_error="ignore").strip()
     # lumpy express without arguments ends in error
     if help_string:
         raise NotImplementedError()
         return re.search(r"lumpy \(Version: (\S+)\)",
                          help_string).groups()[0]
     else:
         raise ValueError("lumpy not found at/as {}".format(self.path))
 def get_version(self):
     help_string = E.run(
         "{self.path} version 2> /dev/null".format(**locals()),
         return_stdout=True,
         on_error="ignore").strip()
     if help_string and "not found" not in help_string:
         return re.search(r"Product: RTG Tools (\S+)",
                          help_string).groups()[0]
     else:
         raise ValueError("rtg not found at/as {}: {}".format(
             self.path, help_string))
示例#11
0
 def get_version(self):
     help_string = E.run("{self.path} --version".format(**locals()),
                         return_stdout=True).strip()
     return re.search("stat \(GNU coreutils\) (\S+)",
                      help_string).groups()[0]
 def get_version(self):
     return E.run("java -jar {self.path} --version".format(**locals()),
                  return_stdout=True).strip()
示例#13
0
 def get_version(self):
     help_string = E.run(
         "{self.path} --version 2> /dev/null".format(**locals()),
         return_stdout=True).strip()
     return re.search("gat-run.py version: (\S+):", help_string).groups()[0]
示例#14
0
def sra_peek(sra, outdir=None):
    """return the full file names for all files which will be extracted

    Parameters
    ----------

    outdir : path
        perform extraction in outdir. If outdir is None, the extraction
        will take place in a temporary directory, which will be deleted
        afterwards.

    Returns
    -------
    files : list
        A list of fastq formatted files that are contained in the archive.
    format : string
        The quality score format in the :term:`fastq` formatted files.

    """

    if outdir is None:
        workdir = tempfile.mkdtemp()
    else:
        workdir = outdir

    # --split-files creates files called prefix_#.fastq.gz,
    # where # is the read number.
    # If file cotains paired end data:
    # output = prefix_1.fastq.gz, prefix_2.fastq.gz
    #    *special case: unpaired reads in a paired end --> prefix.fastq.gz
    #    *special case: if paired reads are stored in a single read,
    #                   fastq-dump will split. There might be a joining
    #                   sequence. The output would thus be:
    #                   prefix_1.fastq.gz, prefix_2.fastq.gz, prefix_3.fastq.gz
    #                   You want files 1 and 3.

    E.run("""fastq-dump --split-files --gzip -X 1000
                 --outdir %(workdir)s %(sra)s""" % locals())
    f = sorted(glob.glob(os.path.join(workdir, "*.fastq.gz")))
    ff = [os.path.basename(x) for x in f]

    if len(f) == 1:
        # sra file contains one read: output = prefix.fastq.gz
        pass

    elif len(f) == 2:
        # sra file contains read pairs:
        # output = prefix_1.fastq.gz, prefix_2.fastq.gz
        assert ff[0].endswith(
            "_1.fastq.gz") and ff[1].endswith("_2.fastq.gz")

    elif len(f) == 3:
        if ff[2].endswith("_3.fastq.gz"):
            f = glob.glob(os.path.join(workdir, "*_[13].fastq.gz"))
        else:
            f = glob.glob(os.path.join(workdir, "*_[13].fastq.gz"))

    if outdir is None:
        shutil.rmtree(workdir)

    return [os.path.basename(x) for x in f]
示例#15
0
 def get_version(self):
     help_string = E.run(
         "{self.path} variants --version".format(**locals()),
         return_stdout=True).strip()
     return re.search("Version (\S+)", help_string).groups()[0]
示例#16
0
 def get_version(self):
     help_string = E.run("{self.path}".format(**locals()),
                         return_stderr=True).strip()
     return re.search("Version:\s*(\S+)", help_string).groups()[0]
示例#17
0
 def get_version(self):
     help_text = E.run("{self.path} --version 2> /dev/null".format(**locals()),
                       return_stdout=True).strip()
     return re.search("version (\S+)", help_text).groups()[0]
示例#18
0
 def get_version(self):
     help_string = E.run(
         "{self.path_freebayes} --version".format(**locals()),
         return_stdout=True).strip()
     return re.search("version:\s+(\S+)", help_string).groups()[0]
示例#19
0
 def get_version(self):
     help_string = E.run("{self.path_lastal} -V".format(**locals()),
                         return_stdout=True).strip()
     return re.search("lastal (.+)", help_string).groups()[0]
 def get_version(self):
     help_string = E.run("{self.path} --version".format(**locals()),
                         return_stdout=True).strip()
     return help_string
 def get_version(self):
     help_string = E.run("{self.path} --help".format(**locals()),
                         return_stdout=True).strip()
     return re.search("Welcome to FINEMAP (\S+)", help_string).groups()[0]