Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added setReadsToHighlight() method to AlignmentTrack #1660

Merged
merged 1 commit into from
Aug 14, 2023
Merged

added setReadsToHighlight() method to AlignmentTrack #1660

merged 1 commit into from
Aug 14, 2023

Conversation

wilsonGen
Copy link
Contributor

added setReadsToHighlight() method to AlignmentTrack
which can take an array of read names, then highlight the reads
for example :
const bamTracks = browser.findTracks('type', 'alignment')
bamTracks[0].alignmentTrack.setReadsToHighlight(["readName1", "readName2"])
bamTracks[0].updateViews()

also added
"highlightedReadsOutlineColor" (optional)
"readsToHighlight" (optional)
in Alignment Track options,
which allow configuration of the color of the highlighted reads,
and the configuration of the reads to highlight
for example:

{
type: "alignment",
format: "bam",
name: "NA12889",
url: "gs://genomics-public-data/platinum-genomes/bam/NA12878_S1.bam",
indexURL: "gs://genomics-public-data/platinum-genomes/bam/NA12878_S1.bam.bai",
sort: {
chr: "chr1",
position: 155155358
option": "BASE",
direction: "ASC"
},
highlightedReadsOutlineColor: "#0000ff",
readsToHighlight: ["readName1", "readName2"]
}

@wilsonGen
Copy link
Contributor Author

Hi, sorry for bothering, since it has been a month, is there any problem with the changes?
Please let me know if there is any problem with the changes, I am open to discuss and would like to improve it, thank you!

@jrobinso
Copy link
Contributor

Thanks for this, sorry for the delay. I've been swamped with other urgent issues, I'll get to this when I can.

@jrobinso
Copy link
Contributor

OK looks good, but let's shorten the names a bit. Maybe just

highlightedReads
setHighlightedReads()
highlightColor

I am going to independently rename the existing highlighted read variable to "selectedRead" or "clickedRead".

@jrobinso jrobinso merged commit 320532a into igvteam:master Aug 14, 2023
1 check passed
@jrobinso
Copy link
Contributor

I will merge and do the renaming.

@wilsonGen
Copy link
Contributor Author

OK, thank you!

jrobinso added a commit that referenced this pull request Aug 15, 2023
* bug fix -- "view mate in split screen" did not account for chr name aliasing
@jrobinso
Copy link
Contributor

OK I did some minor refactoring, including a subtle change for session saving. The shortened names are as suggested above. Also, I added a setHighlightedReads() function to BAMTrack, to avoid exposing the internal AlignmentTrack in the API. Finally, updateViews() is called from setHighlightedReads().

Updated example

               const bamTracks = browser.findTracks('type', 'alignment')
                bamTracks[0].setHighlightedReads(["SRR099953.99059361", "SRR099953.79101554"])

Modified example config

                    {
                        type: "alignment",
                        url: "https://1000genomes.s3.amazonaws.com/phase3/data/NA19625/exome_alignment/NA19625.mapped.ILLUMINA.bwa.ASW.exome.20120522.bam",
                        indexURL: "https://1000genomes.s3.amazonaws.com/phase3/data/NA19625/exome_alignment/NA19625.mapped.ILLUMINA.bwa.ASW.exome.20120522.bam.bai",
                        name: "NA12878n",
                        highlightColor: "#0000ff",
                        highlightedReads: ["SRR099953.99059361", "SRR099953.79101554"]
                    }

@wilsonGen
Copy link
Contributor Author

That's great! Thank you so much!

jrobinso added a commit that referenced this pull request May 19, 2024
* bug fix -- "view mate in split screen" did not account for chr name aliasing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants