From 8f75d885195e4110c74e11f4c0eeda26c49da729 Mon Sep 17 00:00:00 2001 From: hanna Date: Wed, 22 Sep 2010 19:49:25 +0000 Subject: [PATCH] Fix for GATK run report ids: mOVsxGfDiiSMxVs2PPTVjzYTVbizlD6e f9kUHUADFsZ0LiTGxRL5zPmq9kZcA4cQ 8eGHWJFAlBVmgxwPi3sMd1RmiN2PwHOf iLhvHWveypKb2F8vKS5irHylc3pYvlOb HDttXKUMEVoPrvVeWrH7E0htxYyNydMx plus a bit of cleanup of custom exceptions in the sharding system. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4330 348d0f76-0448-11de-a6fe-93d51630548a --- .../simpleDataSources/SAMDataSource.java | 3 +- .../simpleDataSources/SimpleDataSource.java | 2 +- .../SimpleDataSourceLoadException.java | 39 --------------- .../SimpleDataSourceSplitException.java | 47 ------------------- .../SAMBAMDataSourceUnitTest.java | 13 ++--- 5 files changed, 10 insertions(+), 94 deletions(-) delete mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceLoadException.java delete mode 100644 java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceSplitException.java diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMDataSource.java b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMDataSource.java index 149468cb5..39c378124 100755 --- a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMDataSource.java +++ b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMDataSource.java @@ -113,7 +113,8 @@ public class SAMDataSource implements SimpleDataSource { readerIDs = reads.getSAMReaderIDs(); for (SAMReaderID readerID : reads.getSAMReaderIDs()) { if (!readerID.samFile.canRead()) - throw new SimpleDataSourceLoadException("SAMDataSource: Unable to load file: " + readerID.samFile.getName()); + throw new UserException.CouldNotReadInputFile(readerID.samFile,"file is not present or user does not have appropriate permissions. " + + "Please check that the file is present and readable and try again."); } resourcePool = new SAMResourcePool(Integer.MAX_VALUE); diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSource.java b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSource.java index af15f6eac..6d46b3623 100644 --- a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSource.java +++ b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSource.java @@ -32,6 +32,6 @@ public interface SimpleDataSource extends Serializable { * @param shard the region * @return an iterator of the appropriate type, that is limited by the region */ - public Iterator seek(Shard shard) throws SimpleDataSourceLoadException; + public Iterator seek(Shard shard); } diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceLoadException.java b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceLoadException.java deleted file mode 100644 index e890e6d3a..000000000 --- a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceLoadException.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.broadinstitute.sting.gatk.datasources.simpleDataSources; - -import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; - -/** - * - * User: aaron - * Date: Apr 6, 2009 - * Time: 4:21:58 PM - * - * The Broad Institute - * SOFTWARE COPYRIGHT NOTICE AGREEMENT - * This software and its documentation are copyright 2009 by the - * Broad Institute/Massachusetts Institute of Technology. All rights are reserved. - * - * This software is supplied without any warranty or guaranteed support whatsoever. Neither - * the Broad Institute nor MIT can be responsible for its use, misuse, or functionality. - * - */ - - -/** - * @author aaron - * @version 1.0 - * @date Apr 6, 2009 - *

- * Class SimpleDataSourceLoadException - *

- * Generate this on a simple data source load exception - */ -public class SimpleDataSourceLoadException extends ReviewedStingException { - public SimpleDataSourceLoadException(String msg) { - super(msg); - } - - public SimpleDataSourceLoadException(String msg,Throwable throwable) { - super(msg,throwable); - } -} diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceSplitException.java b/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceSplitException.java deleted file mode 100644 index d83bb4ce9..000000000 --- a/java/src/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SimpleDataSourceSplitException.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.broadinstitute.sting.gatk.datasources.simpleDataSources; - - - -import org.broadinstitute.sting.utils.exceptions.ReviewedStingException; - - -/* - * Copyright (c) 2009 The Broad Institute - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/** - * @author aaron - * @version 1.0 - * @date Apr 1, 2009 - *

- * Class SimpleDataSourceSplitFailure - *

- * an exception that get's thrown if we can't split up a data source appropriately - */ -public class SimpleDataSourceSplitException extends ReviewedStingException { - public SimpleDataSourceSplitException(String msg) { - super(msg); - } - -} diff --git a/java/test/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMBAMDataSourceUnitTest.java b/java/test/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMBAMDataSourceUnitTest.java index 085d60ae1..9d0e534c9 100755 --- a/java/test/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMBAMDataSourceUnitTest.java +++ b/java/test/org/broadinstitute/sting/gatk/datasources/simpleDataSources/SAMBAMDataSourceUnitTest.java @@ -11,6 +11,7 @@ import org.broadinstitute.sting.gatk.iterators.StingSAMIterator; import org.broadinstitute.sting.gatk.ReadProperties; import org.broadinstitute.sting.utils.GenomeLocParser; import org.broadinstitute.sting.utils.GenomeLoc; +import org.broadinstitute.sting.utils.exceptions.UserException; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -116,9 +117,9 @@ public class SAMBAMDataSourceUnitTest extends BaseTest { } } } - catch (SimpleDataSourceLoadException e) { + catch (UserException.CouldNotReadInputFile e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - fail("testLinearBreakIterateAll: We Should get a SimpleDataSourceLoadException"); + fail("testLinearBreakIterateAll: We Should get a UserException.CouldNotReadInputFile exception"); } } @@ -162,9 +163,9 @@ public class SAMBAMDataSourceUnitTest extends BaseTest { datum.close(); } } - catch (SimpleDataSourceLoadException e) { + catch (UserException.CouldNotReadInputFile e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - fail("testLinearBreakIterateAll: We Should get a SimpleDataSourceLoadException"); + fail("testLinearBreakIterateAll: We Should get a UserException.CouldNotReadInputFile exception"); } @@ -201,9 +202,9 @@ public class SAMBAMDataSourceUnitTest extends BaseTest { datum.close(); } } - catch (SimpleDataSourceLoadException e) { + catch (UserException.CouldNotReadInputFile e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - fail("testLinearBreakIterateAll: We Should get a SimpleDataSourceLoadException"); + fail("testLinearBreakIterateAll: We Should get a UserException.CouldNotReadInputFile exception"); } /*int pos = 0;