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]);
if (gr_no >= 0)
DesignUtils.addGroup(p, p_groups.get(gr_no));
ProbeMakerPropertyUtils.setRank(p,Byte.parseByte(substrings[7]));
//Read tags from substring 16;
int t = 0;
for (int i = 16; i < substrings.length; i+=2, t++) {
String l_str = substrings[i];
String t_str = substrings[i+1];
if (l_str.startsWith("Spacer")) { //$NON-NLS-1$
NucleotideSequence tag = new SimpleNucleotideSequence("Spacer " + t_str, t_str, p.getType()); //$NON-NLS-1$
p.addTagAt(tag,t);
}
else {
int lib_no = Integer.parseInt(l_str);
int tag_no = Integer.parseInt(t_str);
NucleotideSequence tag = libraries[lib_no].getSequenceAt(tag_no);
p.addTagAt(tag, t);
proj.getTagAllocationTable().use(tag,p,t);
}
}