Skip to content

Commit

Permalink
validation to stop using not aligned sequences #507
Browse files Browse the repository at this point in the history
  • Loading branch information
walterxie committed Jul 22, 2024
1 parent a04bbc4 commit 503f16f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lphy-base/src/main/java/lphy/base/function/io/ReadFasta.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
public class ReadFasta extends DeterministicFunction<Alignment> {

public ReadFasta(@ParameterInfo(name = ReaderConst.FILE, description = "the name of fasta file including path.") Value<String> filePath,
public ReadFasta(@ParameterInfo(name = ReaderConst.FILE, description = "the name of fasta file including path, which contains an alignment.") Value<String> filePath,
@ParameterInfo(name = ReaderConst.OPTIONS, description = "the map containing optional arguments and their values for reuse.",
optional=true) Value<Map<String, String>> options,
@ParameterInfo(name = ReaderConst.SEQUENCE_TYPE, description = "the sequence type for sequences in the fasta format, " +
Expand Down Expand Up @@ -126,9 +126,12 @@ public static Alignment getAlignment(Reader reader, SequenceType sequenceTypeToG
faData = new SimpleAlignment(Taxa.createTaxa(taxons), siteCount, sequenceType);
}

int len = sequenceList.get(0).getLength();
// fill in sequences
for (int i = 0; i < sequenceList.size(); i++) {
Sequence sequence = sequenceList.get(i);
if (len != sequence.getLength())
throw new IllegalArgumentException("Sequence " + i + " has different length ! Alignment is required.");
for (int s = 0; s < sequence.getLength(); s++) {
//*** convert char into int ***//
State state = sequence.getState(s);
Expand Down

0 comments on commit 503f16f

Please sign in to comment.