Download react_code_bioagent_deepseek/runs/evolution_20260522_140917/tmpbe92vt4d.py from czty/BioOcto: direct link, hf CLI and curl.
- Browser
- Download file 1.88 kB
-
https://huggingface.co/datasets/czty/BioOcto/resolve/main/react_code_bioagent_deepseek/runs/evolution_20260522_140917/tmpbe92vt4d.py
- Command line
-
hf download hf://datasets/czty/BioOcto/react_code_bioagent_deepseek/runs/evolution_20260522_140917/tmpbe92vt4d.py
-
curl -L -o tmpbe92vt4d.py https://huggingface.co/datasets/czty/BioOcto/resolve/main/react_code_bioagent_deepseek/runs/evolution_20260522_140917/tmpbe92vt4d.py
1.88 kB
| import os | |
| os.chdir('/225040511/project/react_code_bioagent_deepseek/runs/evolution_20260522_140917') | |
| # Parse GFF for CDS features to create gene_annotations.csv | |
| cds_entries = [] | |
| with open('prokka_annotation/ecoli_ref.gff') as f: | |
| for line in f: | |
| if line.startswith('#'): | |
| continue | |
| parts = line.strip().split('\t') | |
| if len(parts) < 9: | |
| continue | |
| if parts[2] == 'CDS': | |
| seqid = parts[0] | |
| start = int(parts[3]) | |
| end = int(parts[4]) | |
| strand = parts[6] | |
| attrs = {} | |
| for attr in parts[8].split(';'): | |
| if '=' in attr: | |
| k, v = attr.split('=', 1) | |
| attrs[k] = v | |
| gene_id = attrs.get('ID', '') | |
| gene_name = attrs.get('gene', '') | |
| locus_tag = attrs.get('locus_tag', '') | |
| product = attrs.get('product', '') | |
| # Use gene name if available, otherwise locus_tag | |
| display_name = gene_name if gene_name else locus_tag | |
| cds_entries.append({ | |
| 'gene_id': display_name, | |
| 'seqid': seqid, | |
| 'start': start, | |
| 'end': end, | |
| 'strand': strand, | |
| 'product': product | |
| }) | |
| # Write gene_annotations.csv | |
| with open('gene_annotations.csv', 'w') as f: | |
| f.write('gene_id,seqid,start,end,strand,product\n') | |
| for entry in cds_entries: | |
| f.write(f"{entry['gene_id']},{entry['seqid']},{entry['start']},{entry['end']},{entry['strand']},{entry['product']}\n") | |
| print(f"Written gene_annotations.csv with {len(cds_entries)} CDS entries") | |
| print(f"File size: {os.path.getsize('gene_annotations.csv')} bytes") | |
| # Verify the variants_shared.csv | |
| print("\n=== variants_shared.csv ===") | |
| with open('variants_shared.csv') as f: | |
| print(f.read()) | |