Ejemplo n.º 1
0
    converting formats that have the same statistics and for conversion to
    formats with the same level of detail, or less.

    For example, converting from a BLAST+ XML output to a HMMER table file
    is not possible, as these are two search programs with different kinds of
    statistics. In theory, you may provide the necessary values required by the
    HMMER table file (e.g. conditional e-values, envelope coordinates, etc).
    However, these values are likely to hold little meaning as they are not true
    HMMER-computed values.

    Another example is converting from BLAST+ XML to BLAST+ tabular file. This
    is possible, as BLAST+ XML provide all the values necessary to create a
    BLAST+ tabular file. However, the reverse conversion may not be possible.
    There are more details covered in the XML file that are not found in a
    tabular file (e.g. the lambda and kappa values)

    """
    if in_kwargs is None:
        in_kwargs = {}
    if out_kwargs is None:
        out_kwargs = {}

    qresults = parse(in_file, in_format, **in_kwargs)
    return write(qresults, out_file, out_format, **out_kwargs)


# if not used as a module, run the doctest
if __name__ == "__main__":
    from Bio.SearchIO._utils import run_doctest
    run_doctest()
Ejemplo n.º 2
0
    def get_raw(self, offset):
        """Returns the raw string of a QueryResult object from the given offset."""
        handle = self._handle
        handle.seek(offset)
        qresult_key = None
        qresult_raw = _as_bytes('')

        while True:
            line = handle.readline()
            if not line:
                break
            elif line.startswith(self._query_mark):
                cur_pos = handle.tell()
                if qresult_key is None:
                    qresult_key = self.get_qresult_id(cur_pos)
                else:
                    curr_key = self.get_qresult_id(cur_pos)
                    if curr_key != qresult_key:
                        break
                handle.seek(cur_pos)
            qresult_raw += line

        return qresult_raw


# if not used as a module, run the doctest
if __name__ == "__main__":
    from Bio.SearchIO._utils import run_doctest
    run_doctest()