arikat commited on
Commit
df5c4a7
1 Parent(s): 9f810ba

minor changes to headers

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -360,9 +360,9 @@ def mask_residue(sequence, position):
360
  return sequence[:position] + 'X' + sequence[position+1:]
361
 
362
  def generate_heatmap(protein_fasta):
363
- # Split the fasta string into header and sequence
364
- header, *sequence_parts = protein_fasta.split('\n')
365
- protein_sequence = ''.join(sequence_parts)
366
 
367
  # Check if the header is valid
368
  if not header.startswith('>'):
@@ -373,7 +373,6 @@ def generate_heatmap(protein_fasta):
373
  if not set(protein_sequence).issubset(valid_characters):
374
  return None, "Invalid protein sequence. It contains characters that are not one of the 20 standard amino acids.", None
375
 
376
-
377
  # Tokenize and predict for original sequence
378
  encoded_input = tokenizer([protein_sequence], padding=True, truncation=True, max_length=512, return_tensors="pt")
379
  with torch.no_grad():
 
360
  return sequence[:position] + 'X' + sequence[position+1:]
361
 
362
  def generate_heatmap(protein_fasta):
363
+ lines = protein_fasta.strip().split('\n')
364
+ header = lines[0]
365
+ protein_sequence = ''.join(lines[1:])
366
 
367
  # Check if the header is valid
368
  if not header.startswith('>'):
 
373
  if not set(protein_sequence).issubset(valid_characters):
374
  return None, "Invalid protein sequence. It contains characters that are not one of the 20 standard amino acids.", None
375
 
 
376
  # Tokenize and predict for original sequence
377
  encoded_input = tokenizer([protein_sequence], padding=True, truncation=True, max_length=512, return_tensors="pt")
378
  with torch.no_grad():