diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/core/Snp.java b/biodata-models/src/main/java/org/opencb/biodata/models/core/Snp.java new file mode 100644 index 00000000..8f8cc712 --- /dev/null +++ b/biodata-models/src/main/java/org/opencb/biodata/models/core/Snp.java @@ -0,0 +1,147 @@ +/* + * + * + */ + +package org.opencb.biodata.models.core; + +import java.util.List; + +public class Snp { + private String id; + private String chromosome; + private int position; + private String reference; + private List alternates; + private String type; + private String source; + private String version; + private SnpAnnotation annotation; + + public Snp() { + } + + public Snp(String id, String chromosome, int position, String reference, List alternates, String type, + String source, String version, SnpAnnotation annotation) { + this.id = id; + this.chromosome = chromosome; + this.position = position; + this.reference = reference; + this.alternates = alternates; + this.type = type; + this.source = source; + this.version = version; + this.annotation = annotation; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("Snp{"); + sb.append("id='").append(id).append('\''); + sb.append(", chromosome='").append(chromosome).append('\''); + sb.append(", position=").append(position); + sb.append(", reference='").append(reference).append('\''); + sb.append(", alternates=").append(alternates); + sb.append(", type='").append(type).append('\''); + sb.append(", source='").append(source).append('\''); + sb.append(", version='").append(version).append('\''); + sb.append(", annotation=").append(annotation); + sb.append('}'); + return sb.toString(); + } + + public String getId() { + return id; + } + + public Snp setId(String id) { + this.id = id; + return this; + } + + public String getChromosome() { + return chromosome; + } + + public Snp setChromosome(String chromosome) { + this.chromosome = chromosome; + return this; + } + + public int getPosition() { + return position; + } + + public Snp setPosition(int position) { + this.position = position; + return this; + } + + public String getReference() { + return reference; + } + + public Snp setReference(String reference) { + this.reference = reference; + return this; + } + + public List getAlternates() { + return alternates; + } + + public Snp setAlternates(List alternates) { + this.alternates = alternates; + return this; + } + + public String getType() { + return type; + } + + public Snp setType(String type) { + this.type = type; + return this; + } + + public String getSource() { + return source; + } + + public Snp setSource(String source) { + this.source = source; + return this; + } + + public String getVersion() { + return version; + } + + public Snp setVersion(String version) { + this.version = version; + return this; + } + + public SnpAnnotation getAnnotation() { + return annotation; + } + + public Snp setAnnotation(SnpAnnotation annotation) { + this.annotation = annotation; + return this; + } +} diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/core/SnpAnnotation.java b/biodata-models/src/main/java/org/opencb/biodata/models/core/SnpAnnotation.java new file mode 100644 index 00000000..16fab718 --- /dev/null +++ b/biodata-models/src/main/java/org/opencb/biodata/models/core/SnpAnnotation.java @@ -0,0 +1,79 @@ +/* + * + * + */ + +package org.opencb.biodata.models.core; + +import org.opencb.biodata.models.variant.avro.PopulationFrequency; + +import java.util.List; +import java.util.Map; + +public class SnpAnnotation { + + private List flags; + private String gene; + private List populationFrequencies; + private Map additionalAttributes; + + public SnpAnnotation() { + } + + public SnpAnnotation(List flags, String gene, List populationFrequencies, Map additionalAttributes) { + this.flags = flags; + this.gene = gene; + this.populationFrequencies = populationFrequencies; + this.additionalAttributes = additionalAttributes; + } + + public List getFlags() { + return flags; + } + + public SnpAnnotation setFlags(List flags) { + this.flags = flags; + return this; + } + + public String getGene() { + return gene; + } + + public SnpAnnotation setGene(String gene) { + this.gene = gene; + return this; + } + + public List getPopulationFrequencies() { + return populationFrequencies; + } + + public SnpAnnotation setPopulationFrequencies(List populationFrequencies) { + this.populationFrequencies = populationFrequencies; + return this; + } + + public Map getAdditionalAttributes() { + return additionalAttributes; + } + + public SnpAnnotation setAdditionalAttributes(Map additionalAttributes) { + this.additionalAttributes = additionalAttributes; + return this; + } +} diff --git a/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamManager.java b/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamManager.java index 895767e9..54b84cc0 100644 --- a/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamManager.java +++ b/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamManager.java @@ -49,6 +49,7 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -62,7 +63,7 @@ public class BamManager implements AutoCloseable { public static final int DEFAULT_WINDOW_SIZE = 1; public static final int MAX_NUM_RECORDS = 50000; - public static final int MAX_REGION_COVERAGE = 100000; + public static final int MAX_REGION_COVERAGE = 500000; public static final String COVERAGE_BIGWIG_EXTENSION = ".bw"; private Logger logger; @@ -191,7 +192,10 @@ public Path calculateBigWigCoverage(Path bigWigPath, int windowSize) throws IOEx return bigWigPath; } - + /** + * @deprecated (since getFileHeader().getTextHeader() is deprecated !) + */ + @Deprecated public String header() { return samReader.getFileHeader().getTextHeader(); } @@ -338,7 +342,7 @@ public List getChunks(Region region) { BAMIndex index = samReader.indexing().getIndex(); return index.getSpanOverlapping(sequenceIndex, start, end).getChunks(); } - return null; + return Collections.emptyList(); } public List getBreakpoints(Region region) throws IOException { @@ -378,7 +382,7 @@ public List getBreakpoints(Region region) throws IOException { } } } - return null; + return Collections.emptyList(); } /** @@ -445,7 +449,7 @@ public AlignmentGlobalStats stats(Region region, AlignmentFilters fil return calculateGlobalStats(iterator(region, filters, options)); } - private AlignmentGlobalStats calculateGlobalStats(BamIterator iterator) throws IOException { + private AlignmentGlobalStats calculateGlobalStats(BamIterator iterator) { AlignmentGlobalStats alignmentGlobalStats = new AlignmentGlobalStats(); SamRecordAlignmentGlobalStatsCalculator calculator = new SamRecordAlignmentGlobalStatsCalculator(); while (iterator.hasNext()) {