Skip to content

Commit

Permalink
Release 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotin committed Jun 16, 2015
1 parent 7ecd23f commit a368fba
Show file tree
Hide file tree
Showing 42 changed files with 283 additions and 54 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*.iml
mixcr.iml
target
.idea
29 changes: 29 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

MiXCR v1.2 (16 Jun 2015)
========================

-- new feature: added ability to export keep read descrptions in .vdjca file
(option '--save-description' for align command and options '-descrR1' and
'-descrR2' for exportAlignments command)
-- fixed crash caused by '-OcloneClusteringParameters=null'
-- bug with clonatype ordering in exportClones fixed
(occurred with '-OcloneClusteringParameters=null')



MiXCR v1.1 (29 Apr 2015)
========================

-- new feature: `exportAlignmentsPretty` action for exporting BLAST-style
alignments
-- adjust D-gene aligner parameters
-- various performance improvements
-- bash script support for OS X and Linux
-- migration to MiLib 1.0



MiXCR v1.0 (1 Jan 2015)
=======================

-- first release
2 changes: 1 addition & 1 deletion mixcr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fi

jar=""

for j in "$DIR/../jar/mixcr.jar" "$DIR/mixcr.jar" "$DIR/target/mixcr-1.1-distribution.jar"
for j in "$DIR/../jar/mixcr.jar" "$DIR/mixcr.jar" "$DIR/target/mixcr-1.2-distribution.jar"
do
if [[ -e "$j" ]];
then
Expand Down
17 changes: 13 additions & 4 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>1.1</version>
<version>1.2</version>
<packaging>jar</packaging>
<name>MiXCR</name>

Expand All @@ -46,19 +46,19 @@
<dependency>
<groupId>com.milaboratory</groupId>
<artifactId>milib</artifactId>
<version>1.0</version>
<version>1.0.1</version>
</dependency>

<dependency>
<groupId>com.milaboratory</groupId>
<artifactId>mitools</artifactId>
<version>1.0</version>
<version>1.0.1</version>
</dependency>

<dependency>
<groupId>com.milaboratory</groupId>
<artifactId>milib</artifactId>
<version>1.0</version>
<version>1.0.1</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -131,6 +131,15 @@
</configuration>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

import com.milaboratory.mixcr.reference.GeneFeature;

