byte type = Byte.parseByte(substrings[2]);
if (targetBuilder == null) throw new UnsupportedOperationException("Can't read target data if target builder not set"); //$NON-NLS-1$
//Create and set acid type of target
ProbeMakerTarget t = targetBuilder.buildObject(m);
if (t instanceof ChangeableNucleotideSequence)
((ChangeableNucleotideSequence) t).setType(type);
//Get the variant number, or -1 if none
int varno;
if (substrings[3].length() == 0)
varno = -1;
else
varno = Integer.parseInt(substrings[3]);
//Set variant
if (varno > -1) {
VariantTarget vt = (VariantTarget) t;
vt.setVariant(vt.getVariants()[varno]);
}
//Set the target group
int grpno = Integer.parseInt(substrings[4]);
if (grpno > -1) {
groups.get(Integer.parseInt(substrings[4])).addMember(t);
}
proj.getTargets().addSequence(t);
}
increaseProgress();
setStatus("Reading tags",0); //$NON-NLS-1$
//Find the libraries line and create the tag libraries
searchTitle(r, LIBRARIES);
List<TagLibrary> libs = new ArrayList<TagLibrary>();
String libString;
while (!(libString = r.readLine()).startsWith(String.valueOf(TITLE_DESCRIPTOR))) {
String[] substrings = tio.getInStrings(libString);
if (substrings.length != 4)
throw new UnsupportedOperationException("Error parsing tag library line: " + libString); //$NON-NLS-1$
TagLibrary l = new DefaultTagLibrary(new ListSequenceDB<NucleotideSequence>(), substrings[0]);
l.setMode(Byte.parseByte(substrings[1]));
libs.add(l);
}
TagLibrary[] libraries = new TagLibrary[libs.size()];
for (int l = 0; l < libraries.length; l++) {
libraries[l] = libs.get(l);
}
//Find the library line and read all tags for each library
for (int l = 0; l < libraries.length; l++) {
searchTitle(r, LIBRARY);
String tagString;
while (! (tagString = r.readLine()).startsWith(String.valueOf(
TITLE_DESCRIPTOR))) {
String[] substrings = tio.getInStrings(tagString);
if (substrings.length != 3)
throw new UnsupportedOperationException("Error parsing tag line: " + tagString); //$NON-NLS-1$
NucleotideSequence t = new SimpleNucleotideSequence(
substrings[0],
substrings[1],
Byte.parseByte(substrings[2]));
libraries[l].addSequence(t);
}
}
//Set the project tag libraries
int[] order = new int[libraries.length];
for (int i = 0;i<order.length;i++) order[i] = i;
proj.setTagSettings(new DefaultTagSettings(libraries,order));
increaseProgress();
setStatus("Reading probes",0); //$NON-NLS-1$
//Read and create all probe groups
searchTitle(r, PROBE_GROUPS);
List<ProbeGroup> p_groups = new ArrayList<ProbeGroup>();
String groupString;
int tgIndex = 0;
while (! (groupString = r.readLine()).startsWith(String.valueOf(
TITLE_DESCRIPTOR))) {
String[] substrings = tio.getInStrings(groupString);
if (substrings.length != 3)
throw new UnsupportedOperationException("Error parsing probe group line: " + groupString); //$NON-NLS-1$
tgIndex++;
int pgindex = Integer.parseInt(substrings[0]);
int libindex = Integer.parseInt(substrings[1]);
int tagindex = Integer.parseInt(substrings[2]);
if (pgindex >= 0) {
ProbeGroup pg = new ProbeGroup(groups.get(pgindex),String.valueOf(pgindex+1));
if (libindex >= 0)
proj.getTagAllocationTable().setGroupTagID(pg, libraries[libindex].getSequenceAt(tagindex));
p_groups.add(pg);
}
else {
ProbeGroup pg = new ProbeGroup(null,"DUMMY"); //$NON-NLS-1$
p_groups.add(pg);
}
}
//Read and create all probes
//description;ID;type;upStream;downStream;target;group number;quality;struct;messCount1;messCount2;messCount3;messCount4;5'seq;3'seq;tag 1 lib;tag 1 pos;...;...;tag n lib;tag n pos;
searchTitle(r, PROBES);
String probeString;
while (! (probeString = r.readLine()).startsWith(String.valueOf(
TITLE_DESCRIPTOR))) {
String[] substrings = tio.getInStrings(probeString);
byte type = Byte.parseByte(substrings[2]);
int target_no = Integer.parseInt(substrings[5]);
ProbeMakerTarget pt = null;
if (target_no >= 0) {
pt = proj.getTargets().getSequenceAt(target_no);
}
int gr_no = Integer.parseInt(substrings[6]);
int messageCount5 = Integer.parseInt(substrings[8]);
int messageCount3 = Integer.parseInt(substrings[9]);
int messageCountTSS = Integer.parseInt(substrings[10]);
int messageCountProbe = Integer.parseInt(substrings[11]);
PropertyAcceptorNucleotideSequence tss5 = ProbeMakerSequenceFactory.createTSS(new SimpleNucleotideSequence(
"5' TSS", substrings[12], type),pt == null ? "" : pt.getID()); //$NON-NLS-1$ //$NON-NLS-2$
ProbeMakerPropertyUtils.setHybridizationTemp(tss5,Float.parseFloat(substrings[13]));
PropertyAcceptorNucleotideSequence tss3 = ProbeMakerSequenceFactory.createTSS(new SimpleNucleotideSequence(
"3' TSS", substrings[14], type),pt == null ? "" : pt.getID()); //$NON-NLS-1$ //$NON-NLS-2$
ProbeMakerPropertyUtils.setHybridizationTemp(tss3,Float.parseFloat(substrings[15]));
Probe p = new DefaultProbe(ProbeMakerSequenceFactory.createTSSPair(tss5, tss3, pt),Integer.parseInt(substrings[3]),Integer.parseInt(substrings[4]),type);
p.setName(substrings[0]);
p.setID(substrings[1]);