//more than one flowcell hit to this barcode
log.warn(r.getAlias() + ":: More than one partition container has this barcode. Cannot automatically link to a pre-existing barcode.");
}
}
else {
SequencerPartitionContainer<SequencerPoolPartition> f = new SequencerPartitionContainerImpl();
f.setSecurityProfile(r.getSecurityProfile());
if (f.getPlatformType() == null && r.getPlatformType() != null) {
f.setPlatformType(r.getPlatformType());
}
else {
f.setPlatformType(PlatformType.ILLUMINA);
}
if (run.has("laneCount")) {
f.setPartitionLimit(run.getInt("laneCount"));
}
else {
if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("MiSeq")) {
f.setPartitionLimit(1);
}
}
f.initEmptyPartitions();
f.setIdentificationBarcode(run.getString("containerId"));
((RunImpl)r).addSequencerPartitionContainer(f);
}
}
}
else {
SequencerPartitionContainer<SequencerPoolPartition> f = fs.iterator().next();
f.setSecurityProfile(r.getSecurityProfile());
if (f.getPlatformType() == null && r.getPlatformType() != null) {
f.setPlatformType(r.getPlatformType());
}
else {
f.setPlatformType(PlatformType.ILLUMINA);
}
if (f.getPartitions().isEmpty()) {
//log.info("No partitions found for run " + r.getName() + " (container "+f.getContainerId()+")");
if (run.has("laneCount")) {
f.setPartitionLimit(run.getInt("laneCount"));
}
else {
if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("MiSeq")) {
f.setPartitionLimit(1);
}
}
f.initEmptyPartitions();
}
else {
//log.info("Got "+f.getPartitions().size()+" partitions for run " + r.getName() + " (container "+f.getContainerId()+")");
if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("MiSeq")) {
if (f.getPartitions().size() != 1) {
log.warn(f.getName()+":: WARNING - number of partitions found ("+f.getPartitions().size()+") doesn't match usual number of MiSeq partitions (1)");
}
}
else if (r.getSequencerReference().getPlatform().getInstrumentModel().contains("2500")) {
if (f.getPartitions().size() != 2 && f.getPartitions().size() != 8) {
log.warn(f.getName()+":: WARNING - number of partitions found ("+f.getPartitions().size()+") doesn't match usual number of HiSeq 2500 partitions (2/8)");
}
}
else {
if (f.getPartitions().size() != 8) {
log.warn(f.getName()+":: WARNING - number of partitions found ("+f.getPartitions().size()+") doesn't match usual number of GA/HiSeq partitions (8)");
log.warn("Attempting fix...");
Map<Integer, Partition> parts = new HashMap<Integer, Partition>();
Partition notNullPart = f.getPartitions().get(0);
long notNullPartID = notNullPart.getId();
int notNullPartNum = notNullPart.getPartitionNumber();
for (int i = 1; i < 9; i++) {
parts.put(i, null);
}
for (Partition p : f.getPartitions()) {
parts.put(p.getPartitionNumber(), p);
}
for (Integer num : parts.keySet()) {
if (parts.get(num) == null) {
long newId = (notNullPartID-notNullPartNum)+num;
log.info("Inserting partition at "+num+" with ID "+ newId);
SequencerPoolPartition p = new PartitionImpl();
p.setSequencerPartitionContainer(f);
p.setId(newId);
p.setPartitionNumber(num);
p.setSecurityProfile(f.getSecurityProfile());
((SequencerPartitionContainerImpl)f).addPartition(p);
}
}
log.info(f.getName()+":: partitions now ("+f.getPartitions().size()+")");
}
}
}
if (f.getIdentificationBarcode() == null || "".equals(f.getIdentificationBarcode())) {
if (run.has("containerId") && !"".equals(run.getString("containerId"))) {
//log.info("Updating container barcode for container "+f.getContainerId()+" (" + r.getName() + ")");
f.setIdentificationBarcode(run.getString("containerId"));
//requestManager.saveSequencerPartitionContainer(f);
}
}
}