|
1 | 1 | #!/usr/bin/python3 |
2 | 2 |
|
3 | | -# Copyright 2015-2018 Francisco Pina Martins <[email protected]> |
| 3 | +# Copyright 2015-2019 Francisco Pina Martins <[email protected]> |
4 | 4 | # and Diogo N. Silva <[email protected]> |
5 | 5 | # This file is part of structure_threader. |
6 | 6 | # structure_threader is free software: you can redistribute it and/or modify |
@@ -100,7 +100,8 @@ def __init__(self, kfile, fmt, get_indv=False): |
100 | 100 |
|
101 | 101 | parse_methods = {"structure": self._parse_structure, |
102 | 102 | "faststructure": self._parse_faststructure, |
103 | | - "maverick": self._parse_maverick} |
| 103 | + "maverick": self._parse_maverick, |
| 104 | + "alstructure": self._parse_alstructure} |
104 | 105 |
|
105 | 106 | # Let the parsing begin |
106 | 107 | parse_methods[self.fmt]() |
@@ -302,6 +303,22 @@ def _parse_maverick(self): |
302 | 303 | dtype="|U20", |
303 | 304 | skip_header=1).T[1].T) |
304 | 305 |
|
| 306 | + def _parse_alstructure(self): |
| 307 | + """ |
| 308 | + Parses the meanQ array of a single ALStructure output file |
| 309 | + Sets the qvals array, the number of individual taxa (nind) |
| 310 | + and number of clusters (k) |
| 311 | + """ |
| 312 | + |
| 313 | + self.qvals = np.genfromtxt(self.file_path) |
| 314 | + self.qvals = np.delete(self.qvals, 0, 0) |
| 315 | + self.qvals = np.delete(self.qvals, 0, 1) |
| 316 | + |
| 317 | + try: |
| 318 | + self.nind, self.k = self.qvals.shape |
| 319 | + except ValueError: |
| 320 | + self.k = 1 |
| 321 | + |
305 | 322 |
|
306 | 323 | class PlotList(AuxSanity): |
307 | 324 | """ |
|
0 commit comments