use of io.repseq.core.GeneFeature in project mixcr by milaboratory.
the class JsonOverriderTest method testArray1.
@Test
public void testArray1() throws Exception {
CloneFactoryParameters factoryParameters = new CloneFactoryParameters(new VJCClonalAlignerParameters(0.3f, LinearGapAlignmentScoring.getNucleotideBLASTScoring(), 3), new VJCClonalAlignerParameters(0.4f, LinearGapAlignmentScoring.getNucleotideBLASTScoring(), 5), null, new DClonalAlignerParameters(0.85f, 30.0f, 3, AffineGapAlignmentScoring.getNucleotideBLASTScoring()));
CloneAssemblerParameters params = new CloneAssemblerParameters(new GeneFeature[] { GeneFeature.FR1, GeneFeature.CDR3 }, 12, QualityAggregationType.Average, new CloneClusteringParameters(2, 1, TreeSearchParameters.ONE_MISMATCH, new RelativeConcentrationFilter(1.0E-6)), factoryParameters, true, true, false, 0.4, true, (byte) 20, .8, "2of6", (byte) 15);
CloneAssemblerParameters override = JsonOverrider.override(params, CloneAssemblerParameters.class, "assemblingFeatures=[CDR1(-5,+6),CDR2]");
CloneAssemblerParameters expected = new CloneAssemblerParameters(new GeneFeature[] { new GeneFeature(GeneFeature.CDR1, -5, +6), GeneFeature.CDR2 }, 12, QualityAggregationType.Average, new CloneClusteringParameters(2, 1, TreeSearchParameters.ONE_MISMATCH, new RelativeConcentrationFilter(1.0E-6)), factoryParameters, true, true, false, 0.4, true, (byte) 20, .8, "2of6", (byte) 15);
Assert.assertEquals(expected, override);
}
use of io.repseq.core.GeneFeature in project mixcr by milaboratory.
the class JsonOverriderTest method test3.
@Test
public void test3() throws Exception {
GeneFeature jRegion = GeneFeature.parse("JRegion");
System.out.println(jRegion);
System.out.println(GeneFeature.encode(jRegion));
VDJCAlignerParameters params = VDJCParametersPresets.getByName("default");
Map<String, String> overrides = new HashMap<String, String>() {
{
put("vParameters.geneFeatureToAlign", "VTranscript");
}
};
Assert.assertNotNull(JsonOverrider.override(params, VDJCAlignerParameters.class, overrides));
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class ExportCloneSequencesAction method go.
@Override
public void go(ActionHelper helper) throws Exception {
Chains chains = params.getChains();
GeneFeature geneFeature = params.getGeneFeature();
RandomGenerator random = new Well19937c(1232434);
try (GRepertoireReader input = new GRepertoireReader(createBufferedReader(params.getInput()));
FastaWriter<NucleotideSequence> output = createSingleFastaWriter(params.getOutput())) {
List<DescriptionExtractor> extractors = params.getExtractors(input.getLibrary());
long i = 0;
for (GClone clone : CUtils.it(input)) {
int f = params.factor == null ? 1 : randomizedRound(clone.abundance * params.factor, random);
for (int j = 0; j < f; j++) for (Map.Entry<String, GGene> e : clone.genes.entrySet()) if (chains.contains(e.getKey())) {
StringBuilder descriptionLine = new StringBuilder("GClone");
for (DescriptionExtractor extractor : extractors) descriptionLine.append("|").append(extractor.extract(clone, e.getValue(), e.getKey()));
output.write(new FastaRecord<>(i++, descriptionLine.toString(), e.getValue().getFeature(geneFeature)));
}
}
}
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method testIntersection7.
@Test
public void testIntersection7() throws Exception {
GeneFeature f1, f2;
f1 = create(new int[] { 1, 5, 7, 9, 10, 12 }, new int[] { -2, 0, 1, -3, -2, 5 });
f2 = create(new int[] { 1, 5, 7, 9, 10, 12 }, new int[] { -3, 0, 1, -3, -2, 4 });
Assert.assertEquals(create(new int[] { 1, 5, 7, 9, 10, 12 }, new int[] { -2, 0, 1, -3, -2, 4 }), GeneFeature.intersection(f2, f1));
}
use of io.repseq.core.GeneFeature in project repseqio by repseqio.
the class GeneFeatureTest method test3_2.
@Test
public void test3_2() throws Exception {
GeneFeature f1 = new GeneFeature(createWithOffsets(1, 3, -2, 0), createWithOffsets(4, 5, -2, 4));
GeneFeature f2 = new GeneFeature(createWithOffsets(1, 3, -6, 0), createWithOffsets(4, 5, -2, 2));
assertEquals(f2, new GeneFeature(f1, -4, -2));
}
Aggregations