//Print the tags of each library - id;sequence;type
for (int i = 0; i < libraries.length; i++) {
TagLibrary l = libraries[i];
p.println(TITLE_DESCRIPTOR + LIBRARY);
for (Iterator<NucleotideSequence> ti = l.iterator(); ti.hasNext(); ) {
NucleotideSequence t = ti.next();
p.println(tio.getOutString(new String[] {t.getID(),t.seqString(),String.valueOf(t.getType())}));
}
p.println(TITLE_DESCRIPTOR + LISTEND);
}
increaseProgress();
setStatus("Writing probes",0); //$NON-NLS-1$
//Make a list of probe groups
List<ProbeGroup> p_groups = new ArrayList<ProbeGroup>();
for (Iterator<Probe> i = proj.getProbes().iterator(); i.hasNext(); ) {
Probe pr = i.next();
ProbeGroup pg = (ProbeGroup) DesignUtils.getGroupWithType(pr,ProbeGroup.GROUP_TYPE);
if (pg != null) {
if (!p_groups.contains(pg)) {
p_groups.add(pg);
}
}
}
//Print the probe groups - targetGroup;groupTagLibrary;groupTagNumber;
p.println(TITLE_DESCRIPTOR + PROBE_GROUPS);
for (Iterator<ProbeGroup> i = p_groups.iterator(); i.hasNext(); ) {
ProbeGroup pg = i.next();
TargetGroup tg = pg.getTargetGroup();
int tg_no = tg == null ? -1 : groups.indexOf(tg);
int lib_no = -1;
int tag_no = -1;
String tagID = proj.getTagAllocationTable().getGroupTagID(pg);
if (tagID != null) {
for (int l = 0; l < libraries.length; l++) {
try {
NucleotideSequence s = libraries[l].getSequenceByID(tagID);
lib_no = l;
tag_no = libraries[l].indexOfSequence(s);
}
catch (IDNotFoundException inx) {
//do nothing
}
}
}
p.println(tio.getOutString(new String[] { String.valueOf(tg_no),String.valueOf(lib_no),String.valueOf(tag_no) }));
}
p.println(TITLE_DESCRIPTOR + LISTEND);
//Print the probes - description;ID;type;upStream;downStream;target;group number;quality;messageCountArms;messageCountProbe;;5'seq;Tm;3'seq;Tm;tag 1 lib;tag 1 pos;...;...;tag n lib;tag n pos;
p.println(TITLE_DESCRIPTOR + PROBES);
DefiniteSequenceDB<Probe> probes = proj.getProbes();
for (Iterator<Probe> i = probes.iterator(); i.hasNext(); ) {
Probe pr = i.next();
PropertyAcceptorNucleotideSequence fivePrime;
PropertyAcceptorNucleotideSequence threePrime;
try {
fivePrime = (PropertyAcceptorNucleotideSequence) pr.getTSSPair().getSequence(TSSPair.KEY_FIVE_PRIME);
}
catch (ClusterException e) {
fivePrime = null;
}
try {
threePrime = (PropertyAcceptorNucleotideSequence) pr.getTSSPair().getSequence(TSSPair.KEY_THREE_PRIME);
}
catch (ClusterException e) {
threePrime = null;
}
int targetNo = -1;
try {
targetNo = pr.getTarget() == null ? -1 : proj.getTargets().indexOfSequence(proj.getTargets().getSequenceByID(pr.getTarget().getID()));
}
catch (IDNotFoundException ix) {
//let targetNo be -1
}
Group<?> pg = DesignUtils.getGroupWithType(pr,ProbeGroup.GROUP_TYPE);
String outStr = tio.getOutString(new String[] {
pr.getName().replace(VALUE_SEPARATOR, VALUE_SEPARATOR_REPLACEMENT),
pr.getID() != null ? pr.getID().replace(VALUE_SEPARATOR, VALUE_SEPARATOR_REPLACEMENT) : "No ID", //$NON-NLS-1$
String.valueOf(pr.getType()),
String.valueOf(pr.getUpstreamBlockCount()),
String.valueOf(pr.getDownstreamBlockCount()),
String.valueOf(targetNo),
String.valueOf(pg == null ? -1 : p_groups.indexOf(pg)),
String.valueOf(ProbeMakerPropertyUtils.getRank(pr)),
String.valueOf(fivePrime == null ? 0 : ProbeMakerPropertyUtils.getAllMessages(fivePrime).size()),
String.valueOf(threePrime == null ? 0 : ProbeMakerPropertyUtils.getAllMessages(threePrime).size()),
String.valueOf(ProbeMakerPropertyUtils.getOwnMessages(pr.getTSSPair()).size()),
String.valueOf(ProbeMakerPropertyUtils.getOwnMessages(pr).size()),
fivePrime == null ? "" : fivePrime.seqString(), //$NON-NLS-1$
String.valueOf(fivePrime == null ? 0 : ProbeMakerPropertyUtils.getHybridizationTemp(fivePrime)),
threePrime == null ? "" : threePrime.seqString(), //$NON-NLS-1$
String.valueOf(threePrime == null ? 0 : ProbeMakerPropertyUtils.getHybridizationTemp(threePrime))
});
for (int t = 0; t < pr.getTags().size(); t++) {
outStr += VALUE_SEPARATOR;
NucleotideSequence tag = pr.getTagAt(t);
//This isn't perfect but will work (if noone calls their tags 'Spacer')
if (tag.getID().startsWith("Spacer")) { //$NON-NLS-1$
outStr += "Spacer"; //$NON-NLS-1$
outStr += VALUE_SEPARATOR;
outStr += tag.seqString();
}
else {
int lib_no = -1;
int tag_no = -1;
for (int l = 0; l < libraries.length; l++) {
try {
NucleotideSequence s = libraries[l].getSequenceByID(tag.getID());
if (s!=null) {
lib_no = l;
tag_no = libraries[l].indexOfSequence(s);
}
}
catch (IDNotFoundException inx) {
//do nothing
}
}
outStr += String.valueOf(lib_no);
outStr += VALUE_SEPARATOR;
outStr += String.valueOf(tag_no);
}
}
p.println(outStr);
if (fivePrime != null) {
for (Iterator<Message> mi = ProbeMakerPropertyUtils.getAllMessages(fivePrime).iterator();mi.hasNext();) {
Message m = mi.next();
MessageType mt = m.getType();
p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
}
}
if (threePrime != null) {
for (Iterator<Message> mi = ProbeMakerPropertyUtils.getAllMessages(threePrime).iterator();mi.hasNext();) {
Message m = mi.next();
MessageType mt = m.getType();
p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
}
}
for (Iterator<Message> mi = ProbeMakerPropertyUtils.getOwnMessages(pr.getTSSPair()).iterator();mi.hasNext();) {
Message m = mi.next();
MessageType mt = m.getType();
p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
}
for (Iterator<Message> mi = ProbeMakerPropertyUtils.getOwnMessages(pr).iterator();mi.hasNext();) {
Message m = mi.next();
MessageType mt = m.getType();
p.println(tio.getOutString(new String[] {mt.getType(),mt.getDescription(),m.getMessage(),String.valueOf(m.getSeverity())}));
}
}
p.println(TITLE_DESCRIPTOR + LISTEND);
increaseProgress();
setStatus("Writing settings",0); //$NON-NLS-1$
//Print the settings of the project
Settings s = proj.getSettings();
List<CandidateAnalysisModule> modules1 = s.getArmModules();
List<CandidateAnalysisModule> modules2 = s.getCandidateModulesStage1();
List<CandidateAnalysisModule> modules3 = s.getCandidateModulesStage2();
Properties props = new Properties();
props.putAll(s.getDesignParameters());
p.println(TITLE_DESCRIPTOR + MODULES1);
for (Iterator<CandidateAnalysisModule> i = modules1.iterator();i.hasNext();)
p.println(getModuleString(i.next(),tio));
p.println(TITLE_DESCRIPTOR + LISTEND);