Unverified Commit dd156d08 authored by mvdbeek's avatar mvdbeek
Browse files

Tighten phylip sniffer

parent 72e16548
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -104,6 +104,11 @@ class Phylip(Text):
            if any(str.isdigit(c) for c in seq):
                # Could tighten up further by requiring IUPAC strings chars
                return False
        line = alignment_prefix.readline()
        if line.strip():
            # There should be a newline separating alignments.
            # If we got more content this is probably not a phylip file
            return False
        # There may be more lines with the remaining parts of the sequences
        return True

@@ -119,6 +124,9 @@ class Phylip(Text):
        >>> fname = get_test_fname('test_relaxed_interleaved.phylip')
        >>> Phylip().sniff(fname)
        True
        >>> fname = get_test_fname("not_a_phylip_file.tabular")
        >>> Phylip().sniff(fname)
        False
        """
        f = file_prefix.string_io()
        # Get number of sequences and sequence length from first line
+5 −0
Original line number Diff line number Diff line
1	2
A	B
D	E
X	Y
1	2