Revision cda3a81a
Added by Ben Stöver almost 8 years ago
eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/io/CDMSequenceMatrixAdapter.java | ||
---|---|---|
13 | 13 |
import info.bioinfweb.commons.bio.CharacterStateSetType; |
14 | 14 |
import info.bioinfweb.commons.text.StringUtils; |
15 | 15 |
import info.bioinfweb.jphyloio.ReadWriteConstants; |
16 |
import info.bioinfweb.jphyloio.ReadWriteParameterMap; |
|
16 | 17 |
import info.bioinfweb.jphyloio.dataadapters.JPhyloIOEventReceiver; |
17 | 18 |
import info.bioinfweb.jphyloio.dataadapters.MatrixDataAdapter; |
18 | 19 |
import info.bioinfweb.jphyloio.dataadapters.ObjectListDataAdapter; |
19 |
import info.bioinfweb.jphyloio.dataadapters.implementations.NoSetsMatrixDataAdapter; |
|
20 |
import info.bioinfweb.jphyloio.dataadapters.implementations.NoCharDefsNoSetsMatrixDataAdapter;
|
|
20 | 21 |
import info.bioinfweb.jphyloio.dataadapters.implementations.readtowriteadapter.StoreObjectListDataAdapter; |
21 | 22 |
import info.bioinfweb.jphyloio.events.LinkedLabeledIDEvent; |
22 | 23 |
import info.bioinfweb.jphyloio.events.SequenceTokensEvent; |
... | ... | |
36 | 37 |
* @author Ben Stöver |
37 | 38 |
* @date 29.04.2016 |
38 | 39 |
*/ |
39 |
public class CDMSequenceMatrixAdapter extends NoSetsMatrixDataAdapter implements ReadWriteConstants { |
|
40 |
public class CDMSequenceMatrixAdapter extends NoCharDefsNoSetsMatrixDataAdapter implements ReadWriteConstants {
|
|
40 | 41 |
public static final String MATRIX_ID = DEFAULT_MATRIX_ID_PREFIX + "ContigAlignment"; |
41 | 42 |
public static final String SINGLE_READ_SEQUENCE_ID_PREFIX = DEFAULT_SEQUENCE_ID_PREFIX + "SingleRead"; |
42 | 43 |
public static final String CONSENSUS_SEQUENCE_ID= DEFAULT_SEQUENCE_ID_PREFIX + "Consensus"; |
... | ... | |
90 | 91 |
|
91 | 92 |
|
92 | 93 |
@Override |
93 |
public LinkedLabeledIDEvent getStartEvent() { |
|
94 |
public LinkedLabeledIDEvent getStartEvent(ReadWriteParameterMap parameters) {
|
|
94 | 95 |
return new LinkedLabeledIDEvent(EventContentType.ALIGNMENT, MATRIX_ID, "Contig alignment", null); |
95 | 96 |
//TODO Use label according to derivate and markers. |
96 | 97 |
} |
97 | 98 |
|
98 | 99 |
|
99 | 100 |
@Override |
100 |
public boolean containsLongTokens() { |
|
101 |
public boolean containsLongTokens(ReadWriteParameterMap parameters) {
|
|
101 | 102 |
return false; |
102 | 103 |
} |
103 | 104 |
|
104 | 105 |
|
105 | 106 |
@Override |
106 |
public long getColumnCount() { |
|
107 |
public long getColumnCount(ReadWriteParameterMap parameters) {
|
|
107 | 108 |
return getCDMSequence().getSequenceString().length(); //TODO Consider that parts of single reads may lie outside of the current consensus sequence. Possibly return -1 in the future. |
108 | 109 |
} |
109 | 110 |
|
110 | 111 |
|
111 | 112 |
@Override |
112 |
public long getSequenceCount() { |
|
113 |
public long getSequenceCount(ReadWriteParameterMap parameters) {
|
|
113 | 114 |
return /*sequence.getSingleReadAlignments().size() +*/ 1; |
114 | 115 |
} |
115 | 116 |
|
116 | 117 |
|
117 | 118 |
@Override |
118 |
public Iterator<String> getSequenceIDIterator() { |
|
119 |
public Iterator<String> getSequenceIDIterator(ReadWriteParameterMap parameters) {
|
|
119 | 120 |
return new SequenceIDIterator(getCDMSequence().getSingleReadAlignments().size()); |
120 | 121 |
} |
121 | 122 |
|
122 | 123 |
|
123 | 124 |
@Override |
124 |
public long getSequenceLength(String sequenceID) throws IllegalArgumentException { |
|
125 |
public long getSequenceLength(ReadWriteParameterMap parameters, String sequenceID) throws IllegalArgumentException {
|
|
125 | 126 |
int singleReadIndex = extractSingleReadIndexFromID(sequenceID); |
126 | 127 |
if (singleReadIndex >= 0) { |
127 | 128 |
//TODO Determine single read length. (Current problem: Reads are not ordered in the set of the Sequence object.) |
... | ... | |
137 | 138 |
|
138 | 139 |
|
139 | 140 |
@Override |
140 |
public LinkedLabeledIDEvent getSequenceStartEvent(String sequenceID) { |
|
141 |
public LinkedLabeledIDEvent getSequenceStartEvent(ReadWriteParameterMap parameters, String sequenceID) {
|
|
141 | 142 |
int singleReadIndex = extractSingleReadIndexFromID(sequenceID); |
142 | 143 |
if (singleReadIndex >= 0) { |
143 | 144 |
return new LinkedLabeledIDEvent(EventContentType.SEQUENCE, sequenceID, "singleRead" + singleReadIndex, null); |
... | ... | |
153 | 154 |
|
154 | 155 |
|
155 | 156 |
@Override |
156 |
public void writeSequencePartContentData(JPhyloIOEventReceiver receiver, String sequenceID, long startColumn, |
|
157 |
public void writeSequencePartContentData(ReadWriteParameterMap parameters, JPhyloIOEventReceiver receiver, String sequenceID, long startColumn,
|
|
157 | 158 |
long endColumn) throws IOException, IllegalArgumentException { |
158 | 159 |
|
159 | 160 |
int singleReadIndex = extractSingleReadIndexFromID(sequenceID); |
... | ... | |
178 | 179 |
* @see info.bioinfweb.jphyloio.dataadapters.implementations.NoSetsMatrixDataAdapter#getTokenSets() |
179 | 180 |
*/ |
180 | 181 |
@Override |
181 |
public ObjectListDataAdapter<TokenSetDefinitionEvent> getTokenSets() { |
|
182 |
public ObjectListDataAdapter<TokenSetDefinitionEvent> getTokenSets(ReadWriteParameterMap parameters) {
|
|
182 | 183 |
return tokenSetList; |
183 | 184 |
} |
184 | 185 |
} |
Also available in: Unified diff
Molecular plugin adjusted to recent changes in JPhyloIO.