use of com.milaboratory.core.sequence.NSequenceWithQuality in project mixcr by milaboratory.
the class CloneAccumulator method rebuildClonalSequence.
public void rebuildClonalSequence() {
SequenceQuality newQuality = aggregator.getQuality();
final NSequenceWithQuality[] updated = new NSequenceWithQuality[sequence.size()];
int pointer = 0;
for (int i = 0; i < updated.length; i++) {
final NucleotideSequence s = this.sequence.get(i).getSequence();
updated[i] = new NSequenceWithQuality(s, newQuality.getRange(pointer, pointer + s.size()));
pointer += s.size();
}
sequence = new ClonalSequence(updated);
return;
}
use of com.milaboratory.core.sequence.NSequenceWithQuality in project mixcr by milaboratory.
the class BackwardCompatibilityTests method assertGoodVDJCA.
public static void assertGoodVDJCA(String resource, int size) throws IOException {
try (VDJCAlignmentsReader reader = new VDJCAlignmentsReader(BackwardCompatibilityTests.class.getResource(resource).getFile())) {
int countGood = 0;
for (VDJCAlignments vdjcAlignments : CUtils.it(reader)) {
NSequenceWithQuality cdr3NQ = vdjcAlignments.getFeature(GeneFeature.CDR3);
if (cdr3NQ == null)
continue;
AminoAcidSequence aaCDR3 = AminoAcidSequence.translateFromCenter(cdr3NQ.getSequence());
if (aaCDR3.codeAt(0) == AminoAcidAlphabet.C && aaCDR3.codeAt(aaCDR3.size() - 1) == AminoAcidAlphabet.F)
++countGood;
}
Assert.assertEquals(size, countGood);
}
}
use of com.milaboratory.core.sequence.NSequenceWithQuality in project mixcr by milaboratory.
the class VDJCAlignerPVFirstTest method test2.
@Test
@Ignore
public void test2() throws Exception {
PairedRead read1 = new PairedRead(new SingleReadImpl(0, new NSequenceWithQuality(new NucleotideSequence("GCTGTGTATTACTGTGCAAGAGGGCCCCAAGAAAATAGTGGTTATTACTACGGGTTTGACTACTGGGGCCAGGGA"), SequenceQuality.GOOD_QUALITY_VALUE), "206"), new SingleReadImpl(0, new NSequenceWithQuality(new NucleotideSequence("GGCGCCAGGGGGAAGACCGATGGGCCCTTGGTGGAGGCTGAGGAGACGGTGACCAGGGTTCCCTGGCCCCAGTAG"), SequenceQuality.GOOD_QUALITY_VALUE), "206"));
PairedRead read2 = new PairedRead(new SingleReadImpl(1, new NSequenceWithQuality(new NucleotideSequence("GCTGTGTATTACTGTGCAAGAGGGCCCCAAGAAAATAGTGGTTATTACTACGGGTTTGACTACTGGGGCCAGGGA"), SequenceQuality.GOOD_QUALITY_VALUE), "11621"), new SingleReadImpl(1, new NSequenceWithQuality(new NucleotideSequence("GGCGCCAGGGGGAAGACCGATGGGCCCTTGGTGGAGGCTGAGGAGACGGTGACCAGGGTTCCCTGGCCCCAGTAG"), SequenceQuality.GOOD_QUALITY_VALUE), "11621"));
RunMiXCR.RunMiXCRAnalysis params = new RunMiXCR.RunMiXCRAnalysis(read1);
RunMiXCR.AlignResult align = RunMiXCR.align(params);
for (VDJCAlignments al : align.alignments) {
for (int i = 0; i < al.numberOfTargets(); i++) {
System.out.println(VDJCAlignmentsFormatter.getTargetAsMultiAlignment(al, i));
System.out.println();
}
System.out.println();
System.out.println(" ================================================ ");
System.out.println();
}
}
use of com.milaboratory.core.sequence.NSequenceWithQuality in project mixcr by milaboratory.
the class VDJCAlignerSTest method test2.
@Test
@Ignore
public void test2() throws Exception {
// @
// GCTGTGTATTACTGTGCAAGAGGGCCCCAAGAAAATAGTGGTTATTACTACGGGTTTGACTACTGGGGCCAGGGAACCCTGGTCACCGTCTCCTCAGCCTCCACCAAGGGCCCATCGGTCTTCCCCCTGGCGCC
// +
// CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
VDJCAlignerParameters parameters = VDJCParametersPresets.getByName("default");
VDJCAlignerS aligner = new VDJCAlignerS(parameters);
for (VDJCGene gene : VDJCLibraryRegistry.getDefault().getLibrary("default", "hs").getGenes(Chains.IGH)) if (parameters.containsRequiredFeature(gene))
aligner.addGene(gene);
SingleReadImpl read = new SingleReadImpl(0, new NSequenceWithQuality(new NucleotideSequence("GCTGTGTATTACTGTGCAAGAGGGCCCCAAGAAAATAGTGGTTATTACTACGGGTTTGACTACTGGGGCCAGGGAACCCTGGTCACCGTCTCCTCAGCCTCCACCAAGGGCCCATCGGTCTTCCCCCTGGCGCC"), SequenceQuality.GOOD_QUALITY_VALUE), "");
RandomUtil.getThreadLocalRandom().setSeed(29);
VDJCAlignmentResult<SingleRead> result = aligner.process0(read);
}
use of com.milaboratory.core.sequence.NSequenceWithQuality in project mixcr by milaboratory.
the class PartialAlignmentsAssembler method addLeftToIndex.
private boolean addLeftToIndex(VDJCAlignments alignment) {
int leftTargetId = getLeftPartitionedSequence(alignment);
if (leftTargetId == -1)
return false;
VDJCPartitionedSequence left = alignment.getPartitionedTarget(leftTargetId);
NSequenceWithQuality seq = left.getSequence();
int kFromFirst = left.getPartitioning().getPosition(ReferencePoint.VEndTrimmed) + kOffset;
if (kFromFirst < 0 || kFromFirst + kValue >= seq.size()) {
noKMer.incrementAndGet();
return false;
}
for (int kFrom = kFromFirst; kFrom < seq.size() - kValue; ++kFrom) {
long kmer = kMer(seq.getSequence(), kFrom, kValue);
if (kmer == -1) {
wildcardsInKMer.incrementAndGet();
continue;
}
List<KMerInfo> ids = kToIndexLeft.get(kmer);
if (ids == null) {
kToIndexLeft.put(kmer, ids = new ArrayList<>(1));
kMerDiversity.incrementAndGet();
}
ids.add(new KMerInfo(alignment, kFrom, leftTargetId));
}
leftParts.incrementAndGet();
return true;
}
Aggregations