use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class PartSequenceTest method testRandomSequence.
@Test
public void testRandomSequence() throws Exception {
Account account = AccountCreator.createTestAccount("PartSequenceTest.testRandomSequence", false);
// generate a random sequence of length 50k bps with 600 features
RandomSequence randomSequence = new RandomSequence(50000);
FeaturedDNASequence sequence = randomSequence.generate(600);
// create part for sequence
PartSequence partSequence = new PartSequence(account.getEmail(), EntryType.PLASMID);
partSequence.save(sequence);
// retrieve sequence with default of 20 annotations
FeaturedDNASequence retrieved = partSequence.get(false);
Assert.assertNotNull(retrieved);
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class PartSequenceTest method testGet.
@Test
public void testGet() throws Exception {
Account account = AccountCreator.createTestAccount("PartSequenceTest.testGet", false);
Strain strain = TestEntryCreator.createTestStrain(account);
PartSequence partSequence = new PartSequence(account.getEmail(), strain.getRecordId());
FeaturedDNASequence sequence = partSequence.get(true);
Assert.assertNull(sequence);
ByteArrayInputStream inputStream = new ByteArrayInputStream(genbank.getBytes());
SequenceInfo sequenceInfo = partSequence.parseSequenceFile(inputStream, "testFile.gb", false);
Assert.assertNotNull(sequenceInfo);
FeaturedDNASequence featuredDNASequence = (FeaturedDNASequence) sequenceInfo.getSequence();
Assert.assertNotNull(featuredDNASequence);
Assert.assertEquals(1, featuredDNASequence.getFeatures().size());
sequence = partSequence.get(true);
Assert.assertNotNull(sequence);
Assert.assertEquals(234, sequence.getSequence().length());
Assert.assertEquals(1, sequence.getFeatures().size());
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class FeaturesSectionTest method processFeatures3.
@Test
public void processFeatures3() {
FeaturedDNASequence sequence = new FeaturedDNASequence();
FeaturesSection tag = new FeaturesSection(sequence);
String[] lines = features3.split("\n");
for (String line : lines) tag.process(line);
Assert.assertNotNull(sequence);
Assert.assertEquals(4, sequence.getFeatures().size());
// exon
DNAFeature feature = sequence.getFeatures().get(0);
Assert.assertEquals(2, feature.getNotes().size());
// intron
feature = sequence.getFeatures().get(1);
Assert.assertEquals(2, feature.getNotes().size());
// mRNA
feature = sequence.getFeatures().get(2);
Assert.assertEquals(1, feature.getNotes().size());
// CDS
feature = sequence.getFeatures().get(3);
Assert.assertEquals(5, feature.getNotes().size());
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class SequenceDAOTest method testSequenceString.
@Test
public void testSequenceString() throws Exception {
Account account = AccountCreator.createTestAccount("SequenceDAOTest.testSequenceString", false);
Plasmid plasmid = TestEntryCreator.createTestPlasmid(account);
Assert.assertNotNull(plasmid);
// parse sequence and associate with plasmid
FeaturedDNASequence dnaSequence = GeneralParser.parse(sequenceString);
Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
Assert.assertNotNull(sequence);
sequence.setEntry(plasmid);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
// get
Optional<String> result = sequenceDAO.getSequenceString(plasmid);
Assert.assertTrue(result.isPresent());
Assert.assertEquals(result.get(), dnaSequence.getSequence());
}
use of org.jbei.ice.lib.dto.FeaturedDNASequence in project ice by JBEI.
the class SequenceDAOTest method testCreate.
@Test
public void testCreate() throws Exception {
Account account = AccountCreator.createTestAccount("SequenceDAOTest.testCreate", false);
Strain strain = TestEntryCreator.createTestStrain(account);
Assert.assertNotNull(strain);
// parse sequence and associate with strain
FeaturedDNASequence dnaSequence = GeneralParser.parse(sequenceString);
Sequence sequence = SequenceUtil.dnaSequenceToSequence(dnaSequence);
Assert.assertNotNull(sequence);
sequence.setEntry(strain);
sequence = sequenceDAO.create(sequence);
Assert.assertNotNull(sequence);
// get
Sequence result = sequenceDAO.getByEntry(strain);
Assert.assertNotNull(result);
Assert.assertEquals(result, sequence);
}
Aggregations