use of org.dash.valid.Sample in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class GenotypesApiController method submitGenotypes.
@Override
public ResponseEntity<Samples> submitGenotypes(@ApiParam(value = "Genotypes", required = true) @Valid @RequestBody Genotypes genotypes) {
List<Genotype> genotypeList = genotypes.getGenotype();
Samples samples = new Samples();
SampleData sampleData = null;
for (Genotype genotype : genotypeList) {
LinkageDisequilibriumGenotypeList linkedGLString = GLStringUtilities.inflateGenotypeList(genotype.getId(), genotype.getGlString(), null);
Sample sample = LinkageDisequilibriumAnalyzer.detectLinkages(linkedGLString);
sampleData = populateSwaggerObject(sample);
samples.addSampleItem(sampleData);
}
return ResponseEntity.ok(samples);
}
use of org.dash.valid.Sample in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class LinkageDisequilibriumAnalyzerTest method testLinkageReportingInlineGLString.
@Test
public void testLinkageReportingInlineGLString() throws IOException {
String fullyQualified = GLStringUtilities.fullyQualifyGLString("HLA-A*11:01:01+HLA-A*24:02:01:01/HLA-A*24:02:01:02L/HLA-A*24:02:01:03^HLA-B*18:01:01:01/HLA-B*18:01:01:02/HLA-B*18:51+HLA-B*53:01:01^HLA-C*04:01:01:01/HLA-C*04:01:01:02/HLA-C*04:01:01:03/HLA-C*04:01:01:04/HLA-C*04:01:01:05/HLA-C*04:20/HLA-C*04:117+HLA-C*12:03:01:01/HLA-C*12:03:01:02/HLA-C*12:34^HLA-DPA1*01:03:01:01/HLA-DPA1*01:03:01:02/HLA-DPA1*01:03:01:03/HLA-DPA1*01:03:01:04/HLA-DPA1*01:03:01:05+HLA-DPA1*02:01:01^HLA-DPB1*02:01:02+HLA-DPB1*09:01^HLA-DQA1*01:02:01:01/HLA-DQA1*01:02:01:02/HLA-DQA1*01:02:01:03/HLA-DQA1*01:02:01:04/HLA-DQA1*01:11+HLA-DQA1*03:01:01^HLA-DQB1*03:05:01+HLA-DQB1*06:09^HLA-DRB1*11:04:01+HLA-DRB1*13:02:01^HLA-DRB3*02:02:01:01/HLA-DRB3*02:02:01:02+HLA-DRB3*03:01:01");
MultilocusUnphasedGenotype mug = GLStringUtilities.convertToMug(fullyQualified);
Sample sample = LinkageDisequilibriumAnalyzer.detectLinkages(mug);
assertNotNull(sample);
}
use of org.dash.valid.Sample in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class LinkageDisequilibriumAnalyzerTest method testLinkageReportingMugs.
@Test
public void testLinkageReportingMugs() throws IOException {
List<LinkageDisequilibriumGenotypeList> glStrings = GLStringUtilities.readGLStringFile("fullyQualifiedExample.txt");
for (LinkageDisequilibriumGenotypeList linkedGLString : glStrings) {
MultilocusUnphasedGenotype mug = GLStringUtilities.convertToMug(linkedGLString.getGLString());
assertNotNull(mug);
Sample sample = LinkageDisequilibriumAnalyzer.detectLinkages(mug);
assertNotNull(sample);
}
}
use of org.dash.valid.Sample in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class ValidateLdGlstrings method read.
static ListMultimap<String, SubjectMug> read(final File file) throws IOException {
BufferedReader reader = null;
final ListMultimap<String, SubjectMug> subjectmugs = ArrayListMultimap.create();
final SubjectMug.Builder builder = SubjectMug.builder();
try {
reader = reader(file);
CharStreams.readLines(reader, new LineProcessor<Void>() {
private int count = 0;
@Override
public boolean processLine(final String line) throws IOException {
String[] tokens = line.split("\t");
if (tokens.length < 2) {
throw new IOException("illegal format, expected at least 2 columns, found " + tokens.length + "\nline=" + line);
}
String fullyQualified = GLStringUtilities.fullyQualifyGLString(tokens[1]);
MultilocusUnphasedGenotype mug = GLStringUtilities.convertToMug(fullyQualified);
Sample sample = LinkageDisequilibriumAnalyzer.detectLinkages(mug);
DetectedLinkageFindings findings = sample.getFindings();
Float minimumDifference = findings.getMinimumDifference(Locus.FIVE_LOCUS);
minimumDifference = minimumDifference == null ? 0 : minimumDifference;
SubjectMug subjectMug = builder.reset().withSample(tokens[0]).withGlstring(tokens[1]).withMug(mug).withFindings(findings).withMinimumDifference(minimumDifference).build();
subjectmugs.put(subjectMug.sample(), subjectMug);
count++;
return true;
}
@Override
public Void getResult() {
return null;
}
});
return subjectmugs;
} finally {
try {
reader.close();
} catch (Exception e) {
// ignore
}
}
}
use of org.dash.valid.Sample in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class LinkageDisequilibriumAnalyzerTest method testPhasedGenotypeList.
@Test
public void testPhasedGenotypeList() throws IOException {
System.setProperty(Frequencies.FREQUENCIES_PROPERTY, Frequencies.NMDP.getShortName());
String fullyQualified = GLStringUtilities.fullyQualifyGLString("HLA-A*24:02:01:01~HLA-C*04:01:01:06~HLA-B*35:02:01~HLA-DRB3*02:02:01:02~HLA-DRB1*11:01:01:01~HLA-DQA1*05:05:01:01/HLA-DQA1*05:05:01:02~HLA-DQB1*03:01:01:03~HLA-DPA1*01:03:01:01~HLA-DPB1*05:01:01+HLA-A*11:01:01:01~HLA-C*12:03:01:01~HLA-B*35:03:01~HLA-DRB3*02:02:01:01~HLA-DRB1*13:01:01:01/HLA-DRB1*13:01:01:02~HLA-DQA1*01:03:01:02~HLA-DQB1*06:03:01~HLA-DPA1*02:01:01:01~HLA-DPB1*13:01:01/HLA-DPB1*107:01");
LinkageDisequilibriumGenotypeList glString = new LinkageDisequilibriumGenotypeList("SBCFMW0003", fullyQualified);
List<Haplotype> knownHaplotypes = GLStringUtilities.buildHaplotypes(glString);
Sample sample = HLALinkageDisequilibrium.hasLinkageDisequilibrium(glString, knownHaplotypes);
assertNotNull(sample);
}
Aggregations