001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 * Created on 01-21-2010 021 */ 022package org.biojava.nbio.core.sequence.features; 023 024import org.biojava.nbio.core.sequence.template.AbstractSequence; 025import org.biojava.nbio.core.sequence.template.Compound; 026 027import java.util.ArrayList; 028import java.util.List; 029 030/** 031 * DNA Sequences produced by modern sequencers usually have quality informaion 032 * attached to them. This feature allows to store the information directly in 033 * the DNASequence 034 * 035 * @since 3.0.3 036 * @author brandstaetter 037 */ 038public class QualityFeature<S extends AbstractSequence<C>, C extends Compound> extends AbstractFeature<S, C> { 039 040 private List<Number> qualities = new ArrayList<Number>(); 041 042 /** 043 * @param type 044 * @param source 045 */ 046 public QualityFeature(String type, String source) { 047 super(type, source); 048 } 049 050 /** 051 * @return the qualities 052 */ 053 public List<Number> getQualities() { 054 return qualities; 055 } 056 057 /** 058 * @param qualities the qualities to set 059 */ 060 public void setQualities(List<Number> qualities) { 061 this.qualities = qualities; 062 } 063 064 /** 065 * @param bioindex the biological index (starts with 1) 066 * @return the quality value at the given biological index (starts with 1) 067 */ 068 public Number getQualityAt(int bioindex) { 069 return qualities.get(bioindex - 1); 070 } 071 072 /** 073 * @param biostart biological start index (starts with 1) 074 * @param bioend biological end index (starts with 1) 075 * @return a sublist of the qualities between the given biological indices 076 */ 077 public List<Number> getQualities(int biostart, int bioend) { 078 return qualities.subList(biostart - 1, bioend - 1); 079 } 080}