Skip to content

Commit

Permalink
Enable linked read preferences, previously these were no-ops (#1645)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso authored Jan 25, 2025
1 parent 6429dac commit a37cff6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/broad/igv/prefs/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ private Constants() {
public static final String SAM_COLOR_BY_TAG = "SAM.COLOR_BY_TAG";
public static final String SAM_SORT_BY_TAG = "SAM.SORT_BY_TAG";
public static final String SAM_GROUP_BY_TAG = "SAM.GROUP_BY_TAG";
public static final String SAM_LINKED_READS = "SAM.LINK_READS";
public static final String SAM_LINK_TAG = "SAM.LINK_TAG";
public static final String SAM_LINK_BY_TAGS = "SAM.LINK_BY_TAGS";
public static final String SAM_GROUP_BY_POS = "SAM.GROUP_BY_POS";
public static final String SAM_BISULFITE_CONTEXT = "SAM.BISULFITE_CONTEXT";
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/broad/igv/sam/AlignmentTrack.java
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ void setLinkedReadView(boolean linkedReads, String tag) {
}

/**
* Detect if we are in linked-read view
* Detect if we are in linked-read view (10X Loupe style view)
*/
boolean isLinkedReadView() {
return renderOptions != null &&
Expand Down Expand Up @@ -1548,7 +1548,7 @@ public boolean isInvertGroupSorting() {
}

public String getLinkByTag() {
return linkByTag;
return linkByTag == null ? getPreferences().get(SAM_LINK_TAG) : linkByTag;
}

public GroupOption getGroupByOption() {
Expand All @@ -1564,7 +1564,7 @@ public GroupOption getGroupByOption() {
}

public boolean isLinkedReads() {
return linkedReads != null && linkedReads;
return linkedReads == null ? getPreferences().getAsBoolean(SAM_LINKED_READS) : linkedReads;
}

public boolean isQuickConsensusMode() {
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/org/broad/igv/sam/AlignmentTrackMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -1162,16 +1162,6 @@ void addLinkedReadItems() {
add(linkByTagItem);
}

private JCheckBoxMenuItem linkedReadViewItem(String tag) {
final JCheckBoxMenuItem item = new JCheckBoxMenuItem("Linked read view (" + tag + ")");
item.setSelected(alignmentTrack.isLinkedReadView() && tag != null && tag.equals(renderOptions.getLinkByTag()));
item.addActionListener(aEvt -> {
boolean linkedReads = item.isSelected();
alignmentTrack.setLinkedReadView(linkedReads, tag);
});
return item;
}

private JCheckBoxMenuItem linkedReadItem(String tag) {
final JCheckBoxMenuItem item = new JCheckBoxMenuItem("Link by " + tag);
item.setSelected(!alignmentTrack.isLinkedReadView() && alignmentTrack.isLinkedReads() && tag.equals(renderOptions.getLinkByTag()));
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/broad/igv/sam/LinkedAlignment.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.broad.igv.sam;

import htsjdk.samtools.SAMRecord;
import htsjdk.samtools.SAMTag;
import org.broad.igv.Globals;
import org.broad.igv.feature.Strand;
import org.broad.igv.track.WindowFunction;
Expand Down Expand Up @@ -299,7 +301,7 @@ public boolean isPrimary() {

@Override
public boolean isSupplementary() {
return false;
return true;
}

@Override
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/broad/igv/sam/SAMAlignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.broad.igv.prefs.Constants.SAM_HIDE_SMALL_INDEL;

/**
* @author jrobinso
*/
Expand Down Expand Up @@ -225,6 +223,12 @@ public Object getAttribute(String key) {
}
}

public List<SAMRecord.SAMTagAndValue> getAttributes() {
return record.getAttributes();
}



private Object getAttribute(SAMTag key) {
return key == null ? null : record.getAttribute(key);
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/org/broad/igv/prefs/preferences.tab
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,13 @@ SAM.ALLELE_USE_QUALITY Quality weight allele fraction boolean TRUE

SAM.COLOR_BY Color alignments by select NONE|READ_STRAND|FIRST_OF_PAIR_STRAND|PAIR_ORIENTATION|UNEXPECTED_PAIR|INSERT_SIZE|BASE_MODIFICATION|BASE_MODIFICATION_2COLOR|SAMPLE|READ_GROUP|LIBRARY|MOVIE|ZMW|BISULFITE|NOMESEQ|TAG|MAPPED_SIZE|LINK_STRAND|YC_TAG|READ_ORDER UNEXPECTED_PAIR
SAM.COLOR_BY_TAG Color by TAG string
---
SAM.GROUP_OPTION Group alignments by select NONE|STRAND|SAMPLE|READ_GROUP|LIBRARY|FIRST_OF_PAIR_STRAND|TAG|PAIR_ORIENTATION|MATE_CHROMOSOME|SV_ALIGNMENT|SUPPLEMENTARY|BASE_AT_POS|MOVIE|ZMW|HAPLOTYPE|READ_ORDER|LINKED|PHASE|MAPPING_QUALITY|DUPLICATE
SAM.GROUP_BY_TAG Group by TAG string
SAM.GROUP_ALL Syncrohize alignment track grouping boolean FALSE
SAM.GROUP_ALL Syncronize grouping across all alignment tracks boolean FALSE
---
SAM.LINK_READS Link alignments by tag boolean FALSE
SAM.LINK_TAG Linking tag string READNAME

SAM.QUALITY_THRESHOLD Mapping quality threshold int 0 Hide alignments with MQ lower than this value
SAM.ALIGNMENT_SCORE_THRESHOLD Alignment score threshold (AS tag) int 0
Expand Down

0 comments on commit a37cff6

Please sign in to comment.