Search in sources :

Example 31 with NucleotideSequence

use of com.milaboratory.core.sequence.NucleotideSequence in project repseqio by repseqio.

the class SequenceResolverTest method test1.

@Test
public void test1() throws Exception {
    Path dir = TempFileManager.getTempDir().toPath().toAbsolutePath();
    Path work = dir.resolve("work");
    Files.createDirectories(work);
    Path cache = dir.resolve("cache");
    Files.createDirectories(cache);
    SequenceResolvers.initDefaultResolver(cache);
    SequenceResolver defaultResolver = SequenceResolvers.getDefault();
    NucleotideSequence seq = defaultResolver.resolve(new SequenceAddress("nuccore://EU877942.1")).getRegion(new Range(10, 30).inverse());
    Assert.assertEquals(new NucleotideSequence("gcgagagcaagcactatggc").getReverseComplement(), seq);
    Path someFasta = work.resolve("some_fasta.fasta");
    FileUtils.copyToFile(SingleFastqReaderTest.class.getClassLoader().getResourceAsStream("sequences/some_fasta.fasta"), someFasta.toFile());
    // Path rootPath = new File(SingleFastqReaderTest.class.getClassLoader().getResource("sequences/some_fasta.fasta")
    // .toURI()).toPath().toAbsolutePath().normalize().getParent();
    seq = defaultResolver.resolve(new SequenceAddress(work, "file://some_fasta.fasta#24.6jsd21.Tut")).getRegion(new Range(10, 30));
    Assert.assertEquals(new NucleotideSequence("ATCCTGGCTTAGAACTAACG"), seq);
}
Also used : Path(java.nio.file.Path) NucleotideSequence(com.milaboratory.core.sequence.NucleotideSequence) Range(com.milaboratory.core.Range) SingleFastqReaderTest(com.milaboratory.core.io.sequence.fastq.SingleFastqReaderTest) Test(org.junit.Test)

Example 32 with NucleotideSequence

use of com.milaboratory.core.sequence.NucleotideSequence in project repseqio by repseqio.

the class SequenceBaseTest method test1.

@Test
public void test1() throws Exception {
    SequenceBase base = new SequenceBase();
    base.put("A1", 10, new NucleotideSequence("ATTAGACACACAC"));
    base.put("A1", 30, new NucleotideSequence("ATTACACA"));
    base.put("A2", 0, new NucleotideSequence("TATAGACATAAGCA"));
    assertNull(base.get("A1", new Range(21, 24)));
    assertNull(base.get("A1", new Range(29, 32)));
    assertNull(base.get("A3", new Range(29, 32)));
    assertEquals(new NucleotideSequence("TAGA"), base.get("A1", new Range(12, 16)));
    assertEquals(new NucleotideSequence("TCTA"), base.get("A1", new Range(16, 12)));
    assertEquals(new NucleotideSequence("GACA"), base.get("A2", new Range(4, 8)));
}
Also used : NucleotideSequence(com.milaboratory.core.sequence.NucleotideSequence) Range(com.milaboratory.core.Range) Test(org.junit.Test)

Example 33 with NucleotideSequence

use of com.milaboratory.core.sequence.NucleotideSequence in project repseqio by repseqio.

the class SequenceBaseTest method test3m.

@Test
public void test3m() throws Exception {
    SequenceBase base = new SequenceBase();
    base.put("A1", 100, new NucleotideSequence("ATTAGACACACAC"));
    base.put("A1", 20, new NucleotideSequence("CACATA"));
    base.put("A1", 10, new NucleotideSequence("ATTAGACACACAC"));
    assertEquals(new NucleotideSequence("ACACA"), base.get("A1", new Range(19, 24)));
    assertEquals(new NucleotideSequence("TTAG"), base.get("A1", new Range(101, 105)));
}
Also used : NucleotideSequence(com.milaboratory.core.sequence.NucleotideSequence) Range(com.milaboratory.core.Range) Test(org.junit.Test)

Example 34 with NucleotideSequence

use of com.milaboratory.core.sequence.NucleotideSequence in project repseqio by repseqio.

the class SequenceBaseTest method test5.

@Test
public void test5() throws Exception {
    SequenceBase base = new SequenceBase();
    base.put("A1", 10, new NucleotideSequence("ATTAGACACACAC"));
    base.put("A1", 18, new NucleotideSequence("CAC"));
    assertEquals(new NucleotideSequence("ATTAGACACAC"), base.get("A1", new Range(10, 21)));
}
Also used : NucleotideSequence(com.milaboratory.core.sequence.NucleotideSequence) Range(com.milaboratory.core.Range) Test(org.junit.Test)

Example 35 with NucleotideSequence

use of com.milaboratory.core.sequence.NucleotideSequence in project repseqio by repseqio.

the class SequenceBaseTest method test3.

@Test
public void test3() throws Exception {
    SequenceBase base = new SequenceBase();
    base.put("A1", 20, new NucleotideSequence("CACATA"));
    base.put("A1", 10, new NucleotideSequence("ATTAGACACACAC"));
    assertEquals(new NucleotideSequence("ACACA"), base.get("A1", new Range(19, 24)));
}
Also used : NucleotideSequence(com.milaboratory.core.sequence.NucleotideSequence) Range(com.milaboratory.core.Range) Test(org.junit.Test)

Aggregations

NucleotideSequence (com.milaboratory.core.sequence.NucleotideSequence)81 Test (org.junit.Test)32 Range (com.milaboratory.core.Range)19 VDJCGene (io.repseq.core.VDJCGene)15 GeneType (io.repseq.core.GeneType)14 NSequenceWithQuality (com.milaboratory.core.sequence.NSequenceWithQuality)13 GeneFeature (io.repseq.core.GeneFeature)9 VDJCAlignments (com.milaboratory.mixcr.basictypes.VDJCAlignments)8 VDJCHit (com.milaboratory.mixcr.basictypes.VDJCHit)8 ReferencePoint (io.repseq.core.ReferencePoint)7 VDJCLibrary (io.repseq.core.VDJCLibrary)7 ArrayList (java.util.ArrayList)7 VDJCAlignerParameters (com.milaboratory.mixcr.vdjaligners.VDJCAlignerParameters)6 AlignmentHit (com.milaboratory.core.alignment.batch.AlignmentHit)5 PairedRead (com.milaboratory.core.io.sequence.PairedRead)5 AminoAcidSequence (com.milaboratory.core.sequence.AminoAcidSequence)5 Path (java.nio.file.Path)5 Alignment (com.milaboratory.core.alignment.Alignment)4 Pattern (java.util.regex.Pattern)4 AlignmentHelper (com.milaboratory.core.alignment.AlignmentHelper)3