import org.biojavax.SimpleNamespace;
import org.biojavax.bio.seq.RichLocation;
import org.junit.Test;

/**
 * This class will help test if GenbankLocationParser class can understand all
 * location or not.
 * @author dsheoran
 */
public class LocationParserTest {

    @Test
    public void testParseLocation() throws Exception {
        String[] location = new String[]{
            "467",
            "340..565",
            "<345..500",
            "<1..888",
            "(102.110)",
            "(23.45)..600",
            "(122.133)..(204.221)",
            "123^124",
            "145^177",
            "join(12..78,134..202)",
            "complement(1..23)",
            "complement(join(2691..4571,4918..5163)",
            "join(complement(4918..5163),complement(2691..4571))",
            "complement(34..(122.126))",
            "complement((122.126)..34)",
            "J00194:100..202",
            "(8298.8300)..10206",
            "join((8298.8300)..10206,1..855)"};
// join((8298.8300)..10206,1..855) new type of location found in genbank record
// with accession : M32882
        for (String loc : location) {
            RichLocation parseLocation =
                    org.biojavax.bio.seq.io.GenbankLocationParser.parseLocation(new SimpleNamespace("gb"), "Ad3232", loc);
            System.out.println(org.biojavax.bio.seq.io.GenbankLocationParser.writeLocation(parseLocation));
        }
    }
}

