def test_srnabench(self): """testing reading seqbuster files function""" from mirtop.libs import logger logger.initialize_logger("test", True, True) logger = logger.getLogger(__name__) from mirtop.importer import srnabench annotate("data/examples/srnabench", srnabench.read_file, create=False)
def test_collapse(self): """testing GFF function""" from mirtop.libs import logger logger.initialize_logger("test", True, True) logger = logger.getLogger(__name__) from mirtop.bam import bam bam_fn = "data/aligments/collapsing-isomirs.sam" annotate(bam_fn, bam.read_bam) return True
def test_optimir(self): """testing reading optimir files function""" from mirtop.libs import logger logger.initialize_logger("test", True, True) logger = logger.getLogger(__name__) from mirtop.importer import optimir annotate("data/examples/optimir/synthetic_100_full.gff3", optimir.read_file, create=False)
def test_seqbuster(self): """testing reading seqbuster files function""" from mirtop.libs import logger logger.initialize_logger("test", True, True) logger = logger.getLogger(__name__) from mirtop.importer import seqbuster print("\nperfect\n") annotate("data/examples/seqbuster/reads20.mirna", seqbuster.read_file) print("\naddition\n") annotate("data/examples/seqbuster/readsAdd.mirna", seqbuster.read_file)
def test_prost(self): """testing reading prost files function""" from mirtop.libs import logger logger.initialize_logger("test", True, True) logger = logger.getLogger(__name__) from mirtop.mirna import fasta precursors = fasta.read_precursor("data/examples/annotate/hairpin.fa", "hsa") fn = "data/examples/prost/prost.example.txt" from mirtop.importer import prost reads = prost.read_file(fn, precursors, "miRBasev21", "data/examples/annotate/hsa.gff3") annotate("data/example/prost/prost.example.txt", reads, True)
def test_prost(self): """testing reading prost files function""" from mirtop.libs import logger logger.initialize_logger("test", True, True) logger = logger.getLogger(__name__) from mirtop.mirna import fasta precursors = fasta.read_precursor("data/examples/annotate/hairpin.fa", "hsa") fn = "data/examples/prost/prost.example.txt" from mirtop.importer import prost reads = prost.read_file( fn, precursors, "miRBasev21", "data/examples/annotate/hsa.gff3") annotate("data/example/prost/prost.example.txt", reads, True)
def test_alignment(self): """testing alignments function""" from mirtop.bam import bam from mirtop.gff.classgff import feature fns = { "let7-last1D.sam": { 56: "iso_add3p:1,iso_snv" }, "let7-1D.sam": { 5: "iso_snv,iso_3p:-5" }, "let7-last7M1I.sam": { 5: "iso_add3p:1,iso_snv_seed" }, "let7-middle1D.sam": { 5: "iso_snv_central_supp,iso_3p:-2" }, "let7-perfect.sam": { 5: "NA" }, "let7-triming.sam": { 5: "iso_3p:+2", 4: "iso_5p:-1", 6: "iso_5p:+1,iso_3p:-3" } } #import pdb; pdb.set_trace() for fn in fns: gff = annotate("data/aligments/%s" % fn, bam.read_bam) for pos in gff['hsa-let-7a-1']: f = feature(gff['hsa-let-7a-1'][pos][0][4]) if not set(f.attributes['Variant'].split(",")) == set( fns[fn][pos].split(",")): raise ValueError("Error in %s" % fn)
def test_keep_name(self): from mirtop.bam import bam line = annotate("data/aligments/let7-perfect.sam", bam.read_bam, keep_name=True) print(line) if line["hsa-let-7a-1"][5][0][4].find("seq_perfect_x2") < 0: raise ValueError("Keep name failed: %s" % line)
def test_alignment(self): """testing alignments function""" from mirtop.bam import bam print("\nlast1D\n") print(annotate("data/aligments/let7-last1D.sam", bam.read_bam)) # mirna TGAGGTAGTAGGTTGTATAGTT # seq AGAGGTAGTAGGTTGTA print("\n1D\n") print(annotate("data/aligments/let7-1D.sam", bam.read_bam)) # mirna TGAGGTAG-TAGGTTGTATAGTT # seq TGAGGTAGGTAGGTTGTATAGTTA print("\nlast7M1I\n") print(annotate("data/aligments/let7-last7M1I.sam", bam.read_bam)) # mirna TGAGGTAGTAGGTTGTATAGTT # seq TGAGGTAGTAGGTTGTA-AGT print("\nmiddle1D\n") print(annotate("data/aligments/let7-middle1D.sam", bam.read_bam)) # mirna TGAGGTAGTAGGTTGTATAGTT # seq TGAGGTAGTAGGTTGTATAGTT print("\nperfect\n") print(annotate("data/aligments/let7-perfect.sam", bam.read_bam)) # mirna TGAGGTAGTAGGTTGTATAGTT # seq TGAGGTAGTAGGTTGTATAG (3tt 3TT) print("\ntriming\n") print(annotate("data/aligments/let7-triming.sam", bam.read_bam))
def test_alignment_genomic(self): """testing alignments function""" from mirtop.bam import bam from mirtop.libs import logger logger.initialize_logger("test_read_files", True, True) # print(annotate("data/examples/annotate/hsa-let-7a-5ploss1_neg.sam", # bam.read_bam, # gtf="data/db/hsa.gff3", genomic=True)) print("\ngenomic\n") with make_workdir(): for example in [ "hsa-let-7a-nm", "hsa-let-7a-5ploss1", "hsa-let-7a-3ploss1", "hsa-let-7a-5ploss1_neg" ]: print( annotate("data/examples/annotate/%s.sam" % example, bam.read_bam, gtf="data/db/mirbase/hsa.gff3", genomic=True))