Exemple #1
0
    def __init__(self, f, filetype=None):
        print f, filetype
        self.file = getFileHandle(f, 'r')

        filetype = filetype or f.split('.')[-1]
        if filetype.lower() == 'm1':
            self._filetype = 'm1'
            self._datatype = BlasrM1
        elif filetype.lower() == 'm5':
            self._filetype = 'm5'
            self._datatype = BlasrM5
        else:
            raise BlasrTypeError("Invalid type to BlasrReader")
Exemple #2
0
    def __init__(self, f, filetype=None):
        self.file = getFileHandle(f, "r")

        filetype = filetype or f.split(".")[-1]
        if filetype.lower() == "m1":
            self._filetype = "m1"
            self._datatype = BlasrM1
        elif filetype.lower() == "m4":
            self._filetype = "m4"
            self._datatype = BlasrM4
        elif filetype.lower() == "m5":
            self._filetype = "m5"
            self._datatype = BlasrM5
        else:
            raise TypeError("Invalid type to BlasrReader")
Exemple #3
0
def readFofn(f):
    """
    Return iterator over filenames in a FOFN ("file-of-filenames")
    file or file-like object.

    If f is a path to a true FOFN on disk, any paths listed in the
    FOFN that are relative (i.e., do not contain a leading '/') will
    be reckoned from the directory containing the FOFN.
    """
    if isinstance(f, basestring):
        fofnRoot = dirname(abspath(f))
    else:
        fofnRoot = None

    for line in getFileHandle(f):
        path = line.rstrip()
        if isabs(path):
            yield path
        elif fofnRoot is not None:
            yield normpath(join(fofnRoot, path))
        else:
            raise IOError, "Cannot handle relative paths in StringIO FOFN"
Exemple #4
0
def readFofn(f):
    """
    Return iterator over filenames in a FOFN ("file-of-filenames")
    file or file-like object.

    If f is a path to a true FOFN on disk, any paths listed in the
    FOFN that are relative (i.e., do not contain a leading '/') will
    be reckoned from the directory containing the FOFN.
    """
    if isinstance(f, basestring):
        fofnRoot = dirname(abspath(f))
    else:
        fofnRoot = None

    for line in getFileHandle(f):
        path = line.rstrip()
        if isabs(path):
            yield path
        elif fofnRoot is not None:
            yield normpath(join(fofnRoot, path))
        else:
            raise IOError, "Cannot handle relative paths in StringIO FOFN"
Exemple #5
0
 def __init__(self, f):
     self.filename = f
     self.file = getFileHandle(f, "r")
Exemple #6
0
 def __init__(self, f):
     self.file = getFileHandle(f, 'r')
Exemple #7
0
 def __init__(self, f):
     self.file = getFileHandle(f, 'r')
Exemple #8
0
 def __init__(self, f):
     self.filename = f
     self.file = getFileHandle(f, "r")