Skip to content

Commit

Permalink
before moving to master
Browse files Browse the repository at this point in the history
  • Loading branch information
lindenb committed Oct 13, 2021
1 parent 1b3e219 commit ccebcdd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
16 changes: 14 additions & 2 deletions docs/Biostar145820.md
Expand Up @@ -11,7 +11,7 @@ subsample/shuffle BAM to fixed number of alignments.
Usage: biostar145820 [options] Files
Options:
--bamcompression
Compression Level.
Compression Level. 0: no compression. 9: max compression;
Default: 5
-f, --filter, --jexl
A JEXL Expression that will be used to filter out some sam-records (see
Expand All @@ -32,10 +32,17 @@ Usage: biostar145820 [options] Files
Default: 50000
-o, --output
Output file. Optional . Default: stdout
--reference, -R
For reading/writing CRAM files. Indexed fasta Reference file. This file
must be indexed with samtools faidx and with picard
CreateSequenceDictionary
--samoutputformat
Sam output format.
Default: SAM
Possible Values: [BAM, SAM, CRAM]
--seed
Random seed. -1 == current time
Default: -1
--tmpDir
tmp working directory. Default: java.io.tmpDir
Default: []
Expand Down Expand Up @@ -78,6 +85,11 @@ $ ./gradlew biostar145820

The java jar file will be installed in the `dist` directory.


## Creation Date

20150615

## Source code

[https://github.com/lindenb/jvarkit/tree/master/src/main/java/com/github/lindenb/jvarkit/tools/biostar/Biostar145820.java](https://github.com/lindenb/jvarkit/tree/master/src/main/java/com/github/lindenb/jvarkit/tools/biostar/Biostar145820.java)
Expand All @@ -102,7 +114,7 @@ Should you cite **biostar145820** ? [https://github.com/mr-c/shouldacite/blob/ma

The current reference is:

* MED25 connects enhancerpromoter looping and MYC2-dependent activation of jasmonate signalling. Wang et al. Nature Plants 5, 616625 (2019) https://doi.org/10.1038/s41477-019-0441-9
* MED25 connects enhancer-promoter looping and MYC2-dependent activation of jasmonate signalling. Wang et al. Nature Plants 5, 616-625 (2019) https://doi.org/10.1038/s41477-019-0441-9


## Example
Expand Down
Expand Up @@ -30,6 +30,7 @@ The MIT License (MIT)
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

import javax.xml.stream.XMLOutputFactory;
Expand Down Expand Up @@ -84,6 +85,7 @@ public int doWork(final List<String> args) {
try(VCFReader reader = VCFReaderFactory.makeDefault().open(Paths.get(oneAndOnlyOneFile(args)),true)) {
final VCFHeader header= reader.getHeader();
final SAMSequenceDictionary dict = SequenceDictionaryUtils.extractRequired(header);
final Optional<String> buildName = SequenceDictionaryUtils.getBuildName(dict);
try( ReferenceSequenceFile reference = ReferenceSequenceFileFactory.getReferenceSequenceFile(this.faidx)) {
SequenceUtil.assertSequenceDictionariesEqual(SequenceDictionaryUtils.extractRequired(reference),dict);
final List<Locatable> locs = IntervalListProvider.from(this.regionsStr).dictionary(dict).stream().
Expand Down Expand Up @@ -118,7 +120,7 @@ public int doWork(final List<String> args) {
jsw.name("contig").value(loc.getContig());
jsw.name("start").value(loc.getStart());
jsw.name("end").value(loc.getEnd());
jsw.name("len").value(loc.getLengthOnReference());
jsw.name("length").value(loc.getLengthOnReference());
jsw.name("sequence").value(reference.getSubsequenceAt(loc.getContig(), loc.getStart(), loc.getEnd()).getBaseString());
jsw.name("variants");
jsw.beginArray();
Expand All @@ -127,6 +129,7 @@ public int doWork(final List<String> args) {
jsw.name("start").value(ctx.getStart());
jsw.name("end").value(ctx.getEnd());
jsw.name("id").value(ctx.hasID()?ctx.getID():"");
jsw.name("type").value(ctx.getType().name());
jsw.name("ref").value(ctx.getReference().getDisplayString());
jsw.name("alts");
jsw.beginArray();
Expand All @@ -148,7 +151,7 @@ public int doWork(final List<String> args) {

final String filename = loc.getContig()+"_"+loc.getStart()+"_"+loc.getEnd()+".html";

final String title= new SimpleInterval(loc).toNiceString();
final String title= (buildName.isPresent()?buildName.get()+" ":"")+new SimpleInterval(loc).toNiceString();
OutputStream os = archive.openOuputStream(filename);
XMLStreamWriter out = xof.createXMLStreamWriter(os, "UTF-8");
out.writeStartDocument("UTF-8", "1.0");
Expand All @@ -163,6 +166,9 @@ public int doWork(final List<String> args) {
"function repaint() {}"
);

out.writeEndElement();//script
out.writeStartElement("script");
out.writeAttribute("src", "script.js");
out.writeEndElement();//script
out.writeStartElement("title");
out.writeCharacters(title+" N="+StringUtils.niceInt(variants.size()));
Expand Down

0 comments on commit ccebcdd

Please sign in to comment.