| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.evoxml; |
| 27 |
|
| 28 |
import dr.evolution.LinkageConstraints; |
| 29 |
import dr.evolution.LinkedGroup; |
| 30 |
import dr.xml.*; |
| 31 |
|
| 32 |
import java.util.ArrayList; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public class LinkageConstraintsParser extends AbstractXMLObjectParser { |
| 38 |
|
| 39 |
|
| 40 |
public String getParserDescription() { |
| 41 |
return "Data representing metagenome reads that are linked by mate-pair, strobe, or other information"; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
public Class getReturnType() { |
| 46 |
return LinkageConstraints.class; |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
public XMLSyntaxRule[] getSyntaxRules() { |
| 51 |
return rules; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
public Object parseXMLObject(XMLObject xo) throws XMLParseException { |
| 56 |
ArrayList<LinkedGroup> groups = new ArrayList<LinkedGroup>(); |
| 57 |
for (int i = 0; i < xo.getChildCount(); i++) { |
| 58 |
Object child = xo.getChild(i); |
| 59 |
if (child instanceof LinkedGroup) { |
| 60 |
groups.add((LinkedGroup)child); |
| 61 |
} |
| 62 |
} |
| 63 |
LinkageConstraints lc = new LinkageConstraints(groups); |
| 64 |
return lc; |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
public String getParserName() { |
| 69 |
return "LinkageConstraints"; |
| 70 |
} |
| 71 |
|
| 72 |
private XMLSyntaxRule[] rules = new XMLSyntaxRule[]{ |
| 73 |
new ElementRule(LinkedGroup.class, 1, Integer.MAX_VALUE), |
| 74 |
}; |
| 75 |
|
| 76 |
} |