コード例 #1
0
ファイル: RODRecordListImpl.java プロジェクト: mlovci/gatk
 public void add(GATKFeature record, boolean allowNameMismatch) {
   if (record != null) {
     if (!allowNameMismatch && !name.equals(record.getName()))
       throw new ReviewedStingException(
           "Attempt to add GATKFeature with non-matching name "
               + record.getName()
               + " to the track "
               + name);
   }
   records.add(record);
 }
コード例 #2
0
ファイル: RODRecordListImpl.java プロジェクト: mlovci/gatk
 /**
  * Fully qualified constructor: instantiates a new GATKFeatureRecordList object with specified
  * GATKFeature track name, location on the reference, and list of associated GATKFeatures. This is
  * a knee-deep COPY constructor: passed name, loc, and data element objects will be referenced
  * from the created GATKFeatureRecordList (so that changing them from outside will affect data in
  * this object), however, the data elements will be copied into a newly allocated list, so that
  * the 'data' collection argument can be modified afterwards without affecting the state of this
  * record list. WARNING: this constructor is (semi-)validating: passed name and location are
  * allowed to be nulls (although it maybe unsafe, use caution), but if they are not nulls, then
  * passed non-null GATKFeature data elements must have same track name, and their locations must
  * overlap with the passed 'location' argument. Null data elements or null 'data' collection
  * argument are allowed as well.
  *
  * @param name the name of the track
  * @param data the collection of features at this location
  * @param loc the location
  */
 public RODRecordListImpl(String name, Collection<GATKFeature> data, GenomeLoc loc) {
   this.records = new ArrayList<GATKFeature>(data == null ? 0 : data.size());
   this.name = name;
   this.location = loc;
   if (data == null || data.size() == 0) return; // empty dataset, nothing to do
   for (GATKFeature r : data) {
     records.add(r);
     if (r == null) continue;
     if (!this.name.equals(r.getName())) {
       throw new ReviewedStingException(
           "Attempt to add GATKFeature with non-matching name "
               + r.getName()
               + " to the track "
               + name);
     }
     if (location != null && !location.overlapsP(r.getLocation())) {
       throw new ReviewedStingException(
           "Attempt to add GATKFeature that lies outside of specified interval "
               + location
               + "; offending GATKFeature:\n"
               + r.toString());
     }
   }
 }