Skip to content

Commit

Permalink
adding check against inadvertently log-2 transformed splicing fold ch…
Browse files Browse the repository at this point in the history
…ange column in HBADEALS file.
  • Loading branch information
pnrobinson committed Jun 20, 2024
1 parent 897ce88 commit 0f1753e
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 16 deletions.
2 changes: 1 addition & 1 deletion isopret-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jax.isopret</groupId>
<artifactId>isopret</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
</parent>

<artifactId>isopret-cli</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion isopret-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jax.isopret</groupId>
<artifactId>isopret</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
</parent>

<artifactId>isopret-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,16 @@ public boolean isIsoform() {
}


/**
* Check for a common user error -- the splice fold change is "raw" (not logarithm), which the expression
* fold change is log2. These are separate lines in the HBADEALS result file.
* @return true if the line does not have negative and thus potentially log2-transformed splicing value
*/
public boolean isValid() {
final double EPSILON = 0.001;
return !isIsoform() || !((expFC + EPSILON) < 0);
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
import java.util.*;

/**
* Parse the HBA-DEALS output file, e.g.,
* Parse the HBA-DEALS output file.
* The HBA-DEALS output file contains 4 columns. The first column is the gene name, the second is the transcript name, the third is the fold change,
* and the fourth is 1-probability of differential expression or proportion(splicing), which is the posterior error probability (PEP).
* Entries that refer to expression have ‘Expression’ in their second column. If isoform.level is FALSE, entries that refer to differential
* splicing of the gene will have ‘Splicing’ in their second column entry.
* The fold change for expression is given as log2 fold change, and for splicing as fold change.
* <p>
* Gene Isoform ExplogFC/FC P
* ENSG00000160710 Expression 1.54770825394965 0
Expand Down Expand Up @@ -87,7 +92,12 @@ private Map<AccessionNumber, GeneResult> parseResults(BufferedReader br) throws
}

int found_symbol = 0;
int invalid_lines = 0;
for (RnaSeqResultLine hline : lines) {
if (! hline.isValid()) {
invalid_lines++;
continue;
}
AccessionNumber ensgAccession = hline.geneAccession(); // if we cannot find symbol, just show the accession
if (hgncMap.containsKey(ensgAccession)) {
GeneModel model = hgncMap.get(ensgAccession);
Expand All @@ -114,6 +124,11 @@ private Map<AccessionNumber, GeneResult> parseResults(BufferedReader br) throws
if (! unfound.isEmpty()) {
LOGGER.info("Could not find symbols for {} accessions.", unfound.size());
}
if (invalid_lines > 0) {
String errmsg = String.format("%d invalid lines (splicing fold change negative-but only expr values should be log2). Fix before continuing.",
invalid_lines);
throw new IsopretRuntimeException(errmsg);
}
return resultsMap;
}

Expand Down Expand Up @@ -146,12 +161,4 @@ public static Map<AccessionNumber, GeneResult> parse(File file,
return parser.ensgAcc2geneResultMap;
}


private Map<AccessionNumber, GeneResult> getEnsgAcc2geneResultMap() {
return this.ensgAcc2geneResultMap;
}




}
2 changes: 1 addition & 1 deletion isopret-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jax.isopret</groupId>
<artifactId>isopret</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
</parent>

<artifactId>isopret-data</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion isopret-exception/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jax.isopret</groupId>
<artifactId>isopret</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
</parent>

<artifactId>isopret-exception</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion isopret-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.jax.isopret</groupId>
<artifactId>isopret</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
</parent>

<artifactId>isopret-gui</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion isopret-io/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jax.isopret</groupId>
<artifactId>isopret</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
</parent>
<packaging>jar</packaging>
<artifactId>isopret-io</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>org.jax.isopret</groupId>
<artifactId>isopret</artifactId>
<version>1.3.1</version>
<version>1.3.2</version>
<modules>
<module>isopret-core</module>
<module>isopret-cli</module>
Expand Down

0 comments on commit 0f1753e

Please sign in to comment.