Skip to content

Commit

Permalink
Merge branch 'release/v2.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotin committed Jun 7, 2017
2 parents 42cc606 + cde31ce commit 45deae1
Show file tree
Hide file tree
Showing 22 changed files with 370 additions and 282 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@

MiXCR 2.1.3 ( 7 Jun 2017)
========================

-- Minimal thresholds added for V and J alignments in `extendAlignments`
-- `minimalNOverlap` in `assemblePartial` changed to `7`
-- Information on k-mer diversity added to alignPartial report file
-- Fix: MiXCR now correctly detects `*.fa` files as FASTA formatted
-- Detainls of V/J Extension during extendAlignments are now added to target description, and can
be retrieved using `-targetDescriptions` field in `exportAlignments`


MiXCR 2.1.2 (20 Apr 2017)
========================

Expand Down
33 changes: 30 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<groupId>com.milaboratory</groupId>
<artifactId>mixcr</artifactId>
<version>2.1.2</version>
<version>2.1.3</version>
<packaging>jar</packaging>
<name>MiXCR</name>

Expand All @@ -44,14 +44,14 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<milib.version>1.7.2</milib.version>
<milib.version>1.8</milib.version>
</properties>

<dependencies>
<dependency>
<groupId>io.repseq</groupId>
<artifactId>repseqio</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -102,6 +102,32 @@

<build>
<plugins>
<plugin>
<!-- Workaround maven not being able to set a property conditionally -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<exec executable="hostname" failonerror="false" outputproperty="hostname"/>
<condition property="hostname" value="unknown">
<not>
<isset property="hostname"/>
</not>
</condition>
</target>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
Expand All @@ -123,6 +149,7 @@
<configuration>
<properties>
<branch>${scmBranch}</branch>
<host>${hostname}</host>
</properties>
</configuration>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion repseqio
4 changes: 2 additions & 2 deletions src/main/java/com/milaboratory/mixcr/cli/ActionAlign.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public boolean printWarnings() {
}

public Chains getChains() {
return Util.parseLoci(chains);
return Chains.parse(chains);
}

