Skip to content

Commit b08bce7

Browse files
committed
Bugfix to GTF/GFF and jbrowse
1 parent 5a95c30 commit b08bce7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

jbrowse/src/org/labkey/jbrowse/model/JsonFile.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,11 @@ private JSONObject getBamOrCramTrack(Logger log, ExpData targetFile, ReferenceGe
627627
{{
628628
put("location", new JSONObject()
629629
{{
630+
if (!new File(targetFile.getFile() + ".bai").exists())
631+
{
632+
log.error("Track lacks an index: {}, expected: {}", getObjectId(), targetFile.getFile().getPath() + ".bai");
633+
}
634+
630635
put("uri", url + ".bai");
631636
}});
632637
put("indexType", "BAI");
@@ -646,6 +651,11 @@ private JSONObject getBamOrCramTrack(Logger log, ExpData targetFile, ReferenceGe
646651
}});
647652
put("craiLocation", new JSONObject()
648653
{{
654+
if (!new File(targetFile.getFile() + ".bai").exists())
655+
{
656+
log.error("Track lacks an index: {}, expected: {}", getObjectId(), targetFile.getFile().getPath() + ".crai");
657+
}
658+
649659
put("uri", url + ".crai");
650660
}});
651661
put("sequenceAdapter", JBrowseSession.getBgZippedIndexedFastaAdapter(rg));
@@ -771,6 +781,11 @@ private JSONObject getTabixTrack(User u, Logger log, ExpData targetFile, Referen
771781
return null;
772782
}
773783

784+
if (!new File(targetFile.getFile() + ".tbi").exists())
785+
{
786+
log.error("Track lacks an index: {}, expected: {}", getObjectId(), targetFile.getFile().getPath() + ".tbi");
787+
}
788+
774789
ret.put("adapter", new JSONObject(){{
775790
put("type", adapterType);
776791
put(prefix + "GzLocation", new JSONObject(){{
@@ -1103,6 +1118,11 @@ protected void createIndex(File finalLocation, Logger log, File idx, boolean thr
11031118
}
11041119
else
11051120
{
1121+
if (TRACK_TYPES.bam.getFileType().isType(finalLocation) || TRACK_TYPES.cram.getFileType().isType(finalLocation))
1122+
{
1123+
SequenceAnalysisService.get().ensureBamOrCramIdx(finalLocation, log, false);
1124+
}
1125+
11061126
if (SystemUtils.IS_OS_WINDOWS)
11071127
{
11081128
try

0 commit comments

Comments
 (0)