Search in sources :

Example 16 with FeatureQueryResult

use of org.nextprot.api.isoform.mapper.domain.FeatureQueryResult in project nextprot-api by calipho-sib.

the class IsoformMappingServiceTest method shouldPropagateVariantToAllValidIsoforms.

@Test
public void shouldPropagateVariantToAllValidIsoforms() throws Exception {
    FeatureQueryResult result = service.propagateFeature(new SingleFeatureQuery("SCN11A-p.Lys1710Thr", AnnotationCategory.VARIANT.getApiTypeName(), "NX_Q9UI33"));
    assertIsoformFeatureValid(result, "NX_Q9UI33-1", 1710, 1710, true);
    assertIsoformFeatureValid(result, "NX_Q9UI33-2", null, null, false);
    assertIsoformFeatureValid(result, "NX_Q9UI33-3", 1672, 1672, true);
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Example 17 with FeatureQueryResult

use of org.nextprot.api.isoform.mapper.domain.FeatureQueryResult in project nextprot-api by calipho-sib.

the class IsoformMappingServiceTest method shouldMap2IsoformsContainingLastAA.

@Test
public void shouldMap2IsoformsContainingLastAA() throws Exception {
    SingleFeatureQuery query = new SingleFeatureQuery("SDHD-p.*160Leuext*3", AnnotationCategory.VARIANT.getApiTypeName(), "");
    FeatureQueryResult result = service.propagateFeature(query);
    assertIsoformFeatureValid(result, "NX_O14521-1", 160, 160, true);
    assertIsoformFeatureValid(result, "NX_O14521-2", 121, 121, true);
    assertIsoformFeatureValid(result, "NX_O14521-3", null, null, false);
    assertIsoformFeatureValid(result, "NX_O14521-4", null, null, false);
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Example 18 with FeatureQueryResult

use of org.nextprot.api.isoform.mapper.domain.FeatureQueryResult in project nextprot-api by calipho-sib.

the class IsoformMappingServiceTest method shouldNotMapMet1_Lys144Deletion.

@Test
public void shouldNotMapMet1_Lys144Deletion() throws Exception {
    SingleFeatureQuery query = new SingleFeatureQuery("BARD1-p.Met1_Lys144del", AnnotationCategory.VARIANT.getApiTypeName(), "");
    FeatureQueryResult result = service.propagateFeature(query);
    assertIsoformFeatureValid(result, "NX_Q99728-1", 1, 144, true);
    assertIsoformFeatureValid(result, "NX_Q99728-2", null, null, false);
    assertIsoformFeatureValid(result, "NX_Q99728-3", null, null, false);
    assertIsoformFeatureValid(result, "NX_Q99728-4", null, null, false);
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Example 19 with FeatureQueryResult

use of org.nextprot.api.isoform.mapper.domain.FeatureQueryResult in project nextprot-api by calipho-sib.

the class IsoformMappingServiceTest method validateList.

private static void validateList(String filename, boolean tabSep, IsoformMappingService service) throws Exception {
    FileInputStream is = new FileInputStream(filename);
    BufferedReader br = new BufferedReader(new InputStreamReader(is));
    PrintWriter pw = new PrintWriter(Files.getNameWithoutExtension(filename) + "-results.tsv");
    List<String[]> twoFirstFieldsList = br.lines().map((tabSep) ? to2FirstTabFields : to2FirstCommaFields).collect(toList());
    pw.append("accession\tvariant\tvalid\terror message\n");
    for (String[] twoFields : twoFirstFieldsList) {
        String accession = twoFields[0];
        String feature = twoFields[1];
        FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery(feature, AnnotationCategory.VARIANT.getApiTypeName(), accession));
        pw.append(accession).append("\t").append(feature).append("\t").append(String.valueOf(result.isSuccess()));
        if (result.isSuccess()) {
            pw.append("\t");
        } else {
            FeatureQueryFailureImpl error = (FeatureQueryFailureImpl) result;
            pw.append("\t").append(error.getError().getMessage());
        }
        pw.append("\n");
    }
    pw.close();
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) FileInputStream(java.io.FileInputStream) FeatureQueryFailureImpl(org.nextprot.api.isoform.mapper.domain.impl.FeatureQueryFailureImpl) PrintWriter(java.io.PrintWriter)

Example 20 with FeatureQueryResult

use of org.nextprot.api.isoform.mapper.domain.FeatureQueryResult in project nextprot-api by calipho-sib.

the class IsoformMappingServiceTest method shouldValidateWithNoAccession.

@Test
public void shouldValidateWithNoAccession() throws Exception {
    FeatureQueryResult result = service.validateFeature(new SingleFeatureQuery("SCN11A-p.Leu1158Pro", AnnotationCategory.VARIANT.getApiTypeName(), ""));
    assertIsoformFeatureValid(result, "NX_Q9UI33-1", 1158, 1158, true);
}
Also used : FeatureQueryResult(org.nextprot.api.isoform.mapper.domain.FeatureQueryResult) SingleFeatureQuery(org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery) IsoformMappingBaseTest(org.nextprot.api.isoform.mapper.IsoformMappingBaseTest) Test(org.junit.Test)

Aggregations

FeatureQueryResult (org.nextprot.api.isoform.mapper.domain.FeatureQueryResult)33 SingleFeatureQuery (org.nextprot.api.isoform.mapper.domain.SingleFeatureQuery)33 Test (org.junit.Test)29 IsoformMappingBaseTest (org.nextprot.api.isoform.mapper.IsoformMappingBaseTest)29 FeatureQueryFailureImpl (org.nextprot.api.isoform.mapper.domain.impl.FeatureQueryFailureImpl)3 BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 InputStreamReader (java.io.InputStreamReader)1 PrintWriter (java.io.PrintWriter)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Function (java.util.function.Function)1 Ignore (org.junit.Ignore)1 AminoAcidCode (org.nextprot.api.commons.bio.AminoAcidCode)1 FeatureQueryFailure (org.nextprot.api.isoform.mapper.domain.FeatureQueryFailure)1 FeatureQuerySuccess (org.nextprot.api.isoform.mapper.domain.FeatureQuerySuccess)1 MultipleFeatureQuery (org.nextprot.api.isoform.mapper.domain.MultipleFeatureQuery)1