本文整理汇总了Java中htsjdk.tribble.annotation.Strand.NEGATIVE属性的典型用法代码示例。如果您正苦于以下问题:Java Strand.NEGATIVE属性的具体用法?Java Strand.NEGATIVE怎么用?Java Strand.NEGATIVE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类htsjdk.tribble.annotation.Strand
的用法示例。
在下文中一共展示了Strand.NEGATIVE属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createExons
private void createExons(int start, String[] tokens, FullBEDFeature gene,
Strand strand) throws NumberFormatException {
int cdStart = Integer.parseInt(tokens[6]) + startOffsetValue;
int cdEnd = Integer.parseInt(tokens[7]);
int exonCount = Integer.parseInt(tokens[9]);
String[] exonSizes = new String[exonCount];
String[] startsBuffer = new String[exonCount];
ParsingUtils.split(tokens[10], exonSizes, ',');
ParsingUtils.split(tokens[11], startsBuffer, ',');
int exonNumber = (strand == Strand.NEGATIVE ? exonCount : 1);
if (startsBuffer.length == exonSizes.length) {
for (int i = 0; i < startsBuffer.length; i++) {
int exonStart = start + Integer.parseInt(startsBuffer[i]);
int exonEnd = exonStart + Integer.parseInt(exonSizes[i]) - 1;
gene.addExon(exonStart, exonEnd, cdStart, cdEnd, exonNumber);
if (strand == Strand.NEGATIVE) {
exonNumber--;
} else {
exonNumber++;
}
}
}
}
示例2: provideReferenceAndExonListForGatkExceptions
@DataProvider
Object[][] provideReferenceAndExonListForGatkExceptions() {
return new Object[][] {
{
new ReferenceContext(new ReferenceFileSource(TEST_REFERENCE), new SimpleInterval(TEST_REFERENCE_CONTIG, TEST_REFERENCE_START, TEST_REFERENCE_END)),
Collections.singletonList(
new SimpleInterval("2", TEST_REFERENCE_START + 500, TEST_REFERENCE_START + 550)
),
Strand.POSITIVE
},
{
new ReferenceContext(new ReferenceFileSource(TEST_REFERENCE), new SimpleInterval(TEST_REFERENCE_CONTIG, TEST_REFERENCE_START, TEST_REFERENCE_END)),
Collections.singletonList(
new SimpleInterval("2", TEST_REFERENCE_START + 500, TEST_REFERENCE_START + 550)
),
Strand.NEGATIVE
},
{
new ReferenceContext(new ReferenceFileSource(TEST_REFERENCE), new SimpleInterval(TEST_REFERENCE_CONTIG, TEST_REFERENCE_START, TEST_REFERENCE_END)),
Collections.singletonList(
new SimpleInterval("2", TEST_REFERENCE_START + 500, TEST_REFERENCE_START + 550)
),
Strand.NONE
},
};
}
示例3: provideDataForGetStartPositionInTranscript
@DataProvider
Object[][] provideDataForGetStartPositionInTranscript() {
final List<? extends Locatable> exons_forward = Arrays.asList(
new SimpleInterval("chr1", 10,19),
new SimpleInterval("chr1", 30,39),
new SimpleInterval("chr1", 50,59),
new SimpleInterval("chr1", 70,79),
new SimpleInterval("chr1", 90,99)
);
final List<? extends Locatable> exons_backward = Arrays.asList(
new SimpleInterval("chr1", 90,99),
new SimpleInterval("chr1", 70,79),
new SimpleInterval("chr1", 50,59),
new SimpleInterval("chr1", 30,39),
new SimpleInterval("chr1", 10,19)
);
return new Object[][] {
{ new SimpleInterval("chr1", 1, 1), exons_forward, Strand.POSITIVE, -1 },
{ new SimpleInterval("chr1", 25, 67), exons_forward, Strand.POSITIVE, -1 },
{ new SimpleInterval("chr1", 105, 392), exons_forward, Strand.POSITIVE, -1 },
{ new SimpleInterval("chr1", 10, 10), exons_forward, Strand.POSITIVE, 1 },
{ new SimpleInterval("chr1", 99, 99), exons_forward, Strand.POSITIVE, 50 },
{ new SimpleInterval("chr1", 50, 67), exons_forward, Strand.POSITIVE, 21 },
{ new SimpleInterval("chr1", 67, 75), exons_forward, Strand.POSITIVE, -1 },
{ new SimpleInterval("chr1", 1, 1), exons_backward, Strand.NEGATIVE, -1 },
{ new SimpleInterval("chr1", 25, 67), exons_backward, Strand.NEGATIVE, -1 },
{ new SimpleInterval("chr1", 105, 392), exons_backward, Strand.NEGATIVE, -1 },
{ new SimpleInterval("chr1", 10, 10), exons_backward, Strand.NEGATIVE, 50 },
{ new SimpleInterval("chr1", 99, 99), exons_backward, Strand.NEGATIVE, 1 },
{ new SimpleInterval("chr1", 50, 67), exons_backward, Strand.NEGATIVE, -1 },
{ new SimpleInterval("chr1", 67, 75), exons_backward, Strand.NEGATIVE, 15 },
};
}
示例4: provideDataForGetTranscriptAlleleStartPosition
@DataProvider
Object[][] provideDataForGetTranscriptAlleleStartPosition() {
return new Object[][] {
{ 1, 1, 10, Strand.POSITIVE, 1},
{ 5, 1, 10, Strand.POSITIVE, 5},
{ 10, 1, 10, Strand.POSITIVE, 10},
{ 1, 1, 10, Strand.NEGATIVE, 10},
{ 5, 1, 10, Strand.NEGATIVE, 6},
{ 10, 1, 10, Strand.NEGATIVE, 1},
};
}
示例5: provideDataForTestCreateSpliceSiteCodonChange
@DataProvider
Object[][] provideDataForTestCreateSpliceSiteCodonChange() {
return new Object[][] {
{1000, 5, 1000, 1500, Strand.POSITIVE, 0, "c.e5-0"},
{1000, 4, 1, 1500, Strand.POSITIVE, 0, "c.e4+500"},
{1000, 3, 500, 1500, Strand.POSITIVE, 0, "c.e3-500"},
{1000, 5, 1000, 1500, Strand.NEGATIVE, 0, "c.e5+0"},
{1000, 4, 1, 1500, Strand.NEGATIVE, 0, "c.e4-500"},
{1000, 3, 500, 1500, Strand.NEGATIVE, 0, "c.e3+500"},
{1000, 5, 1500, 500, Strand.NEGATIVE, 0, "c.e5+500"},
{1000, 5, 1000, 1500, Strand.POSITIVE, 1, "c.e5+1"},
{1000, 4, 1, 1500, Strand.POSITIVE, 2, "c.e4+502"},
{1000, 3, 500, 1500, Strand.POSITIVE, 3, "c.e3-497"},
{1000, 5, 1000, 1500, Strand.NEGATIVE, 4, "c.e5+4"},
{1000, 4, 1, 1500, Strand.NEGATIVE, 5, "c.e4-495"},
{1000, 3, 500, 1500, Strand.NEGATIVE, 6, "c.e3+506"},
{1000, 5, 1500, 500, Strand.NEGATIVE, 7, "c.e5+507"},
{1000, 5, 1000, 1500, Strand.POSITIVE, -1, "c.e5-1"},
{1000, 4, 1, 1500, Strand.POSITIVE, -2, "c.e4+498"},
{1000, 3, 500, 1500, Strand.POSITIVE, -3, "c.e3-503"},
{1000, 5, 1000, 1500, Strand.NEGATIVE, -4, "c.e5-4"},
{1000, 4, 1, 1500, Strand.NEGATIVE, -5, "c.e4-505"},
{1000, 3, 500, 1500, Strand.NEGATIVE, -6, "c.e3+494"},
{1000, 5, 1500, 500, Strand.NEGATIVE, -7, "c.e5+493"},
};
}
示例6: provideDataForTestAssertValidStrand_ValidStrands
@DataProvider
Object[][] provideDataForTestAssertValidStrand_ValidStrands() {
return new Object[][] {
{ Strand.POSITIVE },
{ Strand.NEGATIVE },
};
}
示例7: getStrand
/** returns the strand */
public Strand getStrand()
{
switch(strand)
{
case '+': return Strand.POSITIVE;
case '-': return Strand.NEGATIVE;
default: return Strand.NONE;
}
}
示例8: doWork
@Override
protected int doWork() {
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsReadable(SEQUENCE_DICTIONARY);
IOUtil.assertFileIsWritable(OUTPUT);
try {
// create a new header that we will assign the dictionary provided by the SAMSequenceDictionaryExtractor to.
final SAMFileHeader header = new SAMFileHeader();
final SAMSequenceDictionary samSequenceDictionary = SAMSequenceDictionaryExtractor.extractDictionary(SEQUENCE_DICTIONARY.toPath());
header.setSequenceDictionary(samSequenceDictionary);
// set the sort order to be sorted by coordinate, which is actually done below
// by getting the .uniqued() intervals list before we write out the file
header.setSortOrder(SAMFileHeader.SortOrder.coordinate);
final IntervalList intervalList = new IntervalList(header);
/**
* NB: BED is zero-based, but a BEDCodec by default (since it is returns tribble Features) has an offset of one,
* so it returns 1-based starts. Ugh. Set to zero.
*/
final FeatureReader<BEDFeature> bedReader = AbstractFeatureReader.getFeatureReader(INPUT.getAbsolutePath(), new BEDCodec(BEDCodec.StartOffset.ZERO), false);
final CloseableTribbleIterator<BEDFeature> iterator = bedReader.iterator();
final ProgressLogger progressLogger = new ProgressLogger(LOG, (int) 1e6);
while (iterator.hasNext()) {
final BEDFeature bedFeature = iterator.next();
final String sequenceName = bedFeature.getContig();
/**
* NB: BED is zero-based, so we need to add one here to make it one-based. Please observe we set the start
* offset to zero when creating the BEDCodec.
*/
final int start = bedFeature.getStart() + 1;
/**
* NB: BED is 0-based OPEN (which, for the end is equivalent to 1-based closed).
*/
final int end = bedFeature.getEnd();
// NB: do not use an empty name within an interval
String name = bedFeature.getName();
if (name.isEmpty()) name = null;
final SAMSequenceRecord sequenceRecord = header.getSequenceDictionary().getSequence(sequenceName);
// Do some validation
if (null == sequenceRecord) {
throw new PicardException(String.format("Sequence '%s' was not found in the sequence dictionary", sequenceName));
} else if (start < 1) {
throw new PicardException(String.format("Start on sequence '%s' was less than one: %d", sequenceName, start));
} else if (sequenceRecord.getSequenceLength() < start) {
throw new PicardException(String.format("Start on sequence '%s' was past the end: %d < %d", sequenceName, sequenceRecord.getSequenceLength(), start));
} else if (end < 1) {
throw new PicardException(String.format("End on sequence '%s' was less than one: %d", sequenceName, end));
} else if (sequenceRecord.getSequenceLength() < end) {
throw new PicardException(String.format("End on sequence '%s' was past the end: %d < %d", sequenceName, sequenceRecord.getSequenceLength(), end));
} else if (end < start - 1) {
throw new PicardException(String.format("On sequence '%s', end < start-1: %d <= %d", sequenceName, end, start));
}
final boolean isNegativeStrand = bedFeature.getStrand() == Strand.NEGATIVE;
final Interval interval = new Interval(sequenceName, start, end, isNegativeStrand, name);
intervalList.add(interval);
progressLogger.record(sequenceName, start);
}
CloserUtil.close(bedReader);
// Sort and write the output
IntervalList out = intervalList;
if (SORT) out = out.sorted();
if (UNIQUE) out = out.uniqued();
out.write(OUTPUT);
} catch (final IOException e) {
throw new RuntimeException(e);
}
return 0;
}
示例9: createSpliceSiteCodonChange
/**
* Gets a codon change string for a splice site.
* Assumes the variant and exon referenced in the params are on the same contig.
* @param variantStart Start position (1-based, inclusive) of the variant. Must be > 0.
* @param exonNumber Number (1-based) of the exon in the transcript. Must be > 0.
* @param exonStart Start position (1-based, inclusive) of the exon. Must be > 0.
* @param exonEnd End position (1-based, inclusive) of the exon. Must be > 0.
* @param strand The {@link Strand} on which the variant and exon are read. Must not be {@code null}. Must not be {@link Strand#NONE}.
* @param offsetIndelAdjustment An adjustment added to account for bases lost / gained in an Indel event.
* @return A {@link String} representing the codon change for the splice site represented by the given parameters.
*/
public static String createSpliceSiteCodonChange(final int variantStart,
final int exonNumber,
final int exonStart,
final int exonEnd,
final Strand strand,
final int offsetIndelAdjustment) {
ParamUtils.isPositive(variantStart, "Genomic positions must be > 0.");
ParamUtils.isPositive(exonNumber, "Exon number must be > 0.");
ParamUtils.isPositive(exonStart, "Genomic positions must be > 0.");
ParamUtils.isPositive(exonEnd, "Genomic positions must be > 0.");
assertValidStrand( strand );
char sign = '-';
int offset = exonStart - variantStart;
if ( Math.abs(offset) > Math.abs(variantStart - exonEnd)) {
offset = variantStart - exonEnd;
sign = '+';
}
offset = Math.abs(offset);
if (strand == Strand.NEGATIVE) {
if ( sign == '+' ) {
sign = '-';
}
else {
sign = '+';
}
}
// Add our indel adjustment here:
if ( sign == '+' ) {
offset += offsetIndelAdjustment;
}
else {
offset -= offsetIndelAdjustment;
}
// Make sure we correctly adjust for the zero crossing:
if ( offset < 0 ) {
offset *= -1;
if ( sign == '+') {
sign = '-';
}
else {
sign = '+';
}
}
return "c.e" + exonNumber + sign + offset;
}
示例10: getOverlappingExonPositions
/**
* Get the overlapping exon start/stop as a {@link SimpleInterval} for the given altAllele / reference.
* @param refAllele {@link Allele} for the given {@code altAllele}. Must not be {@code null}.
* @param altAllele {@link Allele} to locate on an exon. Must not be {@code null}.
* @param contig Contig on which the altAllele occurs. Must not be {@code null}.
* @param variantStart Start position (1-based, inclusive) of the given {@code altAllele}. Must be > 0.
* @param variantEnd End position (1-based, inclusive) of the given {@code altAllele}. Must be > 0.
* @param exonPositionList List of exon start / stop positions to cross-reference with the given {@code altAllele}. Must not be {@code null}.
* @param strand The {@link Strand} on which the {@code altAllele} is located. Must not be {@code null}. Must not be {@link Strand#NONE}.
* @return A {@link SimpleInterval} containing the extants of the exon that overlaps the given altAllele. {@code null} if no overlap occurs.
*/
public static SimpleInterval getOverlappingExonPositions(final Allele refAllele,
final Allele altAllele,
final String contig,
final int variantStart,
final int variantEnd,
final Strand strand,
final List<? extends htsjdk.samtools.util.Locatable> exonPositionList) {
Utils.nonNull( refAllele );
Utils.nonNull( altAllele );
Utils.nonNull( contig );
Utils.nonNull( exonPositionList );
assertValidStrand( strand );
ParamUtils.isPositive( variantStart, "Genome positions must be > 0." );
ParamUtils.isPositive( variantEnd, "Genome positions must be > 0." );
// Get the correct start / end positions:
int alleleStart = variantStart;
int alleleEnd = variantEnd;
if ( refAllele.length() > refAllele.length() ) {
final int lengthAdjustment = (refAllele.length() - altAllele.length());
if ( strand == Strand.NEGATIVE ) {
alleleStart -= lengthAdjustment;
}
else {
alleleEnd += lengthAdjustment;
}
}
// Create an interval so we can check for overlap:
final SimpleInterval variantInterval = new SimpleInterval( contig, alleleStart, alleleEnd );
int exonStart = -1;
int exonStop = -1;
// Check for overlap:
for ( final Locatable exon : exonPositionList ) {
if ( variantInterval.overlaps(exon) ) {
exonStart = exon.getStart();
exonStop = exon.getEnd();
}
}
// Since we set the start/stop together we only need to check one of these:
if ( exonStart == -1 ) {
return null;
}
else {
return new SimpleInterval( contig, exonStart, exonStop );
}
}
示例11: provideDataForGetAlignedCodingSequenceAllele
@DataProvider
Object[][] provideDataForGetAlignedCodingSequenceAllele() {
final String seq = "ATGAAAGGGGTGCCTATGCTAGATAGACAGATAGTGTGTGTGTGTGTGCGCGCGCGCGCGCGTTGTTAG";
//CTA ACA ACG CGC GCG CGC GCG CAC ACA CAC ACA CAC TAT CTG TCT ATC TAG CAT AGG CAC CCC TTT CAT
// final Allele refAllele,
// final Integer refAlleleStart,
return new Object[][] {
{ seq, 1, 3, Allele.create("ATG", true), 1, Strand.POSITIVE, "ATG" },
{ seq, 4, 6, Allele.create("AAA", true), 4, Strand.POSITIVE, "AAA" },
{ seq, 7, 9, Allele.create("GGG", true), 7, Strand.POSITIVE, "GGG" },
{ seq, 10, 12, Allele.create("GTG", true), 10, Strand.POSITIVE, "GTG" },
{ seq, 13, 15, Allele.create("CCT", true), 13, Strand.POSITIVE, "CCT" },
{ seq, 16, 18, Allele.create("ATG", true), 16, Strand.POSITIVE, "ATG" },
{ seq, 19, 21, Allele.create("CTA", true), 19, Strand.POSITIVE, "CTA" },
{ seq, 1, 6, Allele.create("ATGAAA", true), 1, Strand.POSITIVE, "ATGAAA" },
{ seq, 4, 9, Allele.create("AAAGGG", true), 4, Strand.POSITIVE, "AAAGGG" },
{ seq, 7, 12, Allele.create("GGGGTG", true), 7, Strand.POSITIVE, "GGGGTG" },
{ seq, 10, 15, Allele.create("GTGCCT", true), 10, Strand.POSITIVE, "GTGCCT" },
{ seq, 13, 18, Allele.create("CCTATG", true), 13, Strand.POSITIVE, "CCTATG" },
{ seq, 16, 21, Allele.create("ATGCTA", true), 16, Strand.POSITIVE, "ATGCTA" },
{ seq, 19, 24, Allele.create("CTAGAT", true), 19, Strand.POSITIVE, "CTAGAT" },
{ seq, 1, seq.length(), Allele.create(seq, true), 1, Strand.POSITIVE, seq },
{ seq, 1, 3, Allele.create("CTA", true), 1, Strand.NEGATIVE, "CTA" },
{ seq, 4, 6, Allele.create("ACA", true), 4, Strand.NEGATIVE, "ACA" },
{ seq, 7, 9, Allele.create("ACG", true), 7, Strand.NEGATIVE, "ACG" },
{ seq, 10, 12, Allele.create("CGC", true), 10, Strand.NEGATIVE, "CGC" },
{ seq, 13, 15, Allele.create("GCG", true), 13, Strand.NEGATIVE, "GCG" },
{ seq, 16, 18, Allele.create("CGC", true), 16, Strand.NEGATIVE, "CGC" },
{ seq, 19, 21, Allele.create("GCG", true), 19, Strand.NEGATIVE, "GCG" },
{ seq, 1, 6, Allele.create("CTAACA", true), 1, Strand.NEGATIVE, "CTAACA" },
{ seq, 4, 9, Allele.create("ACAACG", true), 4, Strand.NEGATIVE, "ACAACG" },
{ seq, 7, 12, Allele.create("ACGCGC", true), 7, Strand.NEGATIVE, "ACGCGC" },
{ seq, 10, 15, Allele.create("CGCGCG", true), 10, Strand.NEGATIVE, "CGCGCG" },
{ seq, 13, 18, Allele.create("GCGCGC", true), 13, Strand.NEGATIVE, "GCGCGC" },
{ seq, 16, 21, Allele.create("CGCGCG", true), 16, Strand.NEGATIVE, "CGCGCG" },
{ seq, 19, 24, Allele.create("GCGCAC", true), 19, Strand.NEGATIVE, "GCGCAC" },
{ seq, 1, seq.length(), Allele.create(ReadUtils.getBasesReverseComplement( seq.getBytes() ), true), 1, Strand.NEGATIVE, ReadUtils.getBasesReverseComplement( seq.getBytes() ) },
};
}
示例12: liftOverGenomeInterval
public Collection<ReadMapBlock> liftOverGenomeInterval(final GenomeInterval interval, final int minIntervalLength) {
final Collection<ReadMapBlock> readMapBlocks = new ArrayList<>();
final ChrString chromosome = interval.chromosome;
final int start = interval.start;
final int end = interval.end;
final MapBlock keyStart = new MapBlock(new GenomeLocation(chromosome, start));
final MapBlock keyEnd = new MapBlock(new GenomeLocation(chromosome, end - 1));
if (!chrBlocks.containsKey(chromosome)) {
return readMapBlocks;
}
final NavigableSet<MapBlock> blocks = chrBlocks.get(chromosome);
final NavigableSet<MapBlock> subset = blocks.headSet(keyEnd, true).tailSet(blocks.headSet(keyStart, true).last(), true);
Iterator<MapBlock> it = subset.iterator();
log.trace("Going to lift over " + interval);
int intervalOffset = 0;
while (it.hasNext()) {
final MapBlock b = it.next();
int srcStart = Math.max(start, b.srcLoc.location);
int srcEnd = Math.min(end - 1, b.srcLoc.location + b.size - 1);
int lengthOfInterval = srcEnd - srcStart + 1;
final int lengthOfIntervalOnRead = b.blockType != MapBlock.BlockType.DEL ? lengthOfInterval : 0;
final int lengthOfIntervalOnRef = b.blockType != MapBlock.BlockType.INS ? lengthOfInterval : 0;
log.trace("intervalStart = " + srcStart + " intervalEnd = " + srcEnd + " lengthOfInterval = " + lengthOfInterval);
if (lengthOfInterval < minIntervalLength) {
log.trace("Skipping block " + b + " since the overlap is too small ( < " + MIN_LENGTH_INTERVAL + ")");
} else {
final GenomeInterval liftedInterval = new GenomeInterval();
liftedInterval.chromosome = b.dstLoc.chromosome;
liftedInterval.feature = b.blockType;
if (b.direction == 0) {
liftedInterval.start = b.dstLoc.location + srcStart - b.srcLoc.location;
liftedInterval.end = liftedInterval.start + lengthOfIntervalOnRef;
liftedInterval.strand = interval.strand;
} else {
liftedInterval.start = b.dstLoc.location + (b.srcLoc.location + b.size - 1 - srcEnd);
liftedInterval.end = liftedInterval.start + lengthOfIntervalOnRef;
liftedInterval.strand = interval.strand == Strand.POSITIVE ? Strand.NEGATIVE : Strand.POSITIVE;
}
readMapBlocks.add(new ReadMapBlock(intervalOffset, intervalOffset + lengthOfIntervalOnRead, liftedInterval));
}
intervalOffset += lengthOfIntervalOnRead;
}
return readMapBlocks;
}
示例13: isNegativeStrand
public boolean isNegativeStrand()
{
return getStrand()==Strand.NEGATIVE;
}