Skip to content

Commit

Permalink
biostars and vcfgatkeval
Browse files Browse the repository at this point in the history
  • Loading branch information
lindenb committed Jun 23, 2023
1 parent 8a9a881 commit e5a6a83
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/JvarkitCentral.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ JVARKIT
=======

Author : Pierre Lindenbaum Phd. Institut du Thorax. Nantes. France.
Version : 0ceae1f9f
Compilation : 20230616160652
Version : 8a9a881bc
Compilation : 20230623173135
Github : https://github.com/lindenb/jvarkit
Issues : https://github.com/lindenb/jvarkit/issues

Expand Down
1 change: 1 addition & 0 deletions docs/SamJdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Usage: samjdk [options] Files
* [https://www.biostars.org/p/9524098](https://www.biostars.org/p/9524098)
* [https://www.biostars.org/p/9532167](https://www.biostars.org/p/9532167)
* [https://www.biostars.org/p/9537698](https://www.biostars.org/p/9537698)
* [https://www.biostars.org/p/9567318](https://www.biostars.org/p/9567318)



Expand Down
1 change: 1 addition & 0 deletions docs/VcfFilterJdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ Usage: vcffilterjdk [options] Files
* [https://www.biostars.org/p/9527886](https://www.biostars.org/p/9527886)
* [https://www.biostars.org/p/9536293](https://www.biostars.org/p/9536293)
* [https://www.biostars.org/p/9537149](https://www.biostars.org/p/9537149)
* [https://www.biostars.org/p/9567314](https://www.biostars.org/p/9567314)



Expand Down
10 changes: 10 additions & 0 deletions docs/VcfGatkEval.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Usage: java -jar dist/jvarkit.jar vcfgatkeval [options] Files
Usage: vcfgatkeval [options] Files
Options:
--depth
include INFO/DP
Default: false
-h, --help
print help and exit
--helpFormat
Expand Down Expand Up @@ -137,6 +140,13 @@ ReadPosRankSum_HIGH_SNP
SOR_HIGH_SNP
```

use with gatk variantFilteration:

```
gatk VariantFiltration -V in.vcf.gz -R reference.fasta -O out.vcf.gz --arguments_file out1.output.filters.txt
```

# Parallelisation

run in parallel
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ JVARKIT
=======

Author : Pierre Lindenbaum Phd. Institut du Thorax. Nantes. France.
Version : 0ceae1f9f
Compilation : 20230616160652
Version : 8a9a881bc
Compilation : 20230623173135
Github : https://github.com/lindenb/jvarkit
Issues : https://github.com/lindenb/jvarkit/issues

Expand Down Expand Up @@ -172,7 +172,7 @@ Please, read [how to run and install jvarkit](JvarkitCentral.md)
| [sortvcfoninfo](SortVcfOnInfo.md) | Sort a VCF a field in the INFO column | 20140218 | 20201204 |
| [sv2fasta](StructuralVariantToFasta.md) | convert VCF of structural variant(s) to fasta for pggb | 20230403 | 20230403 |
| [vcfconcat](VcfConcat.md) | Concatenate VCFs with same sample. See also bcftools concat | 20131230 | 20230614 |
| [vcfgatkeval](VcfGatkEval.md) | Eval/Plot gatk INFO tags for filtering | 20230424 | 20230425 |
| [vcfgatkeval](VcfGatkEval.md) | Eval/Plot gatk INFO tags for filtering | 20230424 | 20230623 |
| [vcfserver](VcfServer.md) | Web Server displaying VCF file. A web interface for vcf2table | 20171027 | 20220517 |
| [vcfspliceai](VcfSpliceAI.md) | Annotate VCF with spiceai web service | 20201107 | 20201107 |
| [vcftbi2bed](VcfTbiToBed.md) | extracts BED for each contig in a tabix-indexed VCF peeking first of last variant for each chromosome. | 20230214 | 20230214 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ public Object apply(final SAMRecord record) {
287057,299673,301080,305526,306034,309143,327317,335998,
336965,340479,342675,345679,362298,368754,378205,
408279,417123,427976,424431,450160,9464312,9489815,9493510,9498170,9511167,9524098,9532167,
9537698},
9537698,9567318
},
references="\"bioalcidae, samjs and vcffilterjs: object-oriented formatters and filters for bioinformatics files\" . Bioinformatics, 2017. Pierre Lindenbaum & Richard Redon [https://doi.org/10.1093/bioinformatics/btx734](https://doi.org/10.1093/bioinformatics/btx734).",
creationDate="20170807",
modificationDate="20191119",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public Object apply(final VariantContext V) {
304979,310155,317388,319148,327035,337645,343569,
347173,351205,351404,354126,302217,384864,416955,
436412,476718,9481318,9489144,9498113,9500825,9509515,9527886,9536293,
9537149
9537149,9567314
},
references="\"bioalcidae, samjs and vcffilterjs: object-oriented formatters and filters for bioinformatics files\" . Bioinformatics, 2017. Pierre Lindenbaum & Richard Redon [https://doi.org/10.1093/bioinformatics/btx734](https://doi.org/10.1093/bioinformatics/btx734).",
creationDate="20170705",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ of this software and associated documentation files (the "Software"), to deal

import htsjdk.samtools.util.RuntimeIOException;
import htsjdk.variant.variantcontext.VariantContext;
import htsjdk.variant.vcf.VCFConstants;
import htsjdk.variant.vcf.VCFHeader;
import htsjdk.variant.vcf.VCFInfoHeaderLine;
import htsjdk.variant.vcf.VCFIterator;
Expand Down Expand Up @@ -116,6 +117,13 @@ of this software and associated documentation files (the "Software"), to deal
SOR_HIGH_SNP
```
use with gatk variantFilteration:
```
gatk VariantFiltration -V in.vcf.gz -R reference.fasta -O out.vcf.gz --arguments_file out1.output.filters.txt
```
# Parallelisation
run in parallel
Expand All @@ -140,7 +148,7 @@ of this software and associated documentation files (the "Software"), to deal
jvarkit_amalgamion = true,
keywords={"vcf","gatk"},
creationDate ="20230424",
modificationDate="20230425"
modificationDate="20230623"
)
public class VcfGatkEval extends Launcher {
private static Logger LOG=Logger.build(VcfGatkEval.class).make();
Expand All @@ -152,6 +160,8 @@ private enum INPUT_TYPE{vcf,table};
private INPUT_TYPE inputType = INPUT_TYPE.vcf;
@Parameter(names={"-p","--percentile"},description="GATK Filters should be applied to this percentile: f < x < (1.0 -f)")
private double percentile= 0.025;
@Parameter(names={"--depth"},description="include INFO/" + VCFConstants.DEPTH_KEY)
private boolean include_depth = false;


private static class Range {
Expand Down Expand Up @@ -257,21 +267,22 @@ void saveFilter(PrintWriter out) throws IOException {
if(this.ranges.isEmpty()) return ;
final String testType;
switch(this.variantType) {
case SNP: testType = "vc.isSNP() && "; break;
case INDEL: testType = "vc.isIndel() && "; break;
case SNP: testType = "vc.isSNP()&&"; break;//no blank or gatk fails
case INDEL: testType = "vc.isIndel()&&"; break;//no blank or gatk fails
default: testType = ""; break;
}
final String hasAttribute = "vc.hasAttribute(\""+getTag()+"\")&&";
OptionalDouble limit = getLowPercentile();
if(limit.isPresent()) {
out.println("-filter");
out.println("\"" +testType + getTag() +" < "+ limit.getAsDouble()+ "\"");
out.println("--filter-expression");
out.println(testType + hasAttribute + getTag() +"<"+ limit.getAsDouble()); //no blank or gatk fails
out.println("--filter-name");
out.println(getTag()+"_LOW_"+variantType.name());
}
limit = getHighPercentile();
if(limit.isPresent()) {
out.println("-filter");
out.println("\""+testType + getTag() +" > "+ limit.getAsDouble()+ "\"");
out.println("--filter-expression");
out.println(testType + hasAttribute + getTag() +">"+ limit.getAsDouble());//no blank or gatk fails
out.println("--filter-name");
out.println(getTag()+"_HIGH_"+variantType.name());
}
Expand Down Expand Up @@ -427,6 +438,13 @@ private class MappingQualityRankSumTestAnnotation extends Annotation {

}

private class DepthAnnotation extends Annotation {
DepthAnnotation(VariantContext.Type t) { super(t);}
@Override String getTag() { return VCFConstants.DEPTH_KEY;}
@Override int getPrecision() { return 1;}
@Override String getSub() {return "Depth";}
}

private class ReadPosRankSumTestAnnotation extends Annotation {
ReadPosRankSumTestAnnotation(VariantContext.Type t) { super(t);}
@Override String getTag() { return "ReadPosRankSum";}
Expand All @@ -451,6 +469,9 @@ public int doWork(List<String> args) {
annotations.add(new RMSMappingQualityAnnotation(type));
annotations.add(new MappingQualityRankSumTestAnnotation(type));
annotations.add(new ReadPosRankSumTestAnnotation(type));
if(this.include_depth) {
annotations.add(new DepthAnnotation(type));
}
}
Collections.sort(annotations, (A,B)->{
int i= A.getTag().compareTo(B.getTag());
Expand Down

0 comments on commit e5a6a83

Please sign in to comment.