Search in sources :

Example 1 with MultilocusUnphasedGenotype

use of org.nmdp.gl.MultilocusUnphasedGenotype in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class GLStringUtilities method inflateGenotypeList.

private static LinkageDisequilibriumGenotypeList inflateGenotypeList(String id, String glString, String note) {
    LinkageDisequilibriumGenotypeList linkedGLString;
    String submittedGlString = glString;
    if (!GLStringUtilities.validateGLStringFormat(glString)) {
        glString = GLStringUtilities.fullyQualifyGLString(glString);
    }
    MultilocusUnphasedGenotype mug = GLStringUtilities.convertToMug(glString);
    linkedGLString = new LinkageDisequilibriumGenotypeList(id, mug);
    linkedGLString.setSubmittedGlString(submittedGlString);
    linkedGLString.setNote(note);
    return linkedGLString;
}
Also used : MultilocusUnphasedGenotype(org.nmdp.gl.MultilocusUnphasedGenotype)

Example 2 with MultilocusUnphasedGenotype

use of org.nmdp.gl.MultilocusUnphasedGenotype 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);
    }
}
Also used : LinkageDisequilibriumGenotypeList(org.dash.valid.gl.LinkageDisequilibriumGenotypeList) Sample(org.dash.valid.Sample) MultilocusUnphasedGenotype(org.nmdp.gl.MultilocusUnphasedGenotype) Test(org.junit.Test)

Example 3 with MultilocusUnphasedGenotype

use of org.nmdp.gl.MultilocusUnphasedGenotype 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);
}
Also used : Sample(org.dash.valid.Sample) MultilocusUnphasedGenotype(org.nmdp.gl.MultilocusUnphasedGenotype) Test(org.junit.Test)

Example 4 with MultilocusUnphasedGenotype

use of org.nmdp.gl.MultilocusUnphasedGenotype 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
        }
    }
}
Also used : Sample(org.dash.valid.Sample) MultilocusUnphasedGenotype(org.nmdp.gl.MultilocusUnphasedGenotype) IOException(java.io.IOException) IOException(java.io.IOException) CommandLineParseException(org.dishevelled.commandline.CommandLineParseException) DetectedLinkageFindings(org.dash.valid.report.DetectedLinkageFindings) BufferedReader(java.io.BufferedReader)

Example 5 with MultilocusUnphasedGenotype

use of org.nmdp.gl.MultilocusUnphasedGenotype in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class GLStringUtilities method convertToMug.

public static MultilocusUnphasedGenotype convertToMug(String glString) {
    MultilocusUnphasedGenotype mug = null;
    try {
        // TODO: should use strict but example GL Strings are missing intron
        // variants in some cases (HLA-DQB1*02:02)
        // GlClient glClient = LocalGlClient.createStrict();
        GlClient glClient = LocalGlClient.create();
        mug = glClient.createMultilocusUnphasedGenotype(glString);
    } catch (GlClientException e) {
        LOGGER.severe("Couldn't convert GLString to MultiLocusUnphasedGenotype");
        e.printStackTrace();
    }
    return mug;
}
Also used : MultilocusUnphasedGenotype(org.nmdp.gl.MultilocusUnphasedGenotype) GlClientException(org.nmdp.gl.client.GlClientException) LocalGlClient(org.nmdp.gl.client.local.LocalGlClient) GlClient(org.nmdp.gl.client.GlClient)

Aggregations

MultilocusUnphasedGenotype (org.nmdp.gl.MultilocusUnphasedGenotype)6 Sample (org.dash.valid.Sample)3 Test (org.junit.Test)3 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 LinkageDisequilibriumGenotypeList (org.dash.valid.gl.LinkageDisequilibriumGenotypeList)1 DetectedLinkageFindings (org.dash.valid.report.DetectedLinkageFindings)1 CommandLineParseException (org.dishevelled.commandline.CommandLineParseException)1 GlClient (org.nmdp.gl.client.GlClient)1 GlClientException (org.nmdp.gl.client.GlClientException)1 LocalGlClient (org.nmdp.gl.client.local.LocalGlClient)1