plugins/base2/net.sf.basedb.illumina/trunk/src/net/sf/basedb/illumina/filehandler/SnpCvsValidationAction.java

Code
Comments
Other
Rev Date Author Line
1385 02 Sep 11 martin 1 /**
1385 02 Sep 11 martin 2   $Id:
1385 02 Sep 11 martin 3
1385 02 Sep 11 martin 4   Copyright (C) 2011 Martin Svensson
1385 02 Sep 11 martin 5
1385 02 Sep 11 martin 6   This file is part of BASE - BioArray Software Environment.
1385 02 Sep 11 martin 7   Available at http://base.thep.lu.se/
1385 02 Sep 11 martin 8
1385 02 Sep 11 martin 9   BASE is free software; you can redistribute it and/or
1385 02 Sep 11 martin 10   modify it under the terms of the GNU General Public License
1385 02 Sep 11 martin 11   as published by the Free Software Foundation; either version 3
1385 02 Sep 11 martin 12   of the License, or (at your option) any later version.
1385 02 Sep 11 martin 13
1385 02 Sep 11 martin 14   BASE is distributed in the hope that it will be useful,
1385 02 Sep 11 martin 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
1385 02 Sep 11 martin 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1385 02 Sep 11 martin 17   GNU General Public License for more details.
1385 02 Sep 11 martin 18
1385 02 Sep 11 martin 19   You should have received a copy of the GNU General Public License
1385 02 Sep 11 martin 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
1385 02 Sep 11 martin 21 */
1385 02 Sep 11 martin 22 package net.sf.basedb.illumina.filehandler;
1385 02 Sep 11 martin 23
1385 02 Sep 11 martin 24 import net.sf.basedb.core.ArrayDesign;
1385 02 Sep 11 martin 25 import net.sf.basedb.core.DbControl;
1386 06 Sep 11 nicklas 26 import net.sf.basedb.core.FileSetMember;
1385 02 Sep 11 martin 27 import net.sf.basedb.core.InvalidDataException;
1385 02 Sep 11 martin 28 import net.sf.basedb.core.InvalidRelationException;
1385 02 Sep 11 martin 29 import net.sf.basedb.illumina.Illumina;
1385 02 Sep 11 martin 30 import net.sf.basedb.util.fileset.SingleFileValidationAction;
1385 02 Sep 11 martin 31
1385 02 Sep 11 martin 32 /**
1385 02 Sep 11 martin 33
1385 02 Sep 11 martin 34   @author Martin
1385 02 Sep 11 martin 35   @since 1.7
1385 02 Sep 11 martin 36   @base.modified $Date: 2011-05-06 14:09:13 +0200 (Fri, 06 May 2011) $ 
1385 02 Sep 11 martin 37 */
1385 02 Sep 11 martin 38 public class SnpCvsValidationAction
1385 02 Sep 11 martin 39   extends SingleFileValidationAction
1385 02 Sep 11 martin 40 {
1385 02 Sep 11 martin 41   
1385 02 Sep 11 martin 42   private final DbControl dc;
1385 02 Sep 11 martin 43   private final ArrayDesign design;
1385 02 Sep 11 martin 44   private final SnpCvsValidator validator;
1385 02 Sep 11 martin 45
1385 02 Sep 11 martin 46   public SnpCvsValidationAction(DbControl dc, ArrayDesign design)
1385 02 Sep 11 martin 47   {
1385 02 Sep 11 martin 48     super(Illumina.SNP_MANIFEST_FILE_ID);
1385 02 Sep 11 martin 49     this.dc = dc;
1385 02 Sep 11 martin 50     this.design = design;
1385 02 Sep 11 martin 51     this.validator = new SnpCvsValidator();
1385 02 Sep 11 martin 52   }  
1385 02 Sep 11 martin 53
1385 02 Sep 11 martin 54   @Override
1385 02 Sep 11 martin 55   public void resetMetadata() 
1385 02 Sep 11 martin 56   {
1385 02 Sep 11 martin 57     validator.resetMetadata(design);
1385 02 Sep 11 martin 58     
1385 02 Sep 11 martin 59   }
1385 02 Sep 11 martin 60
1385 02 Sep 11 martin 61   @Override
1385 02 Sep 11 martin 62   public void validateAndExtractMetadata() 
1385 02 Sep 11 martin 63     throws InvalidDataException, InvalidRelationException 
1385 02 Sep 11 martin 64   {
1386 06 Sep 11 nicklas 65     FileSetMember member = getAcceptedFile();
1386 06 Sep 11 nicklas 66     validator.copyMetaData(member.getFile(), design);
1385 02 Sep 11 martin 67   }
1385 02 Sep 11 martin 68
1385 02 Sep 11 martin 69 }