public abstract class AbstractClonalAlignerParameters<T extends AbstractClonalAlignerParameters<T>> {
public abstract class AbstractClonalAlignerParameters<T extends AbstractClonalAlignerParameters<T>>
implements java.io.Serializable {
protected float relativeMinScore;
protected GeneFeature featureToAlign;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public interface AlignmentsProvider {
*/
long getTotalNumberOfReads();

public final static class Util {
final class Util {
static AlignmentsProvider createProvider(final byte[] rawData, final AlleleResolver alleleResolver) {
return new VDJCAlignmentsReaderWrapper(new Factory<VDJCAlignmentsReader>() {
@Override
Expand Down
17 changes: 14 additions & 3 deletions src/main/java/com/milaboratory/mixcr/assembler/CloneAssembler.java
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,19 @@ void buildClones() {
Collection<CloneAccumulator> source;
if (clusteredClonesAccumulators != null)
source = clusteredClonesAccumulators;
else
source = clones.values();
else {
//sort clones by count (if not yet sorted by clustering)
CloneAccumulator[] sourceArray = clones.values().toArray(new CloneAccumulator[clones.size()]);
Arrays.sort(sourceArray, new Comparator<CloneAccumulator>() {
@Override
public int compare(CloneAccumulator o1, CloneAccumulator o2) {
return Long.compare(o2.count, o1.count);
}
});
for (int i = 0; i < sourceArray.length; i++)
sourceArray[i].setCloneIndex(i);
source = Arrays.asList(sourceArray);
}
realClones = new Clone[source.size()];
int i = 0;
Iterator<CloneAccumulator> iterator = source.iterator();
Expand All @@ -509,4 +520,4 @@ void buildClones() {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, isGetterVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.NONE)
public final class CloneAssemblerParameters {
public final class CloneAssemblerParameters implements java.io.Serializable {
private static final int MAX_MAPPING_REGION = 1000;
GeneFeature[] assemblingFeatures;
CloneClusteringParameters cloneClusteringParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, isGetterVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.NONE)
public final class CloneClusteringParameters {
public final class CloneClusteringParameters implements java.io.Serializable {
private int searchDepth;
private int allowedMutationsInNRegions;
private TreeSearchParameters searchParameters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.EnumMap;
import java.util.Map;

public final class CloneFactoryParameters {
public final class CloneFactoryParameters implements java.io.Serializable {
EnumMap<GeneType, VJCClonalAlignerParameters> vdcParameters = new EnumMap<>(GeneType.class);
DAlignerParameters dParameters;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
getterVisibility = JsonAutoDetect.Visibility.NONE)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonSubTypes({@JsonSubTypes.Type(value = RelativeConcentrationFilter.class, name = "relativeConcentration")})
public interface ClusteringFilter {
public interface ClusteringFilter extends java.io.Serializable {
boolean allow(Mutations<NucleotideSequence> mutations,
long majorClusterCount, long minorClusterCount,
ClonalSequence majorSequence);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@

@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, isGetterVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.NONE)
public final class DClonalAlignerParameters extends AbstractClonalAlignerParameters<DClonalAlignerParameters> {
public final class DClonalAlignerParameters extends AbstractClonalAlignerParameters<DClonalAlignerParameters>
implements java.io.Serializable {
AlignmentScoring<NucleotideSequence> scoring;

@JsonCreator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@

@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, isGetterVisibility = JsonAutoDetect.Visibility.NONE,
getterVisibility = JsonAutoDetect.Visibility.NONE)
public final class VJCClonalAlignerParameters extends AbstractClonalAlignerParameters<VJCClonalAlignerParameters> {
public final class VJCClonalAlignerParameters extends AbstractClonalAlignerParameters<VJCClonalAlignerParameters>
implements java.io.Serializable {
BandedAlignerParameters alignmentParameters;

@JsonCreator
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/milaboratory/mixcr/basictypes/IO.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public static class VDJCAlignmentsSerializer implements Serializer<VDJCAlignment
@Override
public void write(PrimitivO output, VDJCAlignments object) {
output.writeObject(object.targets);
output.writeObject(object.descriptions);
output.writeByte(object.hits.size());
for (Map.Entry<GeneType, VDJCHit[]> entry : object.hits.entrySet()) {
output.writeObject(entry.getKey());
Expand All @@ -91,13 +92,16 @@ public void write(PrimitivO output, VDJCAlignments object) {
@Override
public VDJCAlignments read(PrimitivI input) {
NSequenceWithQuality[] targets = input.readObject(NSequenceWithQuality[].class);
String[] descriptions = input.readObject(String[].class);
int size = input.readByte();
EnumMap<GeneType, VDJCHit[]> hits = new EnumMap<>(GeneType.class);
for (int i = 0; i < size; i++) {
GeneType key = input.readObject(GeneType.class);
hits.put(key, input.readObject(VDJCHit[].class));
}
return new VDJCAlignments(input.readLong(), hits, targets);
VDJCAlignments vdjcAlignments = new VDJCAlignments(input.readLong(), hits, targets);
vdjcAlignments.setDescriptions(descriptions);
return vdjcAlignments;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

@Serializable(by = IO.VDJCAlignmentsSerializer.class)
public final class VDJCAlignments extends VDJCObject {
String[] descriptions;
final long readId;
private volatile long alignmentsIndex = -1;

Expand Down Expand Up @@ -67,6 +68,14 @@ public void setAlignmentsIndex(long alignmentsIndex) {
this.alignmentsIndex = alignmentsIndex;
}

public void setDescriptions(String[] description) {
this.descriptions = description;
}

public String[] getDescriptions() {
return descriptions;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
import java.util.Arrays;
import java.util.List;

import static com.milaboratory.mixcr.basictypes.VDJCAlignmentsWriter.MAGIC_BYTES;
import static com.milaboratory.mixcr.basictypes.VDJCAlignmentsWriter.MAGIC_LENGTH;
import static com.milaboratory.mixcr.basictypes.VDJCAlignmentsWriter.*;

public class VDJCAlignmentsReader implements OutputPortCloseable<VDJCAlignments>, CanReportProgress {
VDJCAlignerParameters parameters;
Expand Down Expand Up @@ -80,7 +79,7 @@ public void init() {
byte[] magic = new byte[MAGIC_LENGTH];
input.readFully(magic);
if (!Arrays.equals(magic, MAGIC_BYTES))
throw new RuntimeException("Wrong file format.");
throw new RuntimeException("Conflicting file format; .vdjca file of version " + new String(magic) + " while you are running MiXCR " + MAGIC);

parameters = input.readObject(VDJCAlignerParameters.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.List;

public final class VDJCAlignmentsWriter implements AutoCloseable {
static final String MAGIC = "MiXCR.VDJC.V02";
static final String MAGIC = "MiXCR.VDJC.V03";
static final int MAGIC_LENGTH = 14;
static final byte[] MAGIC_BYTES = MAGIC.getBytes(StandardCharsets.US_ASCII);
final PrimitivO output;
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/com/milaboratory/mixcr/cli/ActionAlign.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ public long getIndex(VDJCAlignmentResult o) {
}))) {
if (result.alignment == null)
continue;
if (writer != null)
if (writer != null) {
if (actionParameters.saveReadDescription)
result.alignment.setDescriptions(extractDescription(result.read));
writer.write(result.alignment);
}
}
if (writer != null)
writer.setNumberOfProcessedReads(reader.getNumberOfReads());
Expand All @@ -123,6 +126,13 @@ public long getIndex(VDJCAlignmentResult o) {
helper.getCommandLineArguments(), actionParameters.report, report);
}

private static String[] extractDescription(SequenceRead r) {
String[] descrs = new String[r.numberOfReads()];
for (int i = 0; i < r.numberOfReads(); i++)
descrs[i] = r.getRead(i).getDescription();
return descrs;
}

@Override
public String command() {
return "align";
Expand Down Expand Up @@ -174,6 +184,11 @@ public static class AlignParameters extends ActionParametersWithOutput {
names = {"-d", "--noMerge"})
public Boolean noMerge = false;

@Parameter(description = "Copy read(s) description line from .fastq or .fasta to .vdjca file (can be then " +
"exported with -descrR1 and -descrR2 options in exportAlignments action).",
names = {"-a", "--save-description"})
public Boolean saveReadDescription = false;

public int getTaxonID() {
return Species.fromStringStrict(species);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/milaboratory/mixcr/cli/ActionExport.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void parseParameters(String[] args) {
params().parseParameters(args);
}

abstract void go0() throws Exception;
protected abstract void go0() throws Exception;

@Override
public ActionExportParameters params() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@

@Parameters(commandDescription = "Export binary data",
optionPrefixes = "^")
public final class ActionExportParameters extends ActionParameters {
public class ActionExportParameters extends ActionParameters {
final Class clazz;
final String helpString;
final String fieldsHelpString;
final String defaultPreset;

protected ActionExportParameters(Class clazz) {
public ActionExportParameters(Class clazz) {
this(clazz, "full");
}

public ActionExportParameters(Class clazz, String defaultPreset) {
this.defaultPreset = defaultPreset;
this.clazz = clazz;
ArrayList<String>[] description = new ArrayList[]{new ArrayList(), new ArrayList()};
description[0].add("-h, --help");
Expand Down Expand Up @@ -103,7 +109,7 @@ public final void parseParameters(String[] args) throws ParameterException {
throw new ParameterException("No output file specified.");

if (args.length == 2)
exporters = getPresetParameters(clazz, "full");
exporters = getPresetParameters(clazz, defaultPreset);
else
exporters = parseParametersString(clazz, args, 0, args.length - 2);

Expand Down
10 changes: 6 additions & 4 deletions src/main/java/com/milaboratory/mixcr/cli/JsonOverrider.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ private static boolean override1(JsonNode node, String path, String value, boole
boolean b = false;
if (override0(node, path, value))
b = true;
Iterator<JsonNode> iterator = node.iterator();
while (iterator.hasNext())
if (override1(iterator.next(), path, value, b || v))
b = true;
else {
Iterator<JsonNode> iterator = node.iterator();
while (iterator.hasNext())
if (override1(iterator.next(), path, value, b || v))
b = true;
}
if (v && b)
throw new IllegalArgumentException("Multiple matches of parameter " + path);
return b;
Expand Down
Loading

0 comments on commit a368fba

Please sign in to comment.