Skip to content

Commit b3e15e5

Browse files
committed
Make public method to generate jsonfile trackId
1 parent e67384e commit b3e15e5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public JSONObject getDefaultSessionJson(List<JsonFile> tracks, @Nullable List<St
311311
{
312312
boolean visibleByDefault = jf.isVisibleByDefault() || jf.matchesTrackSelector(additionalActiveTracks);
313313
if (visibleByDefault) {
314-
String trackId = jf.getObjectId();
314+
String trackId = jf.getJsonTrackId();
315315
defaultTracks.put(new JSONObject(){{
316316
put("type", jf.getTrackType());
317317
put("configuration", trackId);

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,7 @@ private JSONObject getVcfTrack(Logger log, ExpData targetFile, ReferenceGenome r
501501
{
502502
JSONObject ret = new JSONObject();
503503
ret.put("type", getTrackType());
504-
final File finalLocation = getLocationOfProcessedTrack(false);
505-
ret.put("trackId", finalLocation == null ? null : finalLocation.getName());
504+
ret.put("trackId", getJsonTrackId());
506505
ret.put("name", getLabel());
507506
ret.put("assemblyNames", new JSONArray(){{
508507
put(JBrowseSession.getAssemblyName(rg));
@@ -564,12 +563,17 @@ public boolean matchesTrackSelector(List<String> toTest)
564563
return toTest.contains(getObjectId()) || toTest.contains(getLabel());
565564
}
566565

566+
public String getJsonTrackId()
567+
{
568+
final File finalLocation = getLocationOfProcessedTrack(false);
569+
return finalLocation == null ? null : finalLocation.getName();
570+
}
571+
567572
private JSONObject getBamTrack(Logger log, ExpData targetFile, ReferenceGenome rg)
568573
{
569574
JSONObject ret = new JSONObject();
570575
ret.put("type", getTrackType());
571-
final File finalLocation = getLocationOfProcessedTrack(false);
572-
ret.put("trackId", finalLocation == null ? null : finalLocation.getName());
576+
ret.put("trackId", getJsonTrackId());
573577
ret.put("name", getLabel());
574578
ret.put("category", new JSONArray(){{
575579
put(getCategory());
@@ -653,8 +657,7 @@ private JSONObject getTabixTrack(Logger log, ExpData targetFile, ReferenceGenome
653657
{
654658
JSONObject ret = new JSONObject();
655659
ret.put("type", getTrackType());
656-
final File finalLocation = getLocationOfProcessedTrack(false);
657-
ret.put("trackId", finalLocation == null ? null : finalLocation.getName());
660+
ret.put("trackId", getJsonTrackId());
658661
ret.put("name", getLabel());
659662
ret.put("category", new JSONArray(){{
660663
put(getCategory());

0 commit comments

Comments
 (0)