Package net.sf.picard.annotation

Examples of net.sf.picard.annotation.Gene


                throw new RuntimeException("No exons detected for transcript " + transcriptId);
            }


            String geneName = firstFeature.getAttribute(ATTR_NAME_GENE_ID);
            Gene gene = geneMap.get(geneName);
            if (gene == null) {
                gene = new Gene(firstFeature.getSequenceName(), transcriptStart, transcriptEnd,
                    !firstFeature.isPositiveStrand(), geneName  );
                geneMap.put(geneName, gene);
            }

            Gene.Transcript t = gene.addTranscript(transcriptId, transcriptStart, transcriptEnd,
                    transcriptStart, transcriptEnd, numExons);

            for (int i = 0; i < numExons; ++i ) {
                t.addExon(exonStarts[i], exonEnds[i]);
            }
View Full Code Here



    }

    public void addCoverage(String geneId, int startPos, int endPos) {
        Gene gene = geneMap.get(geneId);
        for (Gene.Transcript t : gene) {
            int[] coverage = transcriptCoverage.get(t);
            if (coverage == null) {
                coverage = new int[t.length()];
                transcriptCoverage.put(t, coverage);
View Full Code Here

    void createHelperMaps() {
        intronIntervalTreeMap =  new IntervalTreeMap<Integer>();
        int numIntrons = 0;

        for (Map.Entry<String,Gene> entry : geneMap.entrySet()) {
            Gene gene = entry.getValue();
            for (final Gene.Transcript tx : gene) {
                int numExons = tx.exons.length;
                if (numExons < 2) {
                    continue;
                }
                int[] breakCoords = new int[(numExons - 1)*2];
                int k = 0;

                if ( gene.isPositiveStrand() ) {
                    for (int i = 0; i < numExons; ++ i) {
                        Gene.Transcript.Exon e = tx.exons[i];
                        if (i == 0) {
                            breakCoords[k++] = e.end;
                        } else if ( i == numExons - 1) {
                            breakCoords[k++] = e.start;
                        } else {
                            breakCoords[k++] = e.start;
                            breakCoords[k++] = e.end;
                        }
                    }
                } else {
                    // make sure there is no problem with sorting
                    Arrays.sort(tx.exons, new Comparator<Gene.Transcript.Exon>() {
                        @Override
                        public int compare(Gene.Transcript.Exon e1, Gene.Transcript.Exon e2) {
                            return e1.start > e2.start ? -1 : 1;
                        }
                    });

                    for (int i = numExons - 1; i >= 0; -- i) {
                        Gene.Transcript.Exon e = tx.exons[i];
                        if (i == 0) {
                            breakCoords[k++] = e.start;
                        } else if ( i == numExons - 1) {
                            breakCoords[k++] = e.end;
                        } else {
                            breakCoords[k++] = e.start;
                            breakCoords[k++] = e.end;
                        }
                    }
                }

                for (int i = 0; i < breakCoords.length; i+=2) {
                    String chrName = gene.getSequence();
                    Interval intronInterval = new Interval(chrName, breakCoords[i], breakCoords[i+1]);
                    numIntrons++;
                    intronIntervalTreeMap.put(intronInterval, numIntrons);
                    junctionLocationMap.put(chrName, breakCoords[i],breakCoords[i+1]);
                }
View Full Code Here

TOP

Related Classes of net.sf.picard.annotation.Gene

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.