Skip to content

Commit

Permalink
fixed batched reading on stdin input
Browse files Browse the repository at this point in the history
  • Loading branch information
dannovikov committed Oct 11, 2024
1 parent f4f826a commit 3fdd060
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ java -jar SeqRuler.jar
## Help

```bash
Usage: SeqRuler [-egGhnprsSV] [-a=<ambiguityHandling>] [-c=<cores>]
Usage: java -jar SeqRuler.jar [-egGhnprsSV] [-a=<ambiguityHandling>] [-c=<cores>]
[-d=<distanceMethod>] [-f=<max_ambiguity_fraction>] [-i=FILE]
[-o=FILE] [-t=<edgeThresholdString>]
-a, --ambiguity, --ambiguities=<ambiguityHandling>
Expand All @@ -47,7 +47,7 @@ Usage: SeqRuler [-egGhnprsSV] [-a=<ambiguityHandling>] [-c=<cores>]
mapping. Default: false
-f, --fraction=<max_ambiguity_fraction>
Maximum allowable fraction of ambiguities allowed for
'resolve' mode. If exceeded, use 'average' mode.
'resolve' mode. If exceeded, uses 'average' mode.
-g, --ignore-terminal-gaps Ignore terminal gaps at beginning and end of sequences
when calculating distances. [SNP only] Default: true
-G, --ignore-all-gaps Ignore all gaps when calculating distances. [SNP only]
Expand All @@ -58,7 +58,8 @@ Usage: SeqRuler [-egGhnprsSV] [-a=<ambiguityHandling>] [-c=<cores>]
only] Default: true
-o, --outFile=FILE output file with distances
-p, --pairs read pairs of sequences from stdin, calculate distance
for each pair. format "name1, seq1, name2, seq2\n"
for each pair. format "name1, seq1, name2, seq2\n".
Do not include a header row
-r, --run-server run jetty server
-s, --stdin read fasta from stdin. Alternative to reading from a
file (-i)
Expand Down
Binary file modified SeqRuler.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions modules/gui-app/src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Main implements Runnable{
private boolean use_stdin;
@CommandLine.Option(names={"-S", "--stdout"}, description="write distances to stdout. Alternative to writing to a file (-o)", defaultValue = "false")
private boolean use_stdout;
@CommandLine.Option(names={"-p", "--pairs"}, description="read pairs of sequences from stdin, calculate distance for each pair. format \"name1, seq1, name2, seq2\\n\"", defaultValue = "false")
@CommandLine.Option(names={"-p", "--pairs"}, description="read pairs of sequences from stdin, calculate distance for each pair. format \"name1, seq1, name2, seq2\\n\". Do not include a header row", defaultValue = "false")
private boolean input_as_pairs;
@CommandLine.Option(names={"-d", "--distance-method"},
description="distance metric to use. One of [TN93, SNP]. Default: TN93", defaultValue = "TN93")
Expand All @@ -43,7 +43,7 @@ public class Main implements Runnable{
description="How to handle ambiguous nucleotides. One of [resolve, average, gapmm, skip]", defaultValue = "resolve")
private String ambiguityHandling;
@CommandLine.Option(names={"-f", "--fraction"},
description="Maximum allowable fraction of ambiguities allowed for 'resolve' mode. If exceeded, use 'average' mode.", defaultValue = "1.0")
description="Maximum allowable fraction of ambiguities allowed for 'resolve' mode. If exceeded, uses 'average' mode.", defaultValue = "1.0")
private float max_ambiguity_fraction;
@CommandLine.Option(names={"-c", "--cores"},
description="Number of cores to use for parallel processing. Default: 1", defaultValue = "1")
Expand Down
4 changes: 4 additions & 0 deletions modules/gui-app/src/main/java/TN93/TN93.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ public void tn93Fasta() {
count=0;//reset counts
}
}
// process the last batch
if (pairs.size() > 0) {
tn93_pairs(pairs);
}
return;
} else if (use_stdin) {
seqs = read_fasta_stdin();
Expand Down

0 comments on commit 3fdd060

Please sign in to comment.