Search in sources :

Example 1 with SequenceType

use of ubic.gemma.model.genome.biosequence.SequenceType in project Gemma by PavlidisLab.

the class ProbeMapperImpl method determineStrandTreatment.

/**
 * It is assume that strand should only be used if the sequence type is AFFY_{PROBE,COLLAPSED,TARGET} or OLIGO. In
 * all other cases (ESTs etc) the strand is ignored.
 *
 * @return boolean indicating, essentially, if the sequence on the array is double-stranded.
 */
private boolean determineStrandTreatment(BlatResult blatResult) {
    boolean ignoreStrand = true;
    SequenceType type = blatResult.getQuerySequence().getType();
    if (type == null) {
        return true;
    }
    if (type.equals(SequenceType.OLIGO)) {
        ignoreStrand = false;
    } else if (type.equals(SequenceType.AFFY_COLLAPSED)) {
        ignoreStrand = false;
    } else if (type.equals(SequenceType.AFFY_PROBE)) {
        ignoreStrand = false;
    } else if (type.equals(SequenceType.AFFY_TARGET)) {
        ignoreStrand = false;
    }
    return ignoreStrand;
}
Also used : SequenceType(ubic.gemma.model.genome.biosequence.SequenceType)

Example 2 with SequenceType

use of ubic.gemma.model.genome.biosequence.SequenceType in project Gemma by PavlidisLab.

the class ArrayDesignSequenceAssociationCli method doWork.

@Override
protected Exception doWork(String[] args) {
    try {
        Exception err = this.processCommandLine(args);
        if (err != null)
            return err;
        // this is kind of an oddball function of this tool.
        if (this.hasOption('s')) {
            BioSequence updated = arrayDesignSequenceProcessingService.processSingleAccession(this.sequenceId, new String[] { "nt", "est_others", "est_human", "est_mouse" }, null, force);
            if (updated != null) {
                AbstractCLI.log.info("Updated or created " + updated);
            }
            return null;
        }
        for (ArrayDesign arrayDesign : this.arrayDesignsToProcess) {
            arrayDesign = this.thaw(arrayDesign);
            SequenceType sequenceTypeEn = SequenceType.fromString(sequenceType);
            if (sequenceTypeEn == null) {
                AbstractCLI.log.error("No sequenceType " + sequenceType + " found");
                this.bail(ErrorCode.INVALID_OPTION);
            }
            if (this.hasOption('f')) {
                try (InputStream sequenceFileIs = FileTools.getInputStreamFromPlainOrCompressedFile(sequenceFile)) {
                    if (sequenceFileIs == null) {
                        AbstractCLI.log.error("No file " + sequenceFile + " was readable");
                        this.bail(ErrorCode.INVALID_OPTION);
                        return null;
                    }
                    Taxon taxon = null;
                    if (this.hasOption('t')) {
                        taxon = taxonService.findByCommonName(this.taxonName);
                        if (taxon == null) {
                            throw new IllegalArgumentException("No taxon named " + taxonName);
                        }
                    }
                    AbstractCLI.log.info("Processing ArrayDesign...");
                    arrayDesignSequenceProcessingService.processArrayDesign(arrayDesign, sequenceFileIs, sequenceTypeEn, taxon);
                    this.audit(arrayDesign, "Sequences read from file: " + sequenceFile);
                }
            } else if (this.hasOption('i')) {
                try (InputStream idFileIs = FileTools.getInputStreamFromPlainOrCompressedFile(idFile)) {
                    if (idFileIs == null) {
                        AbstractCLI.log.error("No file " + idFile + " was readable");
                        this.bail(ErrorCode.INVALID_OPTION);
                    }
                    Taxon taxon = null;
                    if (this.hasOption('t')) {
                        taxon = taxonService.findByCommonName(this.taxonName);
                        if (taxon == null) {
                            throw new IllegalArgumentException("No taxon named " + taxonName);
                        }
                    }
                    AbstractCLI.log.info("Processing ArrayDesign...");
                    arrayDesignSequenceProcessingService.processArrayDesign(arrayDesign, idFileIs, new String[] { "nt", "est_others", "est_human", "est_mouse" }, null, taxon, force);
                    this.audit(arrayDesign, "Sequences identifiers from file: " + idFile);
                }
            } else {
                AbstractCLI.log.info("Retrieving sequences from BLAST databases");
                arrayDesignSequenceProcessingService.processArrayDesign(arrayDesign, new String[] { "nt", "est_others", "est_human", "est_mouse" }, null, force);
                this.audit(arrayDesign, "Sequence looked up from BLAST databases");
            }
        }
    } catch (Exception e) {
        AbstractCLI.log.error(e, e);
        return e;
    }
    return null;
}
Also used : BioSequence(ubic.gemma.model.genome.biosequence.BioSequence) ArrayDesign(ubic.gemma.model.expression.arrayDesign.ArrayDesign) InputStream(java.io.InputStream) Taxon(ubic.gemma.model.genome.Taxon) SequenceType(ubic.gemma.model.genome.biosequence.SequenceType)

Aggregations

SequenceType (ubic.gemma.model.genome.biosequence.SequenceType)2 InputStream (java.io.InputStream)1 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)1 Taxon (ubic.gemma.model.genome.Taxon)1 BioSequence (ubic.gemma.model.genome.biosequence.BioSequence)1