Skip to content

Commit

Permalink
remove Bio.Alphabe, verison bump
Browse files Browse the repository at this point in the history
  • Loading branch information
drewjbeh committed Jan 26, 2021
1 parent c792e02 commit 6b4d5dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
11 changes: 5 additions & 6 deletions build/lib/mimseq/ssAlign.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import subprocess, os, re
from Bio import AlignIO
from Bio.Alphabet import generic_rna
from collections import defaultdict, Counter
from itertools import groupby
from operator import itemgetter
Expand All @@ -23,7 +22,7 @@ def extraCCA():
# look for extra CCA's added spuriously that fall outside of canonical tRNA structure
# Seems to be a problem in certain sequences in mouse - either an artifact from gtRNAdb or tRNAScan, or CCA is genomically encoded for these tRNAs?
extra_cca = list()
stk = AlignIO.read(stkname, "stockholm", alphabet=generic_rna)
stk = AlignIO.read(stkname, "stockholm")
for record in stk:
if record.seq[-3:] == 'cca': #lowercase here indicates alignment issue to other clusters
extra_cca.append(record.name)
Expand All @@ -35,7 +34,7 @@ def extraCCA():
def tRNAclassifier(ungapped = False):

struct_dict = structureParser()
stk = AlignIO.read(stkname, "stockholm", alphabet=generic_rna,)
stk = AlignIO.read(stkname, "stockholm")

# Get canonical tRNA position numbering (cons_pos_list). Useful to retain cononical numbering of tRNA positions (i.e. anticodon at 34 - 36, m1A 58 etc...)
# Return list of characters with pos or '-'. To be used in all plots with positional data such as heatmaps for stops or modifications.
Expand Down Expand Up @@ -149,7 +148,7 @@ def tRNAclassifier_nogaps():
tRNA_struct = defaultdict(dict)

# Loop thorugh every tRNA in alignment and create dictionary entry for pos - structure information (1-based to match to mismatchTable from mmQuant)
stk = AlignIO.read(stkname, "stockholm", alphabet=generic_rna)
stk = AlignIO.read(stkname, "stockholm")
for record in stk:
tRNA = record.id
seq = record.seq
Expand Down Expand Up @@ -191,7 +190,7 @@ def clusterAnticodon(cons_anticodon, cluster):
# return anticodon position without gaps for specific cluster

bases = ["A", "C", "G", "U"]
stk = AlignIO.read(stkname, "stockholm", alphabet=generic_rna)
stk = AlignIO.read(stkname, "stockholm")
cluster_anticodon = list()
for record in stk:
if record.id == cluster:
Expand Down Expand Up @@ -219,7 +218,7 @@ def modContext(out):

upstream_dict = defaultdict(lambda: defaultdict(list))

stk = AlignIO.read(stkname, "stockholm", alphabet=generic_rna)
stk = AlignIO.read(stkname, "stockholm")
for record in stk:
gene = record.id
seq = record.seq
Expand Down
6 changes: 2 additions & 4 deletions build/lib/mimseq/tRNAtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio import Alphabet
from Bio.Blast.Applications import NcbiblastnCommandline
from Bio.Blast import NCBIXML
import re, copy, sys, os, shutil, subprocess, logging, glob
from pathlib import Path
import urllib.request
from collections import defaultdict
import pandas as pd
import requests
Expand Down Expand Up @@ -317,7 +315,7 @@ def modsToSNPIndex(gtRNAdb, tRNAscan_out, mitotRNAs, modifications_table, experi
nomatch_count += 1

# Build seqrecord list for writing
seq_records[str(seq)] = SeqRecord(Seq(tRNA_dict[seq]['sequence'].upper(), Alphabet.generic_dna), id = str(seq))
seq_records[str(seq)] = SeqRecord(Seq(tRNA_dict[seq]['sequence'].upper()), id = str(seq))

tRNAbed.write(seq + "\t0\t" + str(len(tRNA_dict[seq]['sequence'])) + "\t" + seq + "\t1000\t+\n" )

Expand Down Expand Up @@ -443,7 +441,7 @@ def modsToSNPIndex(gtRNAdb, tRNAscan_out, mitotRNAs, modifications_table, experi
centroids = SeqIO.parse(temp_dir + "all_centroids.fa", "fasta")
for centroid in centroids:
centroid.id = centroid.id.split(";")[0]
final_centroids[centroid.id] = SeqRecord(Seq(str(centroid.seq).upper(), Alphabet.generic_dna), id = centroid.id)
final_centroids[centroid.id] = SeqRecord(Seq(str(centroid.seq).upper()), id = centroid.id)

# read cluster files, get nonredudant set of mod positions of all members of a cluster, create snp_records for writing SNP index
cluster_pathlist = Path(temp_dir).glob("**/*_clusters.uc")
Expand Down
2 changes: 1 addition & 1 deletion mimseq/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.3"
__version__ = "0.3.1"

0 comments on commit 6b4d5dc

Please sign in to comment.