}
transformedProps.put(shortKey, parsed);
}
}
Settings s = new Settings();
s.addDesignerProperties(transformedProps);
System.out.println("Done"); //$NON-NLS-1$
System.out.println("Creating project"); //$NON-NLS-1$
Project p = new Project("Unnamed",s); //$NON-NLS-1$
pm.setProject(p);
String accClassName = props.getProperty("probemaker.acceptor");
String selClassName = props.getProperty("probemaker.selector");
String formatClassName = props.getProperty("probemaker.targetInputFormat");
String outputClassName = props.getProperty("probemaker.probeOutputFormat");
String targetClassName = props.getProperty("probemaker.targetType");
if (accClassName == null) {
System.out.println("No acceptor specified"); //$NON-NLS-1$
return;
}
if (selClassName == null) {
System.out.println("No selector specified"); //$NON-NLS-1$
return;
}
if (formatClassName == null) {
System.out.println("No input format specified"); //$NON-NLS-1$
return;
}
ProbeAcceptor acceptor = (ProbeAcceptor) Class.forName(accClassName).newInstance();
//Check if acceptor requires parameters
if (acceptor instanceof ParameterPlugIn) {
ParameterPlugIn paAcceptor = (ParameterPlugIn) acceptor;
DataDescriptor[] dds = paAcceptor.getDataDescriptors();
if (dds != null) {
for (int d = 0;d<dds.length;d++) {
DataDescriptor dd = dds[d];
String string = props.getProperty("probemaker.acceptor." + dd.getKey());
paAcceptor.setData(dd.getKey(), string);
}
}
}
System.out.println(" Acceptor is: " + acceptor.getClass().getName()); //$NON-NLS-1$
ProbeSelector selector = (ProbeSelector) Class.forName(selClassName).newInstance();
if (selector instanceof ParameterPlugIn) {
ParameterPlugIn paSelector = (ParameterPlugIn) selector;
DataDescriptor[] dds = paSelector.getDataDescriptors();
if (dds != null) {
for (int d = 0;d<dds.length;d++) {
DataDescriptor dd = dds[d];
String string = props.getProperty("probemaker.selector." + dd.getKey());
paSelector.setData(dd.getKey(), string);
}
}
}
System.out.println(" Selector is: " + selector.getClass().getName()); //$NON-NLS-1$
SequenceDBDataReader format = (SequenceDBDataReader) Class.forName(formatClassName).newInstance();
if (format instanceof ParameterPlugIn) {
ParameterPlugIn paFormat = (ParameterPlugIn) selector;
DataDescriptor[] dds = paFormat.getDataDescriptors();
if (dds != null) {
for (int d = 0;d<dds.length;d++) {
DataDescriptor dd = dds[d];
String string = props.getProperty("probemaker.targetInputFormat." + dd.getKey());
paFormat.setData(dd.getKey(), string);
}
}
}
if (outputClassName == null) {
outputClassName = DefaultTextTableFormatter.class.getName();
}
Class<?> outputClass = Class.forName(outputClassName);
TextTableFormatter<Probe> outputformatter = (TextTableFormatter<Probe>) outputClass.newInstance();
if (targetClassName == null) {
System.err.println("ERROR: Must specify a probemaker.targetType"); //$NON-NLS-1$
return;
}
Class<?> targetClass = Class.forName(targetClassName);
SequenceBuilder<? extends ProbeMakerTarget> seqBuilder = (SequenceBuilder<? extends ProbeMakerTarget>) targetClass.getMethod("getSequenceBuilder",(Class[])null).invoke(null,(Object[]) null); //$NON-NLS-1$
System.out.println(" Format is: " + format.getClass().getName()); //$NON-NLS-1$
System.out.println(" Target type is: " + targetClass.getName()); //$NON-NLS-1$
System.out.println(" Output format is: " + outputClass.getName()); //$NON-NLS-1$
TargetInputFormat<? extends ProbeMakerTarget> tif = new DefaultTargetInputFormat("Input format",format,null,seqBuilder,ListSequenceDB.getDefaultBuilder()); //$NON-NLS-1$
System.out.println(" Loading tag libs"); //$NON-NLS-1$
int ti = 0;
List<TagLibrary> libs = new ArrayList<TagLibrary>();
while (props.containsKey("probemaker.taglibrary."+ti)) {
String taglibString = props.getProperty("probemaker.taglibrary."+ti);
String[] split = taglibString.split(":");
byte mode = Byte.parseByte(split[0]);
String libFileName = split[1];
File libFile = new File(libFileName);
if (!libFile.getAbsolutePath().equals(libFile.getPath())) {
libFile = new File(settingsFile.getAbsoluteFile().getParentFile(),libFile.getPath());
}
DefiniteSequenceDB<NucleotideSequence> tagseqs = SequenceIO.readSequenceDB(new FileReader(libFile), new FastaDBFormat<NucleotideSequence>(), null, ListSequenceDB.getDefaultBuilder(),new SimpleDNASequenceBuilder());
TagLibrary lib = new DefaultTagLibrary(tagseqs,"taglib"+ti); //$NON-NLS-1$
lib.setMode(mode);
libs.add(lib);
ti++;
}
TagLibrary[] libraries = libs.toArray(new TagLibrary[libs.size()]);
int[] order = new int[libraries.length];
for (int i = 0;i<order.length;i++) order[i] = i;
TagSettings tagSettings = new DefaultTagSettings(libraries,order);
p.setTagSettings(tagSettings);
System.out.println(" Loading targets"); //$NON-NLS-1$
new TargetIOTask(p,callback,new Reader[] { new FileReader(targetFile) },tif).run();
System.out.println("Done"); //$NON-NLS-1$
File logPath = new File(""); //$NON-NLS-1$
System.out.println("Writing log to: " + logPath); //$NON-NLS-1$
//Probe design settings
boolean append = false;
//Create and start the ProbeDesignerRunner
TagAllocator ta = (TagAllocator) ProbeMakerPlugIn.defaultTagAllocatorClass.newInstance();
TSSConstructor tsc = (TSSConstructor) ProbeMakerPlugIn.defaultTSSConstructorClass.newInstance();
ta.addParameters(s.getDesignParameters());
tsc.addParameters(s.getDesignParameters());
ProbeDesigner pd = new DefaultProbeDesigner(ta);
ProbeDesignTask runner = pm.getProbeDesignTask(append,false,true,acceptor,selector,pd, tsc, callback);
runner.timing = true;