Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide BiopythonDeprecationWarnings when reading certain sequence files #1729

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions augur/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def read_sequences(*fnames):
seqs = {}
try:
for fname in fnames:
for record in SeqIO.parse(fname, 'fasta'):
for record in SeqIO.parse(fname, 'fasta-pearson'):
if record.name in seqs and record.seq != seqs[record.name].seq:
raise AlignmentError("Detected duplicate input strains \"%s\" but the sequences are different." % record.name)
# if the same sequence then we can proceed (and we only take one)
Expand Down Expand Up @@ -240,7 +240,7 @@ def read_reference(ref_fname):
raise AlignmentError("ERROR: Cannot read reference sequence."
"\n\tmake sure the file \"%s\" exists"%ref_fname)
try:
ref_seq = SeqIO.read(ref_fname, 'genbank' if ref_fname.split('.')[-1] in ['gb', 'genbank'] else 'fasta')
ref_seq = SeqIO.read(ref_fname, 'genbank' if ref_fname.split('.')[-1] in ['gb', 'genbank'] else 'fasta-pearson')
except:
raise AlignmentError("ERROR: Cannot read reference sequence."
"\n\tmake sure the file %s contains one sequence in genbank or fasta format"%ref_fname)
Expand Down
2 changes: 1 addition & 1 deletion augur/ancestral.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def run(args):
aln = args.alignment
ref = None
if args.root_sequence:
for fmt in ['fasta', 'genbank']:
for fmt in ['fasta-pearson', 'genbank']:
try:
ref = str(SeqIO.read(args.root_sequence, fmt).seq).upper()
break
Expand Down
2 changes: 1 addition & 1 deletion augur/reconstruct_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def run(args):
if(is_vcf):
node_data["nodes"][root_node]['aa_sequences'] = {}
with open_file(args.vcf_aa_reference) as handle:
for record in SeqIO.parse(handle, "fasta"):
for record in SeqIO.parse(handle, "fasta-pearson"):
if record.id==args.gene:
#'root' may not be same as 'reference', so apply any mutations at root here!
node_data["nodes"][root_node]['aa_sequences'][record.id] = get_sequence(str(record.seq), node_data["nodes"][root_node]["aa_muts"][record.id])
Expand Down
2 changes: 1 addition & 1 deletion augur/sequence_traits.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def mutation_struct():
samps = header[sampLoc:]
nsamp = len(samps)

for refSeq in SeqIO.parse(ref_file, format='fasta'):
for refSeq in SeqIO.parse(ref_file, format='fasta-pearson'):
prots[refSeq.name]['reference'] = str(refSeq.seq)
posN = np.unique(prots[refSeq.name]['positions'])
prots[refSeq.name]['positions'] = list(posN)
Expand Down
Loading