*/
public static AlignmentI expandContext(AlignmentI core, int flankSize)
{
- List<SequenceI> sq = new ArrayList<SequenceI>();
+ List<SequenceI> sq = new ArrayList<>();
int maxoffset = 0;
for (SequenceI s : core.getSequences())
{
public static Map<String, List<SequenceI>> getSequencesByName(
AlignmentI al)
{
- Map<String, List<SequenceI>> theMap = new LinkedHashMap<String, List<SequenceI>>();
+ Map<String, List<SequenceI>> theMap = new LinkedHashMap<>();
for (SequenceI seq : al.getSequences())
{
String name = seq.getName();
List<SequenceI> seqs = theMap.get(name);
if (seqs == null)
{
- seqs = new ArrayList<SequenceI>();
+ seqs = new ArrayList<>();
theMap.put(name, seqs);
}
seqs.add(seq);
return false;
}
- Set<SequenceI> mappedDna = new HashSet<SequenceI>();
- Set<SequenceI> mappedProtein = new HashSet<SequenceI>();
+ Set<SequenceI> mappedDna = new HashSet<>();
+ Set<SequenceI> mappedProtein = new HashSet<>();
/*
* First pass - map sequences where cross-references exist. This include
System.err.println("Wrong alignment type in alignProteinAsDna");
return 0;
}
- List<SequenceI> unmappedProtein = new ArrayList<SequenceI>();
+ List<SequenceI> unmappedProtein = new ArrayList<>();
Map<AlignedCodon, Map<SequenceI, AlignedCodon>> alignedCodons = buildCodonColumnsMap(
protein, dna, unmappedProtein);
return alignProteinAs(protein, alignedCodons, unmappedProtein);
* {dnaSequence, {proteinSequence, codonProduct}} at that position. The
* comparator keeps the codon positions ordered.
*/
- Map<AlignedCodon, Map<SequenceI, AlignedCodon>> alignedCodons = new TreeMap<AlignedCodon, Map<SequenceI, AlignedCodon>>(
+ Map<AlignedCodon, Map<SequenceI, AlignedCodon>> alignedCodons = new TreeMap<>(
new CodonComparator());
for (SequenceI dnaSeq : dna.getSequences())
// TODO delete this ugly hack once JAL-2022 is resolved
// i.e. we can model startPhase > 0 (incomplete start codon)
- List<SequenceI> sequencesChecked = new ArrayList<SequenceI>();
+ List<SequenceI> sequencesChecked = new ArrayList<>();
AlignedCodon lastCodon = null;
- Map<SequenceI, AlignedCodon> toAdd = new HashMap<SequenceI, AlignedCodon>();
+ Map<SequenceI, AlignedCodon> toAdd = new HashMap<>();
for (Entry<AlignedCodon, Map<SequenceI, AlignedCodon>> entry : alignedCodons
.entrySet())
Map<SequenceI, AlignedCodon> seqProduct = alignedCodons.get(codon);
if (seqProduct == null)
{
- seqProduct = new HashMap<SequenceI, AlignedCodon>();
+ seqProduct = new HashMap<>();
alignedCodons.put(codon, seqProduct);
}
seqProduct.put(protein, codon);
{
continue;
}
- final List<AlignmentAnnotation> result = new ArrayList<AlignmentAnnotation>();
+ final List<AlignmentAnnotation> result = new ArrayList<>();
for (AlignmentAnnotation dsann : datasetAnnotations)
{
/*
throw new IllegalArgumentException(
"IMPLEMENTATION ERROR: dataset.getDataset() must be null!");
}
- List<SequenceI> foundSeqs = new ArrayList<SequenceI>();
- List<SequenceI> cdsSeqs = new ArrayList<SequenceI>();
+ List<SequenceI> foundSeqs = new ArrayList<>();
+ List<SequenceI> cdsSeqs = new ArrayList<>();
List<AlignedCodonFrame> mappings = dataset.getCodonFrames();
HashSet<SequenceI> productSeqs = null;
if (products != null)
{
- productSeqs = new HashSet<SequenceI>();
+ productSeqs = new HashSet<>();
for (SequenceI seq : products)
{
productSeqs.add(seq.getDatasetSequence() == null ? seq
{
// gather direct refs from contig congrent with mapping
- List<DBRefEntry> direct = new ArrayList<DBRefEntry>();
- HashSet<String> directSources = new HashSet<String>();
+ List<DBRefEntry> direct = new ArrayList<>();
+ HashSet<String> directSources = new HashSet<>();
if (contig.getDBRefs() != null)
{
for (DBRefEntry dbr : contig.getDBRefs())
DBRefEntry[] onSource = DBRefUtils.selectRefs(
proteinProduct.getDBRefs(),
directSources.toArray(new String[0]));
- List<DBRefEntry> propagated = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> propagated = new ArrayList<>();
// and generate appropriate mappings
for (DBRefEntry cdsref : direct)
proteinStart++;
proteinLength--;
}
- List<int[]> proteinRange = new ArrayList<int[]>();
+ List<int[]> proteinRange = new ArrayList<>();
/*
* dna length should map to protein (or protein plus stop codon)
*/
public static List<int[]> findCdsPositions(SequenceI dnaSeq)
{
- List<int[]> result = new ArrayList<int[]>();
+ List<int[]> result = new ArrayList<>();
List<SequenceFeature> sfs = dnaSeq.getFeatures().getFeaturesByOntology(
SequenceOntologyI.CDS);
* map from peptide position to all variants of the codon which codes for it
* LinkedHashMap ensures we keep the peptide features in sequence order
*/
- LinkedHashMap<Integer, List<DnaVariant>[]> variants = new LinkedHashMap<Integer, List<DnaVariant>[]>();
+ LinkedHashMap<Integer, List<DnaVariant>[]> variants = new LinkedHashMap<>();
List<SequenceFeature> dnaFeatures = dnaSeq.getFeatures()
.getFeaturesByOntology(SequenceOntologyI.SEQUENCE_VARIANT);
if (codonVariants == null)
{
codonVariants = new ArrayList[CODON_LENGTH];
- codonVariants[0] = new ArrayList<DnaVariant>();
- codonVariants[1] = new ArrayList<DnaVariant>();
- codonVariants[2] = new ArrayList<DnaVariant>();
+ codonVariants[0] = new ArrayList<>();
+ codonVariants[1] = new ArrayList<>();
+ codonVariants[2] = new ArrayList<>();
variants.put(peptidePosition, codonVariants);
}
/*
* fancy case - aligning via mappings between sequences
*/
- List<SequenceI> unmapped = new ArrayList<SequenceI>();
+ List<SequenceI> unmapped = new ArrayList<>();
Map<Integer, Map<SequenceI, Character>> columnMap = buildMappedColumnsMap(
unaligned, aligned, unmapped);
int width = columnMap.size();
}
// map from dataset sequence to alignment sequence(s)
- Map<SequenceI, List<SequenceI>> alignedDatasets = new HashMap<SequenceI, List<SequenceI>>();
+ Map<SequenceI, List<SequenceI>> alignedDatasets = new HashMap<>();
for (SequenceI seq : aligned.getSequences())
{
SequenceI ds = seq.getDatasetSequence();
* {unalignedSequence, characterPerSequence} at that position.
* TreeMap keeps the entries in ascending column order.
*/
- SortedMap<Integer, Map<SequenceI, Character>> map = new TreeMap<Integer, Map<SequenceI, Character>>();
+ SortedMap<Integer, Map<SequenceI, Character>> map = new TreeMap<>();
/*
* record any sequences that have no mapping so can't be realigned
Map<SequenceI, Character> seqsMap = map.get(fromCol);
if (seqsMap == null)
{
- seqsMap = new HashMap<SequenceI, Character>();
+ seqsMap = new HashMap<>();
map.put(fromCol, seqsMap);
}
seqsMap.put(seq, seq.getCharAt(mappedCharPos - toStart));