int s;
int sSize = selection.size();
- List<SequenceI> pepseqs = new ArrayList<SequenceI>();
+ List<SequenceI> pepseqs = new ArrayList<>();
for (s = 0; s < sSize; s++)
{
SequenceI newseq = translateCodingRegion(selection.get(s),
if (dnarefs != null)
{
// intersect with pep
- List<DBRefEntry> mappedrefs = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> mappedrefs = new ArrayList<>();
DBRefEntry[] refs = dna.getDBRefs();
for (int d = 0; d < refs.length; d++)
{
String seqstring, AlignedCodonFrame acf,
List<SequenceI> proteinSeqs)
{
- List<int[]> skip = new ArrayList<int[]>();
+ List<int[]> skip = new ArrayList<>();
int skipint[] = null;
ShiftList vismapping = new ShiftList(); // map from viscontigs to seqstring
// intervals
skip.add(skipint);
skipint = null;
}
- if (aa.equals("STOP"))
+ if (aa.equals(ResidueProperties.STOP))
{
aa = STOP_ASTERIX;
}
public AlignmentI reverseCdna(boolean complement)
{
int sSize = selection.size();
- List<SequenceI> reversed = new ArrayList<SequenceI>();
+ List<SequenceI> reversed = new ArrayList<>();
for (int s = 0; s < sSize; s++)
{
SequenceI newseq = reverseSequence(selection.get(s).getName(),
public static final int[] purinepyrimidineIndex;
- public static final Map<String, Integer> aa3Hash = new HashMap<String, Integer>();
+ public static final Map<String, Integer> aa3Hash = new HashMap<>();
- public static final Map<String, String> aa2Triplet = new HashMap<String, String>();
+ public static final Map<String, String> aa2Triplet = new HashMap<>();
- public static final Map<String, String> nucleotideName = new HashMap<String, String>();
+ public static final Map<String, String> nucleotideName = new HashMap<>();
// lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET)
- public static final Map<String, String> modifications = new HashMap<String, String>();
+ public static final Map<String, String> modifications = new HashMap<>();
static
{
* Color.white, // R Color.white, // Y Color.white, // N Color.white, // Gap
*/
- public static List<String> STOP = Arrays.asList("TGA", "TAA", "TAG");
+ public static String STOP = "STOP";
+
+ public static List<String> STOP_CODONS = Arrays.asList("TGA", "TAA", "TAG");
public static String START = "ATG";
/**
* Nucleotide Ambiguity Codes
*/
- public static final Map<String, String[]> ambiguityCodes = new Hashtable<String, String[]>();
+ public static final Map<String, String[]> ambiguityCodes = new Hashtable<>();
/**
* Codon triplets with additional symbols for unambiguous codons that include
* ambiguity codes
*/
- public static final Hashtable<String, String> codonHash2 = new Hashtable<String, String>();
+ public static final Hashtable<String, String> codonHash2 = new Hashtable<>();
/**
* all ambiguity codes for a given base
*/
- public final static Hashtable<String, List<String>> _ambiguityCodes = new Hashtable<String, List<String>>();
+ public final static Hashtable<String, List<String>> _ambiguityCodes = new Hashtable<>();
static
{
List<String> codesfor = _ambiguityCodes.get(r);
if (codesfor == null)
{
- _ambiguityCodes.put(r, codesfor = new ArrayList<String>());
+ _ambiguityCodes.put(r, codesfor = new ArrayList<>());
}
if (!codesfor.contains(acode.getKey()))
{
}
// Stores residue codes/names and colours and other things
- public static Map<String, Map<String, Integer>> propHash = new Hashtable<String, Map<String, Integer>>();
+ public static Map<String, Map<String, Integer>> propHash = new Hashtable<>();
- public static Map<String, Integer> hydrophobic = new Hashtable<String, Integer>();
+ public static Map<String, Integer> hydrophobic = new Hashtable<>();
- public static Map<String, Integer> polar = new Hashtable<String, Integer>();
+ public static Map<String, Integer> polar = new Hashtable<>();
- public static Map<String, Integer> small = new Hashtable<String, Integer>();
+ public static Map<String, Integer> small = new Hashtable<>();
- public static Map<String, Integer> positive = new Hashtable<String, Integer>();
+ public static Map<String, Integer> positive = new Hashtable<>();
- public static Map<String, Integer> negative = new Hashtable<String, Integer>();
+ public static Map<String, Integer> negative = new Hashtable<>();
- public static Map<String, Integer> charged = new Hashtable<String, Integer>();
+ public static Map<String, Integer> charged = new Hashtable<>();
- public static Map<String, Integer> aromatic = new Hashtable<String, Integer>();
+ public static Map<String, Integer> aromatic = new Hashtable<>();
- public static Map<String, Integer> aliphatic = new Hashtable<String, Integer>();
+ public static Map<String, Integer> aliphatic = new Hashtable<>();
- public static Map<String, Integer> tiny = new Hashtable<String, Integer>();
+ public static Map<String, Integer> tiny = new Hashtable<>();
- public static Map<String, Integer> proline = new Hashtable<String, Integer>();
+ public static Map<String, Integer> proline = new Hashtable<>();
static
{
String cdn = codonHash2.get(lccodon.toUpperCase());
if ("*".equals(cdn))
{
- return "STOP";
+ return STOP;
}
return cdn;
}
public static Hashtable<String, String> toDssp3State;
static
{
- toDssp3State = new Hashtable<String, String>();
+ toDssp3State = new Hashtable<>();
toDssp3State.put("H", "H");
toDssp3State.put("E", "E");
toDssp3State.put("C", " ");
// / cut here
public static void main(String[] args)
{
- Hashtable<String, Vector<String>> aaProps = new Hashtable<String, Vector<String>>();
+ Hashtable<String, Vector<String>> aaProps = new Hashtable<>();
System.out.println("my %aa = {");
// invert property hashes
for (String pname : propHash.keySet())
Vector<String> aprops = aaProps.get(rname);
if (aprops == null)
{
- aprops = new Vector<String>();
+ aprops = new Vector<>();
aaProps.put(rname, aprops);
}
Integer hasprop = phash.get(rname);
public static List<String> getResidues(boolean forNucleotide,
boolean includeAmbiguous)
{
- List<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<>();
if (forNucleotide)
{
for (String nuc : nucleotideName.keySet())
sf.links.get(0));
assertEquals(ensembl, sf.getFeatureGroup());
- // AAA -> TAA -> stop codon
- sf = sfs.get(1);
- assertEquals(1, sf.getBegin());
- assertEquals(1, sf.getEnd());
- assertEquals("nonsynonymous_variant", sf.getType());
- assertEquals("p.Lys1null", sf.getDescription()); // stop codon badly handled
- assertEquals("var3", sf.getValue("ID"));
- assertEquals("Bad", sf.getValue("clinical_significance"));
- assertEquals("ID=var3;clinical_significance=Bad", sf.getAttributes());
- assertEquals(1, sf.links.size());
- assertEquals(
- "p.Lys1null var3|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var3",
- sf.links.get(0));
- assertEquals(dbSnp, sf.getFeatureGroup());
-
// AAA -> CAA -> K/Q
- sf = sfs.get(2);
+ sf = sfs.get(1);
assertEquals(1, sf.getBegin());
assertEquals(1, sf.getEnd());
assertEquals("nonsynonymous_variant", sf.getType());
assertEquals(dbSnp, sf.getFeatureGroup());
// AAA -> GAA -> K/E
- sf = sfs.get(3);
+ sf = sfs.get(2);
assertEquals(1, sf.getBegin());
assertEquals(1, sf.getEnd());
assertEquals("nonsynonymous_variant", sf.getType());
sf.links.get(0));
assertEquals(ensembl, sf.getFeatureGroup());
+ // AAA -> TAA -> stop codon
+ sf = sfs.get(3);
+ assertEquals(1, sf.getBegin());
+ assertEquals(1, sf.getEnd());
+ assertEquals("stop_gained", sf.getType());
+ assertEquals("TAA", sf.getDescription());
+ assertEquals("var3", sf.getValue("ID"));
+ assertEquals("Bad", sf.getValue("clinical_significance"));
+ assertEquals("ID=var3;clinical_significance=Bad", sf.getAttributes());
+ assertEquals(1, sf.links.size());
+ assertEquals(
+ "TAA var3|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=var3",
+ sf.links.get(0));
+ assertEquals(dbSnp, sf.getFeatureGroup());
+
// AAA -> AAG synonymous
sf = sfs.get(4);
assertEquals(1, sf.getBegin());