Examples of DirectionalGenomicRegion


Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

protected static int side= 200;
   
    public GenerateSideRegion(GenomicRegionsBuilder gb)throws Exception{
        Iterator<GenomicRegion> it= gb.iterator();
        while(it.hasNext()){
            DirectionalGenomicRegion gr= (DirectionalGenomicRegion)it.next();
            DirectionalGenomicRegion gro;
            if(gr.isOnForwardStrand()){
                gro= new DirectionalGenomicRegion(gr.chr, gr.strand, (int)gr.high-side, (int)gr.high+side);
            }else{
                gro= new DirectionalGenomicRegion(gr.chr, gr.strand, (int)gr.low-side, (int)gr.low+side);
            }
            gro.setID(gr.getID());
            gro.setValue(gr.getValue());
            gbout.add(gro);
        }
    }
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

public void printOutput(ArrayList<String> ids)throws Exception {
    FrequencyCount<Character> fc= new FrequencyCount<>();

    for( int i=0; i<ids.size(); i++ ){
        String id = ids.get(i);
        DirectionalGenomicRegion gr= (DirectionalGenomicRegion) idReg.get(id);
        if(gr==null){
            continue;
        }
        GetSequenceFasta gs= chrGet.get(gr.chr);
        if(gs!=null){
            String seq= gs.getSequence(gr);
            if(gr.isOnReverseStrand()){
                seq= NucleotideSequenceParser.parseSequence(seq).complementary().toString();
            }
            for( int j=0; j<seq.length(); j++ ){
                fc.add(seq.charAt(j));
            }
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

   
   
private void init() throws RegionException{
   
    Iterator<GenomicRegion> it= gb.iterator();
    DirectionalGenomicRegion drp= (DirectionalGenomicRegion)it.next();
    addIntra(drp);
   
    DirectionalGenomicRegion dr= null;
    while(it.hasNext()){
        dr= (DirectionalGenomicRegion)it.next();
        addEnds(drp, dr);
        addIntra(dr);
        addInter(drp,dr);
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

}


protected void addIntra(DirectionalGenomicRegion gr){
    try{
        gbin.add(new DirectionalGenomicRegion(gr.chr, gr.strand, (int)(gr.low+side+1), (int)(gr.high-side-1)));
    }catch(RegionException re){}
}
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

            al= (int)( (dra.low+side + al)/2 )+1;
        }
        if((drb.high-side) < bh){
            bh= (int)( (drb.high-side + bh)/2 );
        }
        DirectionalGenomicRegion drll= new DirectionalGenomicRegion(dra.chr, dra.strand, al, a),
                drlh= new DirectionalGenomicRegion(dra.chr, dra.strand, a+1, ah),
                drrl = new DirectionalGenomicRegion(drb.chr, drb.strand, bl, b),
                drrh = new DirectionalGenomicRegion(drb.chr, drb.strand, b+1, bh);
       
        if(dra.isOnForwardStrand()){
            gbtup.add(drll);
            gbtdown.add(drlh);
        }else{
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

        for( int j=0; j<vs.length; j++ ){
            bw.write("\t"+ (double)Math.round(vs[j]*100)/100);
        }
        bw.write("\n");
        */
        DirectionalGenomicRegion dr= (DirectionalGenomicRegion)en.gr;
        boolean ifflip= dr.strand=='-';
        Vector vadd= new Vector(en.scores);
        if(ifflip){
            vadd= vadd.invert();
        }
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

    while(it.hasNext()){
        GenomicRegion gr= it.next();
        String seq= get.getSequence(gr);
        fe.appendEntry(new FastaEntry(gr.toUCSCFormat(), seq));
        String cseq = NucleotideSequenceParser.parseSequence(seq).complementary().toString();
        DirectionalGenomicRegion cgr= new DirectionalGenomicRegion(gr.chr, '-', (int)gr.low, (int)gr.high);
        fe.appendEntry(new FastaEntry( cgr.toUCSCFormat(), cseq));
    }
    fe.close();
}
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

            return Landscape2DBuffer.getLandscape(bufs, gr);
        }
    };
    ArrayList<LandscapeScoringResultEntry> rs= ls.getResultEntries();
    for( int i=0; i<rs.size() ; i++ ){
        DirectionalGenomicRegion gr= (DirectionalGenomicRegion)rs.get(i).gr;
        double[] vs= rs.get(i).scores;
        int mid= vs.length/2;
        int fl, fh, tl, th;
        if(gr.isOnForwardStrand()){
            fl=0;
            fh= mid- side;
            tl= mid+ side;
            th= vs.length-1;
        }else{
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

    String[] chrs= gb.getChromosomeList();
    for(int i=0; i<chrs.length ; i++){
        String chr= chrs[i];
        ArrayList<Region> regs= gb.getRegionsForChromosome(chr);
        for(int j=0; j<regs.size() ; j++){
            DirectionalGenomicRegion dr= (DirectionalGenomicRegion)regs.get(j);
            if(dr.isOnForwardStrand()){
                if( j== regs.size()-1 ){
                    dr.setValue(331);
                }else{
                    DirectionalGenomicRegion drn= (DirectionalGenomicRegion) regs.get(j+1);
                    if(drn.isOnForwardStrand()){
                        add(dr, drn, "35");
                    }else{
                        add(dr, drn, "33");
                    }
                }
            }else{
                if(j==0){
                    dr.setValue(331);
                }else{
                    DirectionalGenomicRegion drn= (DirectionalGenomicRegion) regs.get(j-1);
                    if(drn.isOnReverseStrand()){
                        add(dr, drn, "35");
                    }else{
                        add(dr, drn, "33");
                    }
                }
View Full Code Here

Examples of fork.lib.bio.anno.genomic.region.DirectionalGenomicRegion

    GenomicRegionsBuilder gb= new BedReader(f, brp).getGenomicRegionsBuilder();
    GenomicRegionsBuilder gbout= new GenomicRegionsBuilder();
   
    Iterator<GenomicRegion> it= gb.iterator();
    while(it.hasNext()){
        DirectionalGenomicRegion gr= (DirectionalGenomicRegion)it.next();
        String[] ss= ((BedAttribute)gr.attribute()).getOtherFields().get(0).split("/");
        if(ss.length>0){
            boolean ifas= false;
            for( int i=0; i<ss.length; i++ ){
                String s= ss[i];
                if(gr.isOnForwardStrand()){
                    if(s.equals("rev_-")){
                        ifas=true;
                        break;
                    }
                }else{
                    if(s.equals("for_+")){
                        ifas=true;
                        break;
                    }
                }
            }
           
            ((BedAttribute)gr.attribute()).setFieldOther(null);
            if(ifas){
                gr.setValue(-1);
                gbout.add(gr);
            }else{
                gr.setValue(0);
                gbout.add(gr);
            }
        }
    }
    BedExporterParam bep= new BedExporterParam();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.