Skip to content
Snippets Groups Projects
Commit faf8bdac authored by tcarver's avatar tcarver
Browse files

add getEntryGroup()

parent 5b079b46
No related branches found
No related tags found
No related merge requests found
...@@ -24,23 +24,31 @@ import java.io.IOException; ...@@ -24,23 +24,31 @@ import java.io.IOException;
import java.net.URL; import java.net.URL;
import junit.framework.Assert; import junit.framework.Assert;
import uk.ac.sanger.artemis.EntryGroup;
import uk.ac.sanger.artemis.Feature;
import uk.ac.sanger.artemis.FeatureSegmentVector;
import uk.ac.sanger.artemis.FeatureVector;
import uk.ac.sanger.artemis.Options; import uk.ac.sanger.artemis.Options;
import uk.ac.sanger.artemis.Selection;
import uk.ac.sanger.artemis.SimpleEntryGroup;
import uk.ac.sanger.artemis.io.DocumentEntryFactory; import uk.ac.sanger.artemis.io.DocumentEntryFactory;
import uk.ac.sanger.artemis.io.Entry; import uk.ac.sanger.artemis.io.Entry;
import uk.ac.sanger.artemis.io.EntryInformationException; import uk.ac.sanger.artemis.io.EntryInformationException;
import uk.ac.sanger.artemis.sequence.AminoAcidSequence; import uk.ac.sanger.artemis.sequence.AminoAcidSequence;
import uk.ac.sanger.artemis.sequence.Bases; import uk.ac.sanger.artemis.sequence.Bases;
import uk.ac.sanger.artemis.sequence.NoSequenceException;
import uk.ac.sanger.artemis.util.Document; import uk.ac.sanger.artemis.util.Document;
import uk.ac.sanger.artemis.util.DocumentFactory; import uk.ac.sanger.artemis.util.DocumentFactory;
import uk.ac.sanger.artemis.util.OutOfRangeException;
import uk.ac.sanger.artemis.util.StringVector; import uk.ac.sanger.artemis.util.StringVector;
public class Utils public class Utils
{ {
protected static Entry getEntry(final String fileName) public static Entry getEntry(final String fileName)
{ {
try try
{ {
URL entryFile = ValidateFeatureTest.class.getResource(fileName); URL entryFile = Utils.class.getResource(fileName);
final Document doc = DocumentFactory.makeDocument(entryFile.getFile()); final Document doc = DocumentFactory.makeDocument(entryFile.getFile());
return DocumentEntryFactory.makeDocumentEntry( return DocumentEntryFactory.makeDocumentEntry(
Options.getArtemisEntryInformation(),doc,null); Options.getArtemisEntryInformation(),doc,null);
...@@ -56,6 +64,27 @@ public class Utils ...@@ -56,6 +64,27 @@ public class Utils
return null; return null;
} }
public static EntryGroup getEntryGroup(final String fileName)
{
try
{
final Entry new_embl_entry = getEntry(fileName);
final uk.ac.sanger.artemis.Entry entry = new uk.ac.sanger.artemis.Entry(new_embl_entry);
final EntryGroup egrp = new SimpleEntryGroup(entry.getBases());
egrp.add(entry);
return egrp;
}
catch(OutOfRangeException e)
{
Assert.fail(e.getMessage());
}
catch(NoSequenceException e)
{
Assert.fail(e.getMessage());
}
return null;
}
/** /**
* Method to change the translation table being used * Method to change the translation table being used
* @param n - genetic code table number * @param n - genetic code table number
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment