Skip to content

Commit

Permalink
use latest version of fermilite jni (#4622)
Browse files Browse the repository at this point in the history
  • Loading branch information
tedsharpe authored Apr 3, 2018
1 parent 9891cf3 commit 78c977c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 35 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ dependencies {
}

compile 'org.broadinstitute:gatk-bwamem-jni:1.0.4'
compile 'org.broadinstitute:gatk-fermilite-jni:1.1.0'
compile 'org.broadinstitute:gatk-fermilite-jni:1.2.0'

// Required for COSMIC Funcotator data source:
compile 'org.xerial:sqlite-jdbc:3.20.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public AlignedAssemblyOrExcuse apply( final Tuple2<Integer, List<SVFastqUtils.Fa
// record the assembly as a GFA, if requested
if ( fastqDir != null && writeGFAs ) {
final String gfaName = String.format("%s/%s.gfa", fastqDir, assemblyName);
try ( final OutputStream os = BucketUtils.createFile(gfaName) ) {
assembly.writeGFA(os);
try ( final Writer writer = new BufferedWriter(new OutputStreamWriter(BucketUtils.createFile(gfaName))) ) {
assembly.writeGFA(writer);
}
catch ( final IOException ioe ) {
throw new GATKException("Can't write "+gfaName, ioe);
Expand Down Expand Up @@ -137,7 +137,7 @@ static FermiLiteAssembly removeShadowedContigs( final FermiLiteAssembly assembly
}
});

/** Remove contigs that vary by a small number of SNVs from another contig. E.g.,
/* Remove contigs that vary by a small number of SNVs from another contig. E.g.,
* <-------contigA----------->
* ||x|||||x||||x|||
* <---contigB----->
Expand Down Expand Up @@ -241,15 +241,15 @@ static FermiLiteAssembly removeUnbranchedConnections( final FermiLiteAssembly as
if ( !examined.add(tig) ) return;
Connection conn;
Connection conn2;
while ( (conn = getSolePredecessor(tig)) != null &&
while ( (conn = tig.getSolePredecessor()) != null &&
!examined.contains(conn.getTarget()) &&
(conn2 = getSingletonConnection(conn.getTarget(), !conn.isTargetRC())) != null ) {
(conn2 = conn.getTarget().getSingletonConnection(!conn.isTargetRC())) != null ) {
examined.add(conn.getTarget());
tig = joinContigsWithConnections(tig, conn, conn2);
}
while ( (conn = getSoleSuccessor(tig)) != null &&
while ( (conn = tig.getSoleSuccessor()) != null &&
!examined.contains(conn.getTarget()) &&
(conn2 = getSingletonConnection(conn.getTarget(), !conn.isTargetRC())) != null ) {
(conn2 = conn.getTarget().getSingletonConnection(!conn.isTargetRC())) != null ) {
examined.add(conn.getTarget());
tig = joinContigsWithConnections(tig, conn, conn2);
}
Expand All @@ -258,25 +258,6 @@ static FermiLiteAssembly removeUnbranchedConnections( final FermiLiteAssembly as
return new FermiLiteAssembly(contigList);
}

private static Connection getSolePredecessor( final Contig contig ) {
return getSingletonConnection(contig, true);
}

private static Connection getSoleSuccessor( final Contig contig ) {
return getSingletonConnection(contig, false);
}

private static Connection getSingletonConnection( final Contig contig, final boolean isRC ) {
Connection singleton = null;
for ( Connection conn : contig.getConnections() ) {
if ( conn.isRC() == isRC ) {
if ( singleton != null ) return null; // found multiple connections, return null
singleton = conn;
}
}
return singleton;
}

// combine two connected contigs into one, preserving all their connections, except their connections to each other.
// (i.e., firstContig gets joined to connection.getTarget().) the connection argument is the pointer from
// firstContig to the 2nd contig, and rcConnection is the back-pointer from 2nd contig to firstContig.
Expand All @@ -292,8 +273,8 @@ private static Contig joinContigsWithConnections( final Contig firstContig,
final Connection newConnection =
new Connection(conn.getTarget(), conn.getOverlapLen(), true, conn.isTargetRC());
replaceConnection(conn.getTarget(),
rcConnection(firstContig, conn),
rcConnection(joinedContig, newConnection));
conn.rcConnection(firstContig),
newConnection.rcConnection(joinedContig));
connections.add(newConnection);
}
}
Expand All @@ -302,19 +283,15 @@ private static Contig joinContigsWithConnections( final Contig firstContig,
final Connection newConnection =
new Connection(conn.getTarget(), conn.getOverlapLen(), false, conn.isTargetRC());
replaceConnection(conn.getTarget(),
rcConnection(lastContig, conn),
rcConnection(joinedContig, newConnection));
conn.rcConnection(lastContig),
newConnection.rcConnection(joinedContig));
connections.add(newConnection);
}
}
joinedContig.setConnections(connections);
return joinedContig;
}

private static Connection rcConnection( final Contig contig, final Connection connection ) {
return new Connection(contig, connection.getOverlapLen(), !connection.isTargetRC(), !connection.isRC());
}

private static void replaceConnection( final Contig contig,
final Connection oldConnection,
final Connection newConnection ) {
Expand Down Expand Up @@ -486,6 +463,7 @@ private static final class ContigLocation {
private final Contig contig;
private final int offset;
private final boolean canonical;

public ContigLocation(final Contig contig, final int offset, final boolean canonical ) {
this.contig = contig;
this.offset = offset;
Expand Down

0 comments on commit 78c977c

Please sign in to comment.