Ejemplo n.º 1
0
 def to_sam(self, fasta):
     """
     Prints items as SAM lines
     """
     s = []
     genome = GFFutils.Genome(fasta)
     for item in self.items:
         s.append(item.to_sam(genome))
     return ''.join(s)
Ejemplo n.º 2
0
 def to_fastq(self, fasta):
     """
     Creates sequences and fake quality scores.  Sequence names are the same
     as the GFFFeature.id.
     """
     genome = GFFutils.Genome(fasta)
     s = []
     for item in self.items:
         s.append(item.to_fastq(genome))
     return ''.join(s)
Ejemplo n.º 3
0
g10.parse(gene_models4)

gene_models5 = gene_models5.splitlines(True)
g11 = GenomeModel(chrom_start=1, scalar=5, read_length=3, debug=False)
g11.parse(gene_models5)

gene_models6 = gene_models6.splitlines(True)
g12 = GenomeModel(chrom='chr3R',
                  chrom_start=101,
                  scalar=5,
                  read_length=3,
                  debug=False)
g12.parse(gene_models6)

here = os.path.dirname(__file__)
genome = GFFutils.Genome(os.path.join(here, 'data/dm3.chr2L.oneline.fa'))


def feature_exists(genome_model_obj,
                   start,
                   stop,
                   featuretype,
                   chrom='chr2L',
                   strand='+'):
    # Checks to see if a feature exists.  Does not check names, only genomic
    # coords and featuretype
    for feature in genome_model_obj.features:
        if (feature.start == start) and (feature.stop == stop) \
           and (feature.chrom == chrom) and (feature.strand == strand) \
           and (feature.featuretype == featuretype):
            return True