Skip to content

Commit

Permalink
Bug fix -- bigbed parsing fails if there are comments in autoSql.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Oct 2, 2024
1 parent c644d51 commit c4f3ce7
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/main/java/org/broad/igv/ucsc/bb/BBUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ public static ASTable parseAutosql(String str) {
String table = "";
String[] lines = str.trim().split("\\R");
for (String line : lines) {
if (line.startsWith("#")) {
continue;
}
line = line.trim();
if (line.startsWith("table")) {
table = line.split("\\s+")[1].trim();
} else if (line.startsWith("(")) {
startDecoding = true;
} else if (line.startsWith(")")) {
break;
} else if (startDecoding) {
if (line.length() > 0) {
// " string chrom; \"Reference sequence chromosome or scaffold\"\n" +
if (line.length() > 0) {
if (line.startsWith("table")) {
table = line.split("\\s+")[1].trim();
} else if (line.startsWith("(")) {
startDecoding = true;
} else if (line.startsWith(")")) {
break;
} else if (startDecoding) {
int idx = line.indexOf(";");
String[] tokens = Globals.whitespacePattern.split(line.substring(0, idx));
String description = line.substring(idx + 1).replace("\"", "").trim();
fields.add(new ASField(tokens[0], tokens[1], description));
if (idx > 0) {
String[] tokens = Globals.whitespacePattern.split(line.substring(0, idx));
String description = line.substring(idx + 1).replace("\"", "").trim();
fields.add(new ASField(tokens[0], tokens[1], description));
}
}
}
}
Expand Down

0 comments on commit c4f3ce7

Please sign in to comment.