private MultipleAlignmentsContainer alignmentsContainer = null;
- private final Map<Integer, SingleReadAlignment> cdmMap = new TreeMap<Integer, SingleReadAlignment>(); //TODO Move this to ContigSequenceDataProvider
+ private final Map<String, SingleReadAlignment> cdmMap = new TreeMap<String, SingleReadAlignment>(); //TODO Move this to ContigSequenceDataProvider
private boolean dirty = false;
public AlignmentEditor()
}
- public boolean hasPherogram(int sequenceID) {
+ public boolean hasPherogram(String sequenceID) {
return getReadsArea().getDataAreas().getSequenceAreas(sequenceID).size() > PHEROGRAM_AREA_INDEX;
}
- public PherogramArea getPherogramArea(int sequenceID) {
+ public PherogramArea getPherogramArea(String sequenceID) {
if (hasPherogram(sequenceID)) {
return (PherogramArea)getReadsArea().getDataAreas().getSequenceAreas(sequenceID).get(PHEROGRAM_AREA_INDEX);
}
// Add test consensus sequence:
AlignmentModel consensusModel = getEditableConsensusArea().getAlignmentModel();
- int id = consensusModel.addSequence(CONSENSUS_NAME);
+ String id = consensusModel.addSequence(CONSENSUS_NAME);
Collection<Object> tokens = new ArrayList<Object>(); // First save tokens in a collection to avoid GUI updated for each token.
tokens.add(consensusModel.getTokenSet().tokenByRepresentation("A"));
tokens.add(consensusModel.getTokenSet().tokenByRepresentation("C"));
if (pherogramInfo.getPherogram() != null) {
uri = MediaUtils.getFirstMediaRepresentationPart(pherogramInfo.getPherogram()).getUri();
}
- int id = addRead(DerivateLabelProvider.getDerivateText(pherogramInfo, conversationHolder),
+ String id = addRead(DerivateLabelProvider.getDerivateText(pherogramInfo, conversationHolder),
uri,
singleReadAlignment.isReverseComplement(),
singleReadAlignment.getEditedSequence(),
// Set consensus sequence:
AlignmentModel consensusProvider = getEditableConsensusArea().getAlignmentModel();
- int id = consensusProvider.addSequence(CONSENSUS_NAME);
+ String id = consensusProvider.addSequence(CONSENSUS_NAME);
consensusProvider.insertTokensAt(id, 0, AlignmentModelUtils.charSequenceToTokenList(
sequenceNode.getConsensusSequence().getString(), consensusProvider.getTokenSet()));
//TODO Can the consensus sequence also be null? / Should it be created here, if nothing is in the DB?
// Write single reads:
stringProvider.setUnderlyingModel(getReadsArea().getAlignmentModel());
sequenceNode.getSingleReadAlignments().retainAll(cdmMap.values()); // Remove all reads that are not in the alignment anymore.
- Iterator<Integer> iterator = getReadsArea().getAlignmentModel().sequenceIDIterator();
+ Iterator<String> iterator = getReadsArea().getAlignmentModel().sequenceIDIterator();
while (iterator.hasNext()) {
- int id = iterator.next();
+ String id = iterator.next();
SingleReadAlignment singleRead = cdmMap.get(id);
if (singleRead == null) {
throw new InternalError("Creating new reads from AlignmentEditor not implemented.");
SelectionModel selection = getReadsArea().getSelection();
AlignmentModel<?> model = getReadsArea().getAlignmentModel();
for (int row = selection.getFirstRow(); row < selection.getFirstRow() + selection.getCursorHeight(); row++) {
- int sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
+ String sequenceID = getReadsArea().getSequenceOrder().idByIndex(row);
PherogramArea area = getPherogramArea(sequenceID);
PherogramAreaModel pherogramAlignmentModel = area.getModel();
AlignmentModelUtils.reverseComplement(model, sequenceID,
public <T> void createConsensusSequence() {
ConsensusSequenceArea area = getConsensusHintDataArea();
AlignmentModel<T> model = (AlignmentModel<T>)getEditableConsensusArea().getAlignmentModel();
- int sequenceID = model.sequenceIDIterator().next(); // There is always one sequence contained.
+ String sequenceID = model.sequenceIDIterator().next(); // There is always one sequence contained.
int length = getReadsArea().getAlignmentModel().getMaxSequenceLength();
Collection<T> tokens = new ArrayList<T>(length);
ConsensusSequenceArea area = getConsensusHintDataArea();
AlignmentModel<T> model = (AlignmentModel<T>)getEditableConsensusArea().getAlignmentModel();
TokenSet<T> tokenSet = model.getTokenSet();
- int sequenceID = model.sequenceIDIterator().next(); // There is always one sequence contained.
+ String sequenceID = model.sequenceIDIterator().next(); // There is always one sequence contained.
int currentConsensusLength = model.getSequenceLength(sequenceID);
int overallLength = getReadsArea().getAlignmentModel().getMaxSequenceLength();
private String newReadName() {
int index = 1;
- while (getReadsArea().getAlignmentModel().sequenceIDByName(DEFAULT_READ_NAME_PREFIX + index)
- != AlignmentModel.NO_SEQUENCE_FOUND) {
-
+ while (getReadsArea().getAlignmentModel().sequenceIDByName(DEFAULT_READ_NAME_PREFIX + index) != null) {
index++;
}
return DEFAULT_READ_NAME_PREFIX + index;
* @throws IOException if an error occurred when trying to read the pherogram file
* @throws UnsupportedChromatogramFormatException if the format of the pherogram file is not supported
*/
- public int addRead(String name, URI pherogramURI, boolean reverseComplemented, String editedSequence,
+ public String addRead(String name, URI pherogramURI, boolean reverseComplemented, String editedSequence,
Integer firstSeqPos, Integer leftCutPos, Integer rightCutPos, SingleReadAlignment.Shift[] shifts)
throws IOException, UnsupportedChromatogramFormatException {
// Create sequence:
provider.addSequence(name);
- int id = provider.sequenceIDByName(name);
+ String id = provider.sequenceIDByName(name);
// Set edited sequence:
Collection<Object> tokens = null; // First save tokens in a collection to avoid GUI updated for each token.