Skip to content
Commits on Source (6)
# Created by .gitignore support plugin (hsz.mobi)
.idea/workspace.xml
/out/
test/data/out/
/build
/build_java9
/bin
......
language: java
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
jdk: openjdk10
install:
- ./gradlew -b build_java9.gradle assemble
script:
- ./gradlew -b build_java9.gradle check
- jdk_switcher use openjdk8
- ./gradlew compileJava
\ No newline at end of file
# igv
[![Build Status](https://travis-ci.org/igvteam/igv.svg?branch=master)](https://travis-ci.org/igvteam/igv)
Integrative Genomics Viewer - dekstop genome visualization tool for Mac, Windows, and Linux.
......
......@@ -179,6 +179,7 @@ tasks.withType(Test) {
systemProperties['include.longrunning'] = 'false'
systemProperties['ignore.ioexceptions'] = 'false'
maxHeapSize = '2000m'
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
task createDist(type: Copy, dependsOn: fullJar) {
......
......@@ -109,6 +109,7 @@ tasks.withType(Test) {
systemProperties['include.longrunning'] = 'false'
systemProperties['ignore.ioexceptions'] = 'false'
maxHeapSize = '2000m'
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
compileTestJava {
......
igv (2.4.17+dfsg-1) unstable; urgency=medium
* New upstream version
* debhelper 12
* Standards-Version: 4.3.0
-- Andreas Tille <tille@debian.org> Wed, 30 Jan 2019 14:45:04 +0100
igv (2.4.16+dfsg-1) unstable; urgency=medium
* New upstream version
......
......@@ -6,7 +6,7 @@ Section: non-free/science
XS-Autobuild: yes
Priority: optional
Build-Depends: default-jdk,
debhelper (>= 11~),
debhelper (>= 12~),
gradle-debian-helper,
junit4,
libbatik-java,
......@@ -41,7 +41,7 @@ Build-Depends: default-jdk,
libfest-util-java,
libfest-reflect-java,
ant
Standards-Version: 4.2.1
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/med-team/igv
Vcs-Git: https://salsa.debian.org/med-team/igv.git
Homepage: http://www.broadinstitute.org/igv/
......
......@@ -39,8 +39,8 @@
<!--<Resource name="COSMIC" resourceType="das" hyperlink="http://www.sanger.ac.uk/genetics/CGP/cosmic/"-->
<!--path="http://das.sanger.ac.uk/das/cosmic_mutations_GRCh37/features"-->
<!--trackLine="featureVisibilityWindow=0"/>-->
<Resource name="OMIM Genes" hyperlink="http://www.ncbi.nlm.nih.gov/omim"
url="http://www.ncbi.nlm.nih.gov/entrez/dispomim.cgi?id=$$"
<Resource name="OMIM Genes" hyperlink="https://omim.org/"
url=" https://omim.org/entry/$$"
path="http://www.broadinstitute.org/igvdata/annotations/hg19/phenotype/hg19_omim_genes.bed.gz"/>
<Resource name="GWAS Catalog" hyperlink="http://genome.ucsc.edu/cgi-bin/hgTrackUi?g=gwasCatalog"
url="http://genome.ucsc.edu/cgi-bin/hgc?g=gwasCatalog&amp;i=$$"
......
This diff is collapsed.
......@@ -101,7 +101,11 @@ public class GenomeManager {
private static Logger log = Logger.getLogger(GenomeManager.class);
private static final String ACT_USER_DEFINED_GENOME_LIST_FILE = "user-defined-genomes.txt";
public static final String TEST_USER_DEFINED_GENOME_LIST_FILE = "test-user-defined-genomes.txt";
// Tacking on a timestamp & random number to avoid file collisions with parallel testing JVMs. Not guaranteed unique
// but highly unlikely to be repeated.
public static final String TEST_USER_DEFINED_GENOME_LIST_FILE = "test-user-defined-genomes_" +
System.currentTimeMillis() + "_" + Math.random() + ".txt";
public static final GenomeListItem DEFAULT_GENOME = new GenomeListItem("Human hg19", "http://s3.amazonaws.com/igv.broadinstitute.org/genomes/hg19.genome", "hg19");
......
......@@ -49,7 +49,6 @@ public class FastaIndexedSequence implements Sequence {
final FastaIndex index;
final String path;
final long contentLength;
private final ArrayList<String> chromoNamesList;
......@@ -60,7 +59,6 @@ public class FastaIndexedSequence implements Sequence {
public FastaIndexedSequence(String path, String indexPath) throws IOException {
this.path = path;
contentLength = ParsingUtils.getContentLength(path);
if (indexPath == null) indexPath = path + ".fai";
......
......@@ -235,7 +235,7 @@ public class MAFIndex {
String species = src;
String chr = src;
if (src.contains(".")) {
String[] srcTokens = ParsingUtils.PERIOD_PATTERN.split(src);
String[] srcTokens = ParsingUtils.PERIOD_PATTERN.split(src, 2);
species = srcTokens[0];
chr = srcTokens[1];
}
......
......@@ -108,7 +108,7 @@ public class MAFParser implements MAFReader {
BufferedReader reader = new BufferedReader(new InputStreamReader(is), 256000);
List<MultipleAlignmentBlock> alignments = new ArrayList<MultipleAlignmentBlock>();
List<MultipleAlignmentBlock> alignments = new ArrayList<>();
String line;
while ((line = reader.readLine()) != null) {
......@@ -239,7 +239,7 @@ public class MAFParser implements MAFReader {
String species = src;
String chr = src;
if (src.contains(".")) {
String[] srcTokens = ParsingUtils.PERIOD_PATTERN.split(src);
String[] srcTokens = ParsingUtils.PERIOD_PATTERN.split(src, 2);
species = srcTokens[0];
chr = srcTokens[1];
}
......
......@@ -67,9 +67,9 @@ public class MAFRenderer {
double origin = context.getOrigin();
double locScale = context.getScale();
if (locScale > 1) {
return;
}
// if (locScale > 1) {
// return;
// }
for (MultipleAlignmentBlock.Gap gap : gaps) {
......@@ -110,10 +110,6 @@ public class MAFRenderer {
double origin = context.getOrigin();
double locScale = context.getScale();
if (locScale > 1) {
return;
}
double pixelStart = ((multipleAlignment.getStart() - origin) / locScale);
......@@ -122,7 +118,6 @@ public class MAFRenderer {
int y = (int) (trackRectangle.getY() + (trackRectangle.getHeight() - h) / 2);
Rectangle rect = new Rectangle((int) pixelStart, y, w, h);
if (locScale < 1) {
int pY = (int) rect.getY();
int dY = (int) rect.getHeight();
......@@ -161,21 +156,24 @@ public class MAFRenderer {
Color color = nucleotideColors.get(charToDraw);
if ((dX >= 8) && (dY >= 12) || charToDraw == '.') {
// Graphics2D gBackground = context.getGraphic2DForColor(background);
// gBackground.fillRect(pX0, pY, dX, dY);
if (charToDraw == '.') {
color = Color.LIGHT_GRAY;
} else if (color == null) {
color = Color.black;
}
g.setColor(color);
if(charToDraw == '-') {
g.fillRect(pX0 + 2, pY + 4, dX - 4, dY - 4);
}
else {
drawCenteredText(g, new char[]{charToDraw}, pX0, pY + 2, dX, dY - 2);
}
} else {
if (color != null) {
int wb = Math.max(1, dX - 1);
g.setColor(color);
g.fillRect(pX0, pY, dX - 1, dY);
g.fillRect(pX0, pY, wb, dY);
}
}
......@@ -195,7 +193,7 @@ public class MAFRenderer {
}
}
}
}
private void drawCenteredText(Graphics2D g, char[] chars, int x, int y,
......
......@@ -26,12 +26,10 @@
package org.broad.igv.maf;
import htsjdk.samtools.*;
import org.broad.igv.Globals;
import org.broad.igv.feature.genome.ChromosomeNameComparator;
import org.broad.igv.tools.sort.SAMSorter;
import org.broad.igv.tools.sort.Sorter;
import org.broad.igv.tools.sort.SorterFactory;
import org.broad.igv.util.ParsingUtils;
import java.io.*;
......@@ -69,7 +67,7 @@ public class MAFtoSAM {
public static void convert(String path, String outputPath, boolean noSATag) throws IOException {
File unsortedOutput = new File(outputPath + ".unsorted.sam");
File unsortedOutput = new File(outputPath + ".unsorted");
File outputFile = new File(outputPath);
BufferedReader reader = ParsingUtils.openBufferedReader(path);
......@@ -87,144 +85,12 @@ public class MAFtoSAM {
reader.close();
// Insert header and SA tags
addSATags(unsortedOutput, outputFile, sequenceDictionary);
addHeaderAndSort(unsortedOutput, outputFile, sequenceDictionary);
unsortedOutput.deleteOnExit();
}
private static void addSATags(File inputFile, File outputFile, Map<String, Integer> sequenceDictionary) throws IOException {
String groupedOutput = inputFile.getAbsolutePath() + ".grouped.sam";
Sorter sorter = SorterFactory.getSorter(inputFile, new File(groupedOutput));
sorter.setComparator(SAMSorter.ReadNameComparator);
sorter.run();
// Get Sam file reader, output header, then iterate through sam records combining those with like read names
BufferedReader reader = new BufferedReader(new FileReader(groupedOutput));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
outputHeader(sequenceDictionary, out);
String line;
String[] lastRecord = null;
List<String[]> chimericAlignments = new ArrayList<>();
// Records should now be sorted by read name
while ((line = reader.readLine()) != null) {
if (line.startsWith("@")) {
out.println(line);
} else {
String[] record = Globals.tabPattern.split(line);
if (lastRecord == null || lastRecord[0].equals(record[0])) {
chimericAlignments.add(record);
} else {
if (chimericAlignments.size() > 0) {
printChimericAlignments(out, chimericAlignments);
}
chimericAlignments.clear();
chimericAlignments.add(record);
}
lastRecord = record;
}
}
// Last one
if (chimericAlignments.size() > 0) {
printChimericAlignments(out, chimericAlignments);
}
out.flush();
out.close();
(new File(groupedOutput)).deleteOnExit();
}
private static void printChimericAlignments(PrintWriter out, List<String[]> chimericAlignments) {
if (chimericAlignments.size() == 1) {
// Not chimeric, just print
printRecord(out, chimericAlignments.get(0));
out.println();
} else {
// Mark all but one alignment in the list as primary
int primaryRecordIndex = 0;
int longestSequence = chimericAlignments.get(0)[9].length();
for(int i=1; i<chimericAlignments.size(); i++) {
String[] thisRecord = chimericAlignments.get(i);
int seqLength = thisRecord[9].length();
if(seqLength > longestSequence) {
longestSequence = seqLength;
primaryRecordIndex = i;
}
}
for(int i=0; i<chimericAlignments.size(); i++) {
if(i == primaryRecordIndex) continue;
String[] thisRecord = chimericAlignments.get(i);
thisRecord[1] = String.valueOf(Integer.parseInt(thisRecord[1]) | NOT_PRIMARY_ALIGNMENT_FLAG);
}
for (int i = 0; i < chimericAlignments.size(); i++) {
String[] thisRecord = chimericAlignments.get(i);
StringBuffer saTag = new StringBuffer("SA:Z:");
// Build up the SA string -- essentially a list of the other parts of this chmeric alignment.
for (int j = 0; j < chimericAlignments.size(); j++) {
if (j == i) continue;
String[] supRecord = chimericAlignments.get(j);
// This is fragile, but we control the order
String nm;
String nmString = supRecord[11];
if (nmString.startsWith("NM:i:")) {
nm = nmString.substring(5);
} else {
nm = "0";
}
boolean isNegativeStrand = (Integer.parseInt(supRecord[1]) & READ_STRAND_FLAG) != 0;
saTag.append(supRecord[2] + "," + supRecord[3] + "," + (isNegativeStrand ? "-," : "+,") +
supRecord[5] + "," + supRecord[4] + "," + nm + ";");
}
if (i > 0) {
int flags = Integer.parseInt(thisRecord[1]) | SUPPLEMENTARY_FLAG;
thisRecord[1] = Integer.toString(flags);
}
printRecord(out, thisRecord);
out.print("\t" + saTag.toString());
out.println();
}
}
}
private static void printRecord(PrintWriter out, String[] record) {
out.print(record[0]);
for (int i = 1; i < record.length; i++) {
out.print("\t" + record[i]);
}
}
private static void parseBlock(BufferedReader reader, PrintWriter out, Map<String, Integer> sequenceDictionary) throws IOException {
String line;
......@@ -253,13 +119,15 @@ public class MAFtoSAM {
}
if (line.startsWith("s")) {
if (null == referenceLine) {
referenceLine = parseSequenceLine(line);
refBytes = referenceLine.text.getBytes();
if (referenceLine.src.contains(".")) {
int idx = referenceLine.src.lastIndexOf('.') + 1;
chr = referenceLine.src.substring(idx);
String[] srcTokens = ParsingUtils.PERIOD_PATTERN.split(referenceLine.src, 2);
chr = srcTokens[1];
} else {
chr = referenceLine.src;
}
......@@ -267,6 +135,8 @@ public class MAFtoSAM {
} else {
queryLine = parseSequenceLine(line);
String[] srcTokens = ParsingUtils.PERIOD_PATTERN.split(queryLine.src, 2);
String species = srcTokens[0];
int flags = queryLine.strand == '+' ? 0 : 16;
......@@ -334,7 +204,7 @@ public class MAFtoSAM {
String qual = "*";
out.print(readName + "\t" + flags + "\t" + chr + "\t" + start + "\t" + mapq + "\t" + cigarString + "\t" +
rnext + "\t" + pnext + "\t" + tlen + "\t" + seq + "\t" + qual + "\tNM:i:" + nm);
rnext + "\t" + pnext + "\t" + tlen + "\t" + seq + "\t" + qual + "\tNM:i:" + nm + "\tRG:Z:" + species);
if (barcode != null) {
out.print("\tBC:Z:" + barcode);
}
......@@ -349,6 +219,32 @@ public class MAFtoSAM {
// Output SAN header
}
private static void addHeaderAndSort(File inputFile, File outputFile, Map<String, Integer> sequenceDictionary) throws IOException {
String sortedOutput = inputFile.getAbsolutePath() + ".sam";
Sorter sorter = new SAMSorter(inputFile, new File(sortedOutput));
sorter.run();
// Get Sam file reader, output header, then iterate through sam records combining those with like read names
BufferedReader reader = new BufferedReader(new FileReader(sortedOutput));
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
outputHeader(sequenceDictionary, out);
String line;
// Records should now be sorted by read name
while ((line = reader.readLine()) != null) {
out.println(line);
}
out.flush();
out.close();
}
private static void outputHeader(Map<String, Integer> sequenceDictionary, PrintWriter out) {
List<String> chrNames = new ArrayList<String>(sequenceDictionary.keySet());
......@@ -416,5 +312,7 @@ public class MAFtoSAM {
int srcSize;
String text;
}
}
......@@ -193,7 +193,7 @@ public class MultipleAlignmentTrack extends AbstractTrack {
if (frame.getScale() > 1) return true; // Zoomed out, nothing to pain
String chr = frame.getChrName();
int start = (int) frame.getOrigin();
int start = Math.max(0, (int) frame.getOrigin());
int end = (int) frame.getEnd();
return loadedAlignments != null && loadedAlignments.contains(chr, start, end);
}
......@@ -205,7 +205,7 @@ public class MultipleAlignmentTrack extends AbstractTrack {
double w = frame.getEnd() - origin;
// Get some buffer (+/- 1/2 screen)
String mafChr = chrMappings == null ? chr : chrMappings.get(chr);
String mafChr = chrMappings != null && chrMappings.containsKey(chr) ? chrMappings.get(chr) : chr;
int start = (int) Math.max(0, origin - w);
int end = (int) (origin + 2 * w);
......@@ -224,7 +224,7 @@ public class MultipleAlignmentTrack extends AbstractTrack {
double locScale = context.getScale();
if (locScale > 1) {
if (locScale > 10) {
Rectangle r = new Rectangle(rect);
if (visibleNameRect != null) {
r.y = visibleNameRect.y;
......@@ -243,7 +243,7 @@ public class MultipleAlignmentTrack extends AbstractTrack {
int end = (int) frame.getEnd();
List<MultipleAlignmentBlock> alignments = null;
if (loadedAlignments != null && loadedAlignments.contains(chr, start, end)) {
if (loadedAlignments != null && loadedAlignments.overlaps(chr, start, end)) {
alignments = loadedAlignments.getAlignments();
if (alignments != null) {
for (MultipleAlignmentBlock ma : alignments) {
......@@ -391,6 +391,9 @@ public class MultipleAlignmentTrack extends AbstractTrack {
boolean contains(String chr, int start, int end) {
return this.start <= start && this.end >= end && this.chr.equals(chr);
}
boolean overlaps(String chr, int start, int end) {
return this.start <= end && this.end >= start && this.chr.equals(chr);
}
public List<MultipleAlignmentBlock> getAlignments() {
return alignments;
......
......@@ -284,7 +284,8 @@ final public class Constants {
SAM_QUICK_CONSENSUS_MODE,
SAM_ALLELE_THRESHOLD,
SAM_FLAG_LARGE_INDELS,
SAM_LARGE_INDELS_THRESHOLD
SAM_LARGE_INDELS_THRESHOLD,
SAM_SHOW_INSERTION_MARKERS
);
}
......@@ -77,7 +77,7 @@ public class SequenceRenderer {
Color a = ColorUtilities.stringToColor(prefs.get(COLOR_A), new Color(0, 150, 0));
Color c = ColorUtilities.stringToColor(prefs.get(COLOR_C), Color.blue);
Color t = ColorUtilities.stringToColor(prefs.get(COLOR_T), Color.red);
Color g = ColorUtilities.stringToColor(prefs.get(COLOR_G), Color.gray);
Color g = ColorUtilities.stringToColor(prefs.get(COLOR_G), new Color(209,113,5));
Color n = ColorUtilities.stringToColor(prefs.get(COLOR_N), Color.gray);
nucleotideColors.put('A', a);
......
......@@ -459,14 +459,14 @@ public class AlignmentPacker {
}
case MOVIE: // group PacBio reads by movie
readNameParts = al.getReadName().split("/");
if (readNameParts.length != 3) {
if (readNameParts.length < 3) {
return "";
}
movieName = readNameParts[0];
return movieName;
case ZMW: // group PacBio reads by ZMW
readNameParts = al.getReadName().split("/");
if (readNameParts.length != 3) {
if (readNameParts.length < 3) {
return "";
}
movieName = readNameParts[0];
......