supercat666 commited on
Commit
886edf2
1 Parent(s): f3fa8cc
Files changed (1) hide show
  1. cas9on.py +11 -9
cas9on.py CHANGED
@@ -126,27 +126,29 @@ def find_crispr_targets(sequence, chr, start, strand, transcript_id, pam="NGG",
126
  def process_gene(gene_symbol, model_path):
127
  transcripts = fetch_ensembl_transcripts(gene_symbol)
128
  all_data = []
129
- gene_sequence = '' # Initialize an empty string for the gene sequence
130
 
131
  if transcripts:
132
- cds_list = fetch_ensembl_cds(transcripts)
133
  for transcript in transcripts:
134
- transcript_id = transcript['id']
135
  chr = transcript.get('seq_region_name', 'unknown')
136
  start = transcript.get('start', 0)
137
  strand = transcript.get('strand', 'unknown')
138
- # Fetch the sequence here and concatenate if multiple transcripts
139
- gene_sequence += fetch_ensembl_sequence(transcript_id) or ''
140
- # Fetch exon and CDS information
141
  exons = fetch_ensembl_exons(transcript_id)
 
142
  if gene_sequence:
143
- gRNA_sites = find_crispr_targets(gene_sequence, chr, start, strand)
 
144
  if gRNA_sites:
145
  formatted_data = format_prediction_output(gRNA_sites, model_path)
146
  all_data.extend(formatted_data)
147
 
148
- # Return the data, fetched sequence, and possibly exon/CDS data
149
- return all_data, gene_sequence, exons, cds_list
 
150
 
151
  def create_genbank_features(formatted_data):
152
  features = []
 
126
  def process_gene(gene_symbol, model_path):
127
  transcripts = fetch_ensembl_transcripts(gene_symbol)
128
  all_data = []
 
129
 
130
  if transcripts:
131
+ cdslist = fetch_ensembl_cds(transcripts[0].get('id'))
132
  for transcript in transcripts:
133
+ transcript_id = transcript.get('id')
134
  chr = transcript.get('seq_region_name', 'unknown')
135
  start = transcript.get('start', 0)
136
  strand = transcript.get('strand', 'unknown')
137
+ # Fetch the gene sequence for each transcript
138
+ gene_sequence = fetch_ensembl_sequence(transcript_id) or ''
139
+ # Fetch exon and CDS information is not directly used here but you may need it elsewhere
140
  exons = fetch_ensembl_exons(transcript_id)
141
+
142
  if gene_sequence:
143
+ # Now correctly passing transcript_id as an argument
144
+ gRNA_sites = find_crispr_targets(gene_sequence, chr, start, strand, transcript_id)
145
  if gRNA_sites:
146
  formatted_data = format_prediction_output(gRNA_sites, model_path)
147
  all_data.extend(formatted_data)
148
 
149
+ # Return the data and potentially any other information as needed
150
+ return all_data, cdslist, exons
151
+
152
 
153
  def create_genbank_features(formatted_data):
154
  features = []