Skip to content

Commit

Permalink
Fixed an issue with sample grouping; Grouping samples now ignores rej…
Browse files Browse the repository at this point in the history
…ected variants completely.
  • Loading branch information
s-t-h committed Jan 24, 2024
1 parent 85ceede commit 37ab3cf
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 132 deletions.
6 changes: 0 additions & 6 deletions src/main/java/cli/CLIParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,6 @@ private void addExportTableOptions(Options options) {
.hasArg()
.build()
);
options.addOption(
Option.builder("x")
.longOpt("rejected")
.desc("Whether to write rejected variants as reference content (Default: Rejected as ambiguous base). This option is only relevant for `content=nucleotide`.")
.build()
);
options.addOption(
Option.builder("g")
.longOpt("group")
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/datastructure/VariantAnnotation.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package datastructure;

import main.Musial;
import main.MusialConstants;

import java.util.ArrayList;
import java.util.NavigableSet;
import java.util.concurrent.ConcurrentSkipListMap;

Expand Down Expand Up @@ -90,5 +92,18 @@ public boolean hasProperty(String key) {
return this.properties.containsKey(key);
}

/**
* Returns a list of sample names in which this variant occurs.
*
* @return {@link ArrayList} of sample names that yield this variant.
*/
public ArrayList<String> getSamples() {
ArrayList<String> sampleNames = new ArrayList<>();
for (String propertyKey : this.getPropertyKeys()) {
if ( propertyKey.startsWith(MusialConstants.VARIANT_OCCURRENCE_SAMPLE_PREFIX) )
sampleNames.add( propertyKey.replace( MusialConstants.VARIANT_OCCURRENCE_SAMPLE_PREFIX, "" ) );
}
return sampleNames;
}

}
Loading

0 comments on commit 37ab3cf

Please sign in to comment.