public boolean getWriteAllResults() {
Expand All @@ -414,7 +414,7 @@ public SequenceReaderCloseable<? extends SequenceRead> createReader() throws IOE
return new PairedFastqReader(parameters.get(0), parameters.get(1), true);
else {
String[] s = parameters.get(0).split("\\.");
if (s[s.length - 1].equals("fasta"))
if (s[s.length - 1].equals("fasta") || s[s.length - 1].equals("fa"))
return new FastaSequenceReaderWrapper(
new FastaReader<>(parameters.get(0), NucleotideSequence.ALPHABET),
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ TLongHashSet getReadIds() {
}

public Chains getChain() {
return Util.parseLoci(chain);
return Chains.parse(chain);
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static final class AParameters extends ActionParameters {
public String csContain = null;

public Chains getChain() {
return Util.parseLoci(chain);
return Chains.parse(chain);
}

public Filter<Clone> getFilter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ public Chains getChains() {
if (!chains.equals("ALL"))
throw new ParameterException("Use -c without -l parameter.");
System.out.println("WARNING: using of -l (--loci) option is deprecated; use -c (--chains) instead.");
return Util.parseLoci(chains_legacy);
return Chains.parse(chains_legacy);
}
return Util.parseLoci(chains);
return Chains.parse(chains);
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void go(ActionHelper helper) throws Exception {
AlignmentExtender extender = new AlignmentExtender(parameters.getChains(), parameters.extensionQuality,
reader.getParameters().getVAlignerParameters().getParameters().getScoring(),
reader.getParameters().getJAlignerParameters().getParameters().getScoring(),
parameters.minimalVScore, parameters.minimalJScore,
ReferencePoint.parse(parameters.vAnchorPoint),
ReferencePoint.parse(parameters.jAnchorPoint));

Expand Down Expand Up @@ -89,14 +90,22 @@ private static final class ExtendCD3Parameters extends ActionParametersWithOutpu
names = {"-q", "--quality"})
public byte extensionQuality = 30;

@Parameter(description = "V extension anchor point",
@Parameter(description = "V extension anchor point.",
names = {"--v-anchor"})
public String vAnchorPoint = "CDR3Begin";

@Parameter(description = "J extension anchor point",
@Parameter(description = "J extension anchor point.",
names = {"--j-anchor"})
public String jAnchorPoint = "CDR3End";

@Parameter(description = "Minimal score of V alignment to perform left extension.",
names = {"--min-v-score"})
public int minimalVScore = 100;

@Parameter(description = "Minimal score of J alignment to perform right extension.",
names = {"--min-j-score"})
public int minimalJScore = 70;

private String getInput() {
return parameters.get(0);
}
Expand All @@ -106,7 +115,7 @@ private String getOutput() {
}

public Chains getChains() {
return Util.parseLoci(chains);
return Chains.parse(chains);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected List<String> getOutputFiles() {
}

public Chains getChains() {
return Util.parseLoci(chains);
return Chains.parse(chains);
}

public VDJCAlignmentsReader getInput() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.milaboratory.mixcr.basictypes.VDJCAlignmentsReader;
import com.milaboratory.mixcr.basictypes.VDJCAlignmentsWriter;
import com.milaboratory.mixcr.vdjaligners.VDJCAlignerParameters;
import com.milaboratory.util.ObjectSerializer;
import com.milaboratory.util.SmartProgressReporter;
import com.milaboratory.util.Sorter;
import com.milaboratory.util.TempFileManager;
Expand Down Expand Up @@ -70,7 +71,7 @@ public int compare(VDJCAlignments o1, VDJCAlignments o2) {
}
};

private static final class VDJCAlignmnetsSerializer implements Sorter.ObjectSerializer<VDJCAlignments> {
private static final class VDJCAlignmnetsSerializer implements ObjectSerializer<VDJCAlignments> {
final VDJCAlignerParameters parameters;
final List<VDJCGene> usedAlleles;

Expand Down
45 changes: 28 additions & 17 deletions src/main/java/com/milaboratory/mixcr/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,19 @@ public static void main(String... args) throws Exception {
new ActionSortAlignments());

// Adding version info callback
main.setVersionInfoCallback(new Runnable() {
@Override
public void run() {
System.err.print(
MiXCRVersionInfo.get().getVersionString(
MiXCRVersionInfo.OutputType.ToConsole));
System.err.println();
System.err.println("Library search path:");
for (VDJCLibraryRegistry.LibraryResolver resolvers : VDJCLibraryRegistry.getDefault()
.getLibraryResolvers()) {
if (resolvers instanceof VDJCLibraryRegistry.ClasspathLibraryResolver)
System.out.println("- built-in libraries");
if (resolvers instanceof VDJCLibraryRegistry.FolderLibraryResolver)
System.out.println("- " + ((VDJCLibraryRegistry.FolderLibraryResolver) resolvers).getPath());
}
}
});
main.setVersionInfoCallback(
new Runnable() {
@Override
public void run() {
printVersion(false);
}
},
new Runnable() {
@Override
public void run() {
printVersion(true);
}
});

// Executing main method
JCommanderBasedMain.ProcessResult processResult = main.main(args);
Expand All @@ -122,4 +118,19 @@ public void run() {
if (processResult == JCommanderBasedMain.ProcessResult.Error)
System.exit(1);
}

static void printVersion(boolean full) {
System.err.print(
MiXCRVersionInfo.get().getVersionString(
MiXCRVersionInfo.OutputType.ToConsole, full));
System.err.println();
System.err.println("Library search path:");
for (VDJCLibraryRegistry.LibraryResolver resolvers : VDJCLibraryRegistry.getDefault()
.getLibraryResolvers()) {
if (resolvers instanceof VDJCLibraryRegistry.ClasspathLibraryResolver)
System.out.println("- built-in libraries");
if (resolvers instanceof VDJCLibraryRegistry.FolderLibraryResolver)
System.out.println("- " + ((VDJCLibraryRegistry.FolderLibraryResolver) resolvers).getPath());
}
}
}
22 changes: 1 addition & 21 deletions src/main/java/com/milaboratory/mixcr/cli/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,7 @@ private Util() {
}

public static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("#.##");

public static Chains parseLoci(String lociString) {
String[] split = lociString.split(",");
Chains chains = new Chains();
for (String s : split)
chains = chains.merge(parseLocus(s));
return chains;
}

private static Chains parseLocus(String value) {
switch (value.toLowerCase().trim()) {
case "tcr":
return Chains.TCR;
case "ig":
return Chains.IG;
case "all":
return Chains.ALL;
}
return new Chains(value);
}


public static void writeReport(String input, String output,
String commandLineArguments,
String reportFileName,
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/milaboratory/mixcr/export/FieldExtractors.java
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,26 @@ protected String extract(VDJCAlignments object) {
}
});

descriptorsList.add(new PL_A("-targetDescriptions", "Export target descriptions", "Target descriptions", "targetDescriptions") {
@Override
protected String extract(VDJCAlignments object) {
String[] ds = object.getTargetDescriptions();
if (ds == null || ds.length == 0) {
char[] commas = new char[object.numberOfTargets() - 1];
Arrays.fill(commas, ',');
return new String(commas);
}
StringBuilder sb = new StringBuilder();
for (int i = 0; ; i++) {
sb.append(ds[i]);
if (i == ds.length - 1)
break;
sb.append(',');
}
return sb.toString();
}
});

descriptorsList.add(alignmentsToClone("-cloneId", "To which clone alignment was attached.", false));
descriptorsList.add(alignmentsToClone("-cloneIdWithMappingType", "To which clone alignment was attached with additional info on mapping type.", true));
descriptorsList.add(new AbstractField<Clone>(Clone.class, "-readIds", "Read IDs aggregated by clone.") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class PartialAlignmentsAssembler implements AutoCloseable, ReportWriter {
rightParts = new AtomicLong(),
noKMer = new AtomicLong(),
wildCardsInKMer = new AtomicLong(),
kMerDiversity = new AtomicLong(),
total = new AtomicLong(),
overlapped = new AtomicLong(),
totalWritten = new AtomicLong(),
Expand Down Expand Up @@ -468,6 +469,7 @@ public void writeReport(ReportHelper helper) {
helper.writePercentAndAbsoluteField("Alignments already with CDR3 (no overlapping is performed)", containsCDR3, total);
helper.writePercentAndAbsoluteField("Successfully overlapped alignments", overlapped, total);
helper.writePercentAndAbsoluteField("Left parts with too small N-region (failed to extract k-mer)", noKMer, total);
helper.writeField("Extracted k-mer diversity", kMerDiversity);
helper.writePercentAndAbsoluteField("Dropped due to wildcard in k-mer", wildCardsInKMer, total);
helper.writePercentAndAbsoluteField("Dropped due to too short NRegion parts in overlap", droppedSmallOverlapNRegion, total);
helper.writePercentAndAbsoluteField("Dropped overlaps with empty N region due to no complete NDN coverage", droppedNoNRegion, total);
Expand Down Expand Up @@ -553,8 +555,10 @@ private boolean addLeftToIndex(VDJCAlignments alignment) {
}

List<KMerInfo> ids = kToIndexLeft.get(kmer);
if (ids == null)
if (ids == null) {
kToIndexLeft.put(kmer, ids = new ArrayList<>(1));
kMerDiversity.incrementAndGet();
}
ids.add(new KMerInfo(alignment, kFrom, leftTargetId));
}

Expand All @@ -568,7 +572,7 @@ private static long kMer(NucleotideSequence seq, int from, int length) {
byte c = seq.codeAt(j);
if (NucleotideSequence.ALPHABET.isWildcard(c))
return -1;
kmer = (kmer << 2|c);
kmer = (kmer << 2 | c);
}
return kmer;
}
Expand Down
Loading

0 comments on commit 45deae1

Please sign in to comment.