use of com.github.lindenb.jvarkit.util.ucsc.KnownGene in project jvarkit by lindenb.
the class BackLocate method run.
private void run(PrintStream out, LineIterator in) throws IOException {
while (in.hasNext()) {
String line = in.next();
if (line.startsWith("#") || line.trim().isEmpty())
continue;
int n = line.indexOf('\t');
if (n == 0 || n == -1)
throw new IOException("Bad line. No tab found in " + line);
String geneName = line.substring(0, n).trim();
if (geneName.isEmpty())
throw new IOException("Bad line. No gene in " + geneName);
String mut = line.substring(n + 1).trim();
if (!mut.matches("[A-Za-z\\*][0-9]+[A-Za-z\\*]"))
throw new IOException("Bad mutation in " + line);
char aa1 = mut.substring(0, 1).toUpperCase().charAt(0);
char aa2 = mut.substring(mut.length() - 1).toUpperCase().charAt(0);
int position1 = Integer.parseInt(mut.substring(1, mut.length() - 1));
if (position1 == 0)
throw new IOException("Bad position in " + line);
Set<String> kgIds = this.geneSymbol2kg.get(geneName.toUpperCase());
if (kgIds == null || kgIds.isEmpty()) {
LOG.warn("No kgXref found for " + geneName);
continue;
}
for (String kgId : kgIds) {
KnownGene kg = this.knwonGenes.get(kgId);
if (kg == null)
continue;
backLocate(out, kg, geneName, aa1, aa2, position1);
}
}
}
use of com.github.lindenb.jvarkit.util.ucsc.KnownGene in project jvarkit by lindenb.
the class VcfDoest method overlap.
private List<KnownGene> overlap(final Interval interval) {
final List<KnownGene> genes = new ArrayList<>();
Iterator<KnownGene> iter = this.knownGenesTabix.iterator(interval);
while (iter.hasNext()) {
final KnownGene kg = iter.next();
if (kg.isNonCoding() && !this.keepNonCoding)
continue;
genes.add(kg);
}
return genes;
}
Aggregations