Search in sources :

Example 16 with HiCHitCollection

use of uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection in project SeqMonk by s-andrews.

the class PairedDataSet method getExportableReadsForChromosome.

public synchronized HiCHitCollection getExportableReadsForChromosome(Chromosome c) {
    if (!isFinalised)
        finalise();
    HiCHitCollection exportableReads = new HiCHitCollection(c.name());
    HiCHitCollection redundantReads = getHiCReadsForChromosome(c);
    String[] chrs = redundantReads.getChromosomeNamesWithHits();
    for (int i = 0; i < chrs.length; i++) {
        // The way we have to do this lookup is ugly, but that's how it is
        // We only include data for chromosomes the same or later than our own
        Chromosome thisChr = SeqMonkApplication.getInstance().dataCollection().genome().getChromosome(chrs[i]).chromosome();
        if (c.compareTo(thisChr) < 0) {
            System.err.println("Ignoring " + thisChr + " when exporting " + c);
            continue;
        }
        long[] source = redundantReads.getSourcePositionsForChromosome(chrs[i]);
        long[] hits = redundantReads.getHitPositionsForChromosome(chrs[i]);
        if (c != thisChr) {
            // Put everything from this chromosome into the results
            for (int j = 0; j < source.length; j++) {
                exportableReads.addHit(chrs[i], source[j], hits[j]);
            }
        } else {
            // Put only the entries where the hit is later than the source in
            for (int j = 0; j < source.length; j++) {
                if ((source[j] == hits[j] && j % 2 == 0) || SequenceRead.compare(source[j], hits[j]) >= 0) {
                    exportableReads.addHit(chrs[i], source[j], hits[j]);
                }
            }
        }
    }
    return exportableReads;
}
Also used : HiCHitCollection(uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection) Chromosome(uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome)

Example 17 with HiCHitCollection

use of uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection in project SeqMonk by s-andrews.

the class ReplicateSet method getHiCReadsForChromosome.

public HiCHitCollection getHiCReadsForChromosome(Chromosome c) {
    HiCHitCollection collection = new HiCHitCollection(c.name());
    for (int i = 0; i < dataStores.length; i++) {
        if (dataStores[i] instanceof HiCDataStore) {
            HiCHitCollection thisCollection = ((HiCDataStore) dataStores[i]).getHiCReadsForChromosome(c);
            collection.addCollection(thisCollection);
        }
    }
    collection.sortCollection();
    return collection;
}
Also used : HiCHitCollection(uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection)

Example 18 with HiCHitCollection

use of uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection in project SeqMonk by s-andrews.

the class ReplicateSet method getExportableReadsForChromosome.

public HiCHitCollection getExportableReadsForChromosome(Chromosome c) {
    HiCHitCollection collection = new HiCHitCollection(c.name());
    for (int i = 0; i < dataStores.length; i++) {
        if (dataStores[i] instanceof HiCDataStore) {
            HiCHitCollection thisCollection = ((HiCDataStore) dataStores[i]).getExportableReadsForChromosome(c);
            collection.addCollection(thisCollection);
        }
    }
    collection.sortCollection();
    return collection;
}
Also used : HiCHitCollection(uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection)

Example 19 with HiCHitCollection

use of uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection in project SeqMonk by s-andrews.

the class DataGroup method getHiCReadsForProbe.

public HiCHitCollection getHiCReadsForProbe(Probe p) {
    HiCHitCollection collection = new HiCHitCollection(p.chromosome().name());
    for (int i = 0; i < dataSets.length; i++) {
        if (dataSets[i] instanceof HiCDataStore) {
            HiCHitCollection thisCollection = ((HiCDataStore) dataSets[i]).getHiCReadsForProbe(p);
            collection.addCollection(thisCollection);
        }
    }
    // TODO: Do an incremental add to this collection so that we don't have
    // to re-sort it each time.  This is nastily inefficient
    collection.sortCollection();
    return collection;
}
Also used : HiCHitCollection(uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection)

Example 20 with HiCHitCollection

use of uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection in project SeqMonk by s-andrews.

the class DataGroup method getExportableReadsForChromosome.

public HiCHitCollection getExportableReadsForChromosome(Chromosome c) {
    HiCHitCollection collection = new HiCHitCollection(c.name());
    for (int i = 0; i < dataSets.length; i++) {
        if (dataSets[i] instanceof HiCDataStore) {
            HiCHitCollection thisCollection = ((HiCDataStore) dataSets[i]).getExportableReadsForChromosome(c);
            collection.addCollection(thisCollection);
        }
    }
    collection.sortCollection();
    return collection;
}
Also used : HiCHitCollection(uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection)

Aggregations

HiCHitCollection (uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection)21 Chromosome (uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome)7 HiCDataStore (uk.ac.babraham.SeqMonk.DataTypes.HiCDataStore)6 Probe (uk.ac.babraham.SeqMonk.DataTypes.Probes.Probe)6 SeqMonkException (uk.ac.babraham.SeqMonk.SeqMonkException)5 DataStore (uk.ac.babraham.SeqMonk.DataTypes.DataStore)3 ProgressListener (uk.ac.babraham.SeqMonk.DataTypes.ProgressListener)3 Vector (java.util.Vector)2 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 ObjectInputStream (java.io.ObjectInputStream)1 Hashtable (java.util.Hashtable)1 DataSet (uk.ac.babraham.SeqMonk.DataTypes.DataSet)1 Feature (uk.ac.babraham.SeqMonk.DataTypes.Genome.Feature)1 HiCInteractionStrengthCalculator (uk.ac.babraham.SeqMonk.DataTypes.Interaction.HiCInteractionStrengthCalculator)1 PairedDataSet (uk.ac.babraham.SeqMonk.DataTypes.PairedDataSet)1 ProbeList (uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList)1