Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic assay binary types #10335

Merged
merged 3 commits into from
Aug 22, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public class ExpressionEnrichmentUtil {

private static final double LOG2 = Math.log(2);
private static final String RNA_SEQ = "rna_seq";
private static final String POS = "true";
private static final String NEG = "false";
private static final String[] posTypeList = {"true", "yes"};
private static final String[] negTypeList = {"false", "no"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about doing this, so we can avoid doing the conversion every time?

Suggested change
private static final String[] posTypeList = {"true", "yes"};
private static final String[] negTypeList = {"false", "no"};
private static final List<String> posTypeList = Arrays.asList("true", "yes");
private static final List<String> negTypeList = Arrays.asList("false", "no");

private static final String ALTERED = "1";
private static final String UNALTERED = "0";
public <T extends MolecularAlteration, S extends ExpressionEnrichment> List<S> getEnrichments(
Expand Down Expand Up @@ -205,7 +205,15 @@ public <T extends MolecularAlteration, S extends ExpressionEnrichment> List<S> g
List<String> molecularDataValues = group.getValue().stream()
.map(sampleIndex -> ma.getSplitValues()[sampleIndex])
.filter(StringUtils::isNotEmpty)
.map(a -> a.equals(POS) ? ALTERED : UNALTERED)
.map(a ->{
if (Arrays.asList(posTypeList).contains(a)) {
return ALTERED;
} else if (Arrays.asList(negTypeList).contains(a)) {
return UNALTERED;
} else {
return a;
}
})
.collect(Collectors.toList());

// ignore group if there are less than 2 values
Expand Down
Loading