-
Notifications
You must be signed in to change notification settings - Fork 616
Funcotator - removing the required transcript file #8863
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
base: master
Are you sure you want to change the base?
Changes from all commits
d17ff2e
831ff6a
1ad11df
2566501
da656cd
a537762
adb2efe
3dddea3
606312a
f0aa453
e6b0d5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package org.broadinstitute.hellbender.utils; | ||
|
||
import htsjdk.samtools.util.Locatable; | ||
import javassist.Loader; | ||
import org.broadinstitute.hellbender.engine.ReferenceContext; | ||
import org.broadinstitute.hellbender.tools.funcotator.FuncotatorUtils; | ||
|
||
import java.util.Arrays; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Class with utility methods for working with transcripts. | ||
*/ | ||
public class TranscriptUtils { | ||
|
||
//================================================================================================================== | ||
// Public Static Members: | ||
|
||
/** | ||
* Extracts the transcript sequence from the reference context given the exons. | ||
* The given exons are assumed to be all on the same contig. | ||
* The exons will be sorted in the order they appear in the genome before extracting the sequences. | ||
* @param refContext the reference context. Must not be {@code null}. | ||
* @param exons the exons of the transcript. Must not be {@code null}. | ||
* @return the transcript sequence as coded in the given reference context. | ||
*/ | ||
public static final String extractTrascriptFromReference(final ReferenceContext refContext, | ||
jonn-smith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
final List<Locatable> exons) { | ||
return extractTrascriptFromReference(refContext, exons, false); | ||
} | ||
|
||
/** | ||
* Extracts the transcript sequence from the reference context given the exons. | ||
* The given exons are assumed to be all on the same contig. | ||
* The exons will be sorted in the order they appear in the genome before extracting the sequences. | ||
* @param refContext the reference context. Must not be {@code null}. | ||
* @param exons the exons of the transcript. Must not be {@code null}. | ||
* @param convertHg19ContigToB37Contig whether to convert the contig names from hg19 to b37. | ||
* @return the transcript sequence as coded in the given reference context. | ||
*/ | ||
public static final String extractTrascriptFromReference(final ReferenceContext refContext, | ||
final List<Locatable> exons, | ||
final boolean convertHg19ContigToB37Contig ) { | ||
|
||
// TODO: THIS CONVERSION IS BAD. WE MUST REFACTOR THIS EVENTUALLY TO REMOVE THIS AND MAKE SOME B37 DATA SOURCES. | ||
Utils.nonNull(refContext); | ||
Utils.nonNull(exons); | ||
|
||
final StringBuilder transcript = new StringBuilder(); | ||
|
||
// We should iterate through the list of exons in sorted order so we can simply append them together. | ||
for (final Locatable exon : exons.stream().sorted(Comparator.comparingInt(Locatable::getStart).thenComparing(Locatable::getEnd)).toList() ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again this ordering/overlapping assumption |
||
final SimpleInterval exonInterval; | ||
|
||
if ( convertHg19ContigToB37Contig ) { | ||
exonInterval = new SimpleInterval(FuncotatorUtils.convertHG19ContigToB37Contig(exon.getContig()), exon.getStart(), exon.getEnd()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this might be a little cleaner to read with a ternary (alternatively make some helper method somewhere called "getConvertedContigName()" (that goes for GencodeFuncotationFactory as well which also threads this a bunch) |
||
} | ||
else { | ||
exonInterval = new SimpleInterval(exon.getContig(), exon.getStart(), exon.getEnd()); | ||
} | ||
transcript.append(new String(refContext.getBases(exonInterval))); | ||
} | ||
return transcript.toString(); | ||
} | ||
|
||
//================================================================================================================== | ||
jonn-smith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Private Static Members: | ||
|
||
//================================================================================================================== | ||
// Private Members: | ||
|
||
//================================================================================================================== | ||
// Constructors: | ||
|
||
//================================================================================================================== | ||
// Override Methods: | ||
|
||
//================================================================================================================== | ||
// Static Methods: | ||
|
||
//================================================================================================================== | ||
// Instance Methods: | ||
|
||
//================================================================================================================== | ||
// Helper Data Types: | ||
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.