| 1 |
|
package jalview.hmmer; |
| 2 |
|
|
| 3 |
|
import jalview.analysis.SeqsetUtils; |
| 4 |
|
import jalview.analysis.SeqsetUtils.SequenceInfo; |
| 5 |
|
import jalview.bin.Cache; |
| 6 |
|
import jalview.bin.Console; |
| 7 |
|
import jalview.datamodel.Alignment; |
| 8 |
|
import jalview.datamodel.AlignmentAnnotation; |
| 9 |
|
import jalview.datamodel.AlignmentI; |
| 10 |
|
import jalview.datamodel.AnnotatedCollectionI; |
| 11 |
|
import jalview.datamodel.Annotation; |
| 12 |
|
import jalview.datamodel.HiddenMarkovModel; |
| 13 |
|
import jalview.datamodel.SequenceGroup; |
| 14 |
|
import jalview.datamodel.SequenceI; |
| 15 |
|
import jalview.gui.AlignFrame; |
| 16 |
|
import jalview.gui.JvOptionPane; |
| 17 |
|
import jalview.gui.Preferences; |
| 18 |
|
import jalview.io.FastaFile; |
| 19 |
|
import jalview.io.HMMFile; |
| 20 |
|
import jalview.io.StockholmFile; |
| 21 |
|
import jalview.util.FileUtils; |
| 22 |
|
import jalview.util.MessageManager; |
| 23 |
|
import jalview.util.Platform; |
| 24 |
|
import jalview.ws.params.ArgumentI; |
| 25 |
|
|
| 26 |
|
import java.io.BufferedReader; |
| 27 |
|
import java.io.File; |
| 28 |
|
import java.io.IOException; |
| 29 |
|
import java.io.InputStreamReader; |
| 30 |
|
import java.io.PrintWriter; |
| 31 |
|
import java.nio.file.Paths; |
| 32 |
|
import java.util.ArrayList; |
| 33 |
|
import java.util.Hashtable; |
| 34 |
|
import java.util.List; |
| 35 |
|
import java.util.Map; |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
@author |
| 41 |
|
|
| 42 |
|
|
| |
|
| 1.4% |
Uncovered Elements: 209 (212) |
Complexity: 56 |
Complexity Density: 0.41 |
|
| 43 |
|
public abstract class HmmerCommand implements Runnable |
| 44 |
|
{ |
| 45 |
|
public static final String HMMBUILD = "hmmbuild"; |
| 46 |
|
|
| 47 |
|
protected final AlignFrame af; |
| 48 |
|
|
| 49 |
|
protected final AlignmentI alignment; |
| 50 |
|
|
| 51 |
|
protected final List<ArgumentI> params; |
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
static final String DATABASE_KEY = "label.database"; |
| 57 |
|
|
| 58 |
|
static final String THIS_ALIGNMENT_KEY = "label.this_alignment"; |
| 59 |
|
|
| 60 |
|
static final String USE_ACCESSIONS_KEY = "label.use_accessions"; |
| 61 |
|
|
| 62 |
|
static final String AUTO_ALIGN_SEQS_KEY = "label.auto_align_seqs"; |
| 63 |
|
|
| 64 |
|
static final String NUMBER_OF_RESULTS_KEY = "label.number_of_results"; |
| 65 |
|
|
| 66 |
|
static final String NUMBER_OF_ITERATIONS = "label.number_of_iterations"; |
| 67 |
|
|
| 68 |
|
static final String TRIM_TERMINI_KEY = "label.trim_termini"; |
| 69 |
|
|
| 70 |
|
static final String RETURN_N_NEW_SEQ = "label.check_for_new_sequences"; |
| 71 |
|
|
| 72 |
|
static final String REPORTING_CUTOFF_KEY = "label.reporting_cutoff"; |
| 73 |
|
|
| 74 |
|
static final String CUTOFF_NONE = "label.default"; |
| 75 |
|
|
| 76 |
|
static final String CUTOFF_SCORE = "label.score"; |
| 77 |
|
|
| 78 |
|
static final String CUTOFF_EVALUE = "label.evalue"; |
| 79 |
|
|
| 80 |
|
static final String REPORTING_SEQ_EVALUE_KEY = "label.reporting_seq_evalue"; |
| 81 |
|
|
| 82 |
|
static final String REPORTING_DOM_EVALUE_KEY = "label.reporting_dom_evalue"; |
| 83 |
|
|
| 84 |
|
static final String REPORTING_SEQ_SCORE_KEY = "label.reporting_seq_score"; |
| 85 |
|
|
| 86 |
|
static final String REPORTING_DOM_SCORE_KEY = "label.reporting_dom_score"; |
| 87 |
|
|
| 88 |
|
static final String INCLUSION_SEQ_EVALUE_KEY = "label.inclusion_seq_evalue"; |
| 89 |
|
|
| 90 |
|
static final String INCLUSION_DOM_EVALUE_KEY = "label.inclusion_dom_evalue"; |
| 91 |
|
|
| 92 |
|
static final String INCLUSION_SEQ_SCORE_KEY = "label.inclusion_seq_score"; |
| 93 |
|
|
| 94 |
|
static final String INCLUSION_DOM_SCORE_KEY = "label.inclusion_dom_score"; |
| 95 |
|
|
| 96 |
|
static final String ARG_TRIM = "--trim"; |
| 97 |
|
|
| 98 |
|
static final String INCLUSION_THRESHOLD_KEY = "label.inclusion_threshold"; |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
@param |
| 104 |
|
@param |
| 105 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 106 |
0 |
public HmmerCommand(AlignFrame alignFrame, List<ArgumentI> args)... |
| 107 |
|
{ |
| 108 |
0 |
af = alignFrame; |
| 109 |
0 |
alignment = af.getViewport().getAlignment(); |
| 110 |
0 |
params = args; |
| 111 |
|
} |
| 112 |
|
|
| 113 |
|
|
| 114 |
|
|
| 115 |
|
|
| 116 |
|
|
| 117 |
|
|
| 118 |
|
@return |
| 119 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 120 |
487 |
public static boolean isHmmerAvailable()... |
| 121 |
|
{ |
| 122 |
487 |
File exec = FileUtils.getExecutable(HMMBUILD, |
| 123 |
|
Cache.getProperty(Preferences.HMMER_PATH)); |
| 124 |
487 |
return exec != null; |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
| 129 |
|
|
| 130 |
|
|
| 131 |
|
@param |
| 132 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 133 |
0 |
protected Map<String, SequenceInfo> stashSequences(SequenceI[] seqs)... |
| 134 |
|
{ |
| 135 |
0 |
return SeqsetUtils.uniquify(seqs, true); |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
|
@param |
| 142 |
|
@param |
| 143 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 144 |
0 |
protected void recoverSequences(Map<String, SequenceInfo> sequencesHash, SequenceI[] seqs)... |
| 145 |
|
{ |
| 146 |
0 |
SeqsetUtils.deuniquify(sequencesHash, seqs); |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
|
| 150 |
|
|
| 151 |
|
|
| 152 |
|
|
| 153 |
|
@param |
| 154 |
|
|
| 155 |
|
@throws |
| 156 |
|
|
| |
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 5 |
Complexity Density: 0.28 |
|
| 157 |
0 |
public boolean runCommand(List<String> commands)... |
| 158 |
|
throws IOException |
| 159 |
|
{ |
| 160 |
0 |
List<String> args = Platform.isWindowsAndNotJS() ? wrapWithCygwin(commands) |
| 161 |
|
: commands; |
| 162 |
|
|
| 163 |
0 |
try |
| 164 |
|
{ |
| 165 |
0 |
ProcessBuilder pb = new ProcessBuilder(args); |
| 166 |
0 |
pb.redirectErrorStream(true); |
| 167 |
0 |
if (Platform.isWindowsAndNotJS()) |
| 168 |
|
{ |
| 169 |
0 |
String path = pb.environment().get("Path"); |
| 170 |
0 |
path = jalview.bin.Cache.getProperty("CYGWIN_PATH") + ";" + path; |
| 171 |
0 |
pb.environment().put("Path", path); |
| 172 |
|
} |
| 173 |
0 |
final Process p = pb.start(); |
| 174 |
0 |
new Thread(new Runnable() |
| 175 |
|
{ |
| |
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
| 176 |
0 |
@Override... |
| 177 |
|
public void run() |
| 178 |
|
{ |
| 179 |
0 |
BufferedReader input = new BufferedReader( |
| 180 |
|
new InputStreamReader(p.getInputStream())); |
| 181 |
0 |
try |
| 182 |
|
{ |
| 183 |
0 |
String line = input.readLine(); |
| 184 |
0 |
while (line != null) |
| 185 |
|
{ |
| 186 |
0 |
System.out.println(line); |
| 187 |
0 |
line = input.readLine(); |
| 188 |
|
} |
| 189 |
|
} catch (IOException e) |
| 190 |
|
{ |
| 191 |
0 |
e.printStackTrace(); |
| 192 |
|
} |
| 193 |
|
} |
| 194 |
|
}).start(); |
| 195 |
|
|
| 196 |
0 |
p.waitFor(); |
| 197 |
0 |
int exitValue = p.exitValue(); |
| 198 |
0 |
if (exitValue != 0) |
| 199 |
|
{ |
| 200 |
0 |
Console.error("Command failed, return code = " + exitValue); |
| 201 |
0 |
Console.error("Command/args were: " + args.toString()); |
| 202 |
|
} |
| 203 |
0 |
return exitValue == 0; |
| 204 |
|
} catch (Exception e) |
| 205 |
|
{ |
| 206 |
0 |
e.printStackTrace(); |
| 207 |
0 |
return false; |
| 208 |
|
} |
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 215 |
|
|
| 216 |
|
@param |
| 217 |
|
|
| |
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 2 |
Complexity Density: 0.17 |
|
| 218 |
0 |
protected List<String> wrapWithCygwin(List<String> commands)... |
| 219 |
|
{ |
| 220 |
0 |
File bash = FileUtils.getExecutable("bash", |
| 221 |
|
Cache.getProperty(Preferences.CYGWIN_PATH)); |
| 222 |
0 |
if (bash == null) |
| 223 |
|
{ |
| 224 |
0 |
Console.error("Cygwin shell not found"); |
| 225 |
0 |
return commands; |
| 226 |
|
} |
| 227 |
|
|
| 228 |
0 |
List<String> wrapped = new ArrayList<>(); |
| 229 |
|
|
| 230 |
0 |
wrapped.add(bash.getAbsolutePath()); |
| 231 |
0 |
wrapped.add("-c"); |
| 232 |
|
|
| 233 |
|
|
| 234 |
|
|
| 235 |
|
|
| 236 |
0 |
StringBuilder sb = new StringBuilder(); |
| 237 |
0 |
for (String cmd : commands) |
| 238 |
|
{ |
| 239 |
0 |
sb.append(" ").append(cmd); |
| 240 |
|
} |
| 241 |
0 |
wrapped.add(sb.toString()); |
| 242 |
|
|
| 243 |
0 |
return wrapped; |
| 244 |
|
} |
| 245 |
|
|
| 246 |
|
|
| 247 |
|
|
| 248 |
|
|
| 249 |
|
|
| 250 |
|
@param |
| 251 |
|
@param |
| 252 |
|
@param |
| 253 |
|
@throws |
| 254 |
|
|
| |
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 10 |
Complexity Density: 0.38 |
|
| 255 |
0 |
public void exportStockholm(SequenceI[] seqs, File toFile,... |
| 256 |
|
AnnotatedCollectionI annotated) |
| 257 |
|
throws IOException |
| 258 |
|
{ |
| 259 |
0 |
if (seqs == null) |
| 260 |
|
{ |
| 261 |
0 |
return; |
| 262 |
|
} |
| 263 |
0 |
AlignmentI newAl = new Alignment(seqs); |
| 264 |
|
|
| 265 |
0 |
if (!newAl.isAligned()) |
| 266 |
|
{ |
| 267 |
0 |
newAl.padGaps(); |
| 268 |
|
} |
| 269 |
|
|
| 270 |
0 |
if (toFile != null && annotated != null) |
| 271 |
|
{ |
| 272 |
0 |
AlignmentAnnotation[] annots = annotated.getAlignmentAnnotation(); |
| 273 |
0 |
if (annots != null) |
| 274 |
|
{ |
| 275 |
0 |
for (AlignmentAnnotation annot : annots) |
| 276 |
|
{ |
| 277 |
0 |
if (annot.label.contains("Reference") || "RF".equals(annot.label)) |
| 278 |
|
{ |
| 279 |
0 |
AlignmentAnnotation newRF; |
| 280 |
0 |
if (annot.annotations.length > newAl.getWidth()) |
| 281 |
|
{ |
| 282 |
0 |
Annotation[] rfAnnots = new Annotation[newAl.getWidth()]; |
| 283 |
0 |
System.arraycopy(annot.annotations, 0, rfAnnots, 0, |
| 284 |
|
rfAnnots.length); |
| 285 |
0 |
newRF = new AlignmentAnnotation("RF", "Reference Positions", |
| 286 |
|
rfAnnots); |
| 287 |
|
} |
| 288 |
|
else |
| 289 |
|
{ |
| 290 |
0 |
newRF = new AlignmentAnnotation(annot); |
| 291 |
|
} |
| 292 |
0 |
newAl.addAnnotation(newRF); |
| 293 |
|
} |
| 294 |
|
} |
| 295 |
|
} |
| 296 |
|
} |
| 297 |
|
|
| 298 |
0 |
for (SequenceI seq : newAl.getSequencesArray()) |
| 299 |
|
{ |
| 300 |
0 |
if (seq.getAnnotation() != null) |
| 301 |
|
{ |
| 302 |
0 |
for (AlignmentAnnotation ann : seq.getAnnotation()) |
| 303 |
|
{ |
| 304 |
0 |
seq.removeAlignmentAnnotation(ann); |
| 305 |
|
} |
| 306 |
|
} |
| 307 |
|
} |
| 308 |
|
|
| 309 |
0 |
StockholmFile file = new StockholmFile(newAl); |
| 310 |
0 |
String output = file.print(seqs, false); |
| 311 |
0 |
PrintWriter writer = new PrintWriter(toFile); |
| 312 |
0 |
writer.println(output); |
| 313 |
0 |
writer.close(); |
| 314 |
|
} |
| 315 |
|
|
| 316 |
|
|
| 317 |
|
|
| 318 |
|
|
| 319 |
|
|
| 320 |
|
@param |
| 321 |
|
|
| 322 |
|
@return |
| 323 |
|
@throws |
| 324 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 325 |
0 |
protected String getCommandPath(String cmd)... |
| 326 |
|
throws IOException |
| 327 |
|
{ |
| 328 |
0 |
String binariesFolder = Cache.getProperty(Preferences.HMMER_PATH); |
| 329 |
|
|
| 330 |
0 |
binariesFolder = Paths.get(binariesFolder).toRealPath().toString(); |
| 331 |
0 |
File file = FileUtils.getExecutable(cmd, binariesFolder); |
| 332 |
0 |
if (file == null && af != null) |
| 333 |
|
{ |
| 334 |
0 |
JvOptionPane.showInternalMessageDialog(af, MessageManager |
| 335 |
|
.formatMessage("label.executable_not_found", cmd)); |
| 336 |
|
} |
| 337 |
|
|
| 338 |
0 |
return file == null ? null : getFilePath(file, true); |
| 339 |
|
} |
| 340 |
|
|
| 341 |
|
|
| 342 |
|
|
| 343 |
|
|
| 344 |
|
@param |
| 345 |
|
@param |
| 346 |
|
@throws |
| 347 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 348 |
0 |
public void exportHmm(HiddenMarkovModel hmm, File hmmFile)... |
| 349 |
|
throws IOException |
| 350 |
|
{ |
| 351 |
0 |
if (hmm != null) |
| 352 |
|
{ |
| 353 |
0 |
HMMFile file = new HMMFile(hmm); |
| 354 |
0 |
PrintWriter writer = new PrintWriter(hmmFile); |
| 355 |
0 |
writer.print(file.print()); |
| 356 |
0 |
writer.close(); |
| 357 |
|
} |
| 358 |
|
} |
| 359 |
|
|
| 360 |
|
|
| 361 |
|
|
| 362 |
|
|
| 363 |
|
|
| 364 |
|
@param |
| 365 |
|
@param |
| 366 |
|
@throws |
| 367 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 368 |
0 |
public void exportSequence(SequenceI seq, File seqFile) throws IOException... |
| 369 |
|
{ |
| 370 |
0 |
if (seq != null) |
| 371 |
|
{ |
| 372 |
0 |
FastaFile file = new FastaFile(); |
| 373 |
0 |
PrintWriter writer = new PrintWriter(seqFile); |
| 374 |
0 |
writer.print(file.print(new SequenceI[] { seq }, false)); |
| 375 |
0 |
writer.close(); |
| 376 |
|
} |
| 377 |
|
} |
| 378 |
|
|
| 379 |
|
|
| 380 |
|
|
| 381 |
|
|
| 382 |
|
|
| 383 |
|
@return |
| 384 |
|
|
| |
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
| 385 |
0 |
protected HiddenMarkovModel getHmmProfile()... |
| 386 |
|
{ |
| 387 |
0 |
String alignToParamName = MessageManager.getString("label.use_hmm"); |
| 388 |
0 |
for (ArgumentI arg : params) |
| 389 |
|
{ |
| 390 |
0 |
String name = arg.getName(); |
| 391 |
0 |
if (name.equals(alignToParamName)) |
| 392 |
|
{ |
| 393 |
0 |
String seqName = arg.getValue(); |
| 394 |
0 |
SequenceI hmmSeq = alignment.findName(seqName); |
| 395 |
0 |
if (hmmSeq.hasHMMProfile()) |
| 396 |
|
{ |
| 397 |
0 |
return hmmSeq.getHMM(); |
| 398 |
|
} |
| 399 |
|
} |
| 400 |
|
} |
| 401 |
0 |
return null; |
| 402 |
|
} |
| 403 |
|
|
| 404 |
|
|
| 405 |
|
|
| 406 |
|
|
| 407 |
|
|
| 408 |
|
@return |
| 409 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
| 410 |
0 |
protected SequenceI getSequence()... |
| 411 |
|
{ |
| 412 |
0 |
String alignToParamName = MessageManager |
| 413 |
|
.getString("label.use_sequence"); |
| 414 |
0 |
for (ArgumentI arg : params) |
| 415 |
|
{ |
| 416 |
0 |
String name = arg.getName(); |
| 417 |
0 |
if (name.equals(alignToParamName)) |
| 418 |
|
{ |
| 419 |
0 |
String seqName = arg.getValue(); |
| 420 |
0 |
SequenceI seq = alignment.findName(seqName); |
| 421 |
0 |
return seq; |
| 422 |
|
} |
| 423 |
|
} |
| 424 |
0 |
return null; |
| 425 |
|
} |
| 426 |
|
|
| 427 |
|
|
| 428 |
|
|
| 429 |
|
|
| 430 |
|
|
| 431 |
|
|
| 432 |
|
|
| 433 |
|
@param |
| 434 |
|
@param |
| 435 |
|
|
| 436 |
|
|
| 437 |
|
@return |
| 438 |
|
|
| |
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
| 439 |
0 |
protected String getFilePath(File resultFile, boolean isInCygwin)... |
| 440 |
|
{ |
| 441 |
0 |
String path = resultFile.getAbsolutePath(); |
| 442 |
0 |
if (Platform.isWindowsAndNotJS() && isInCygwin) |
| 443 |
|
{ |
| 444 |
|
|
| 445 |
0 |
path = path.replaceAll("\\" + File.separator, "/"); |
| 446 |
0 |
int colon = path.indexOf(':'); |
| 447 |
0 |
if (colon > 0) |
| 448 |
|
{ |
| 449 |
0 |
String drive = path.substring(0, colon); |
| 450 |
0 |
path = path.replaceAll(drive + ":", "/cygdrive/" + drive); |
| 451 |
|
} |
| 452 |
|
} |
| 453 |
|
|
| 454 |
0 |
return path; |
| 455 |
|
} |
| 456 |
|
|
| 457 |
|
|
| 458 |
|
|
| 459 |
|
|
| 460 |
|
|
| 461 |
|
@param |
| 462 |
|
|
| |
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
| 463 |
0 |
void deleteHmmSequences(AnnotatedCollectionI ac)... |
| 464 |
|
{ |
| 465 |
0 |
List<SequenceI> hmmSeqs = ac.getHmmSequences(); |
| 466 |
0 |
for (SequenceI hmmSeq : hmmSeqs) |
| 467 |
|
{ |
| 468 |
0 |
if (ac instanceof SequenceGroup) |
| 469 |
|
{ |
| 470 |
0 |
((SequenceGroup) ac).deleteSequence(hmmSeq, false); |
| 471 |
0 |
AnnotatedCollectionI context = ac.getContext(); |
| 472 |
0 |
if (context != null && context instanceof AlignmentI) |
| 473 |
|
{ |
| 474 |
0 |
((AlignmentI) context).deleteSequence(hmmSeq); |
| 475 |
|
} |
| 476 |
|
} |
| 477 |
|
else |
| 478 |
|
{ |
| 479 |
0 |
((AlignmentI) ac).deleteSequence(hmmSeq); |
| 480 |
|
} |
| 481 |
|
} |
| 482 |
|
} |
| 483 |
|
|
| 484 |
|
|
| 485 |
|
|
| 486 |
|
|
| 487 |
|
|
| 488 |
|
|
| 489 |
|
@param |
| 490 |
|
|
| |
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 11 |
Complexity Density: 0.65 |
|
| 491 |
0 |
void renameDuplicates(AlignmentI al)... |
| 492 |
|
{ |
| 493 |
|
|
| 494 |
0 |
SequenceI[] seqs = al.getSequencesArray(); |
| 495 |
0 |
List<Boolean> wasRenamed = new ArrayList<>(); |
| 496 |
|
|
| 497 |
0 |
for (SequenceI seq : seqs) |
| 498 |
|
{ |
| 499 |
0 |
wasRenamed.add(false); |
| 500 |
|
} |
| 501 |
|
|
| 502 |
0 |
for (int i = 0; i < seqs.length; i++) |
| 503 |
|
{ |
| 504 |
0 |
for (int j = 0; j < seqs.length; j++) |
| 505 |
|
{ |
| 506 |
0 |
if (seqs[i].getName().equals(seqs[j].getName()) && i != j |
| 507 |
|
&& !wasRenamed.get(j)) |
| 508 |
|
{ |
| 509 |
|
|
| 510 |
0 |
wasRenamed.set(i, true); |
| 511 |
0 |
String range = "/" + seqs[j].getStart() + "-" + seqs[j].getEnd(); |
| 512 |
|
|
| 513 |
|
|
| 514 |
|
|
| 515 |
|
|
| 516 |
0 |
seqs[j].setName(seqs[j].getName() + range + range); |
| 517 |
|
} |
| 518 |
|
|
| 519 |
|
} |
| 520 |
0 |
if (wasRenamed.get(i)) |
| 521 |
|
{ |
| 522 |
0 |
String range = "/" + seqs[i].getStart() + "-" + seqs[i].getEnd(); |
| 523 |
0 |
seqs[i].setName(seqs[i].getName() + range + range); |
| 524 |
|
} |
| 525 |
|
} |
| 526 |
|
|
| 527 |
0 |
for (int i = 0; i < seqs.length; i++) |
| 528 |
|
{ |
| 529 |
0 |
for (int j = 0; j < seqs.length; j++) |
| 530 |
|
{ |
| 531 |
0 |
if (seqs[i].getName().equals(seqs[j].getName()) && i != j) |
| 532 |
|
{ |
| 533 |
0 |
al.deleteSequence(j); |
| 534 |
|
} |
| 535 |
|
} |
| 536 |
|
} |
| 537 |
|
} |
| 538 |
|
|
| 539 |
|
} |