Long-read sequencing analysis for troubleshooting scmPRA PCR amplification. Aligns Plasmidsaurus reads to reference amplicons, characterizes contaminants, and quantifies R1-primer-flanked reads to diagnose PCR failures.
Conda env used: plasmidsaurus-align
Environment exports are committed under env/:
env/environment.plasmidsaurus-align.yml(portable conda spec)env/environment.plasmidsaurus-align.from-history.yml(minimal requested specs)env/environment.plasmidsaurus-align.lock.txt(conda --explicitlock-style spec)env/environment.plasmidsaurus-align.pip.txt(pip freeze)
Refresh these files after package changes:
scripts/export_env.sh plasmidsaurus-alignDriver script:
conda activate plasmidsaurus-align
scripts/run_alignment_pipeline.sh \
--sample <sample_id> \
--reads data/reads/<sample>.fastq.gz \
--reference-gb data/references/<ref>.gb \
--threads 4Non-activated shell alternative:
conda run -n plasmidsaurus-align bash scripts/run_alignment_pipeline.sh \
--sample <sample_id> \
--reads data/reads/<sample>.fastq.gz \
--reference-gb data/references/<ref>.gb \
--threads 4What it runs:
scripts/gb_to_fasta_and_bed.pyto convert GenBank to FASTA + BED feature intervals.minimap2index + alignment to BAM.samtools depth -aafor base-wise coverage.bedtools coveragefor raw per-feature overlap metrics.scripts/summarize_feature_coverage.pyfor feature-level summary table + mean-depth plot.scripts/plot_depth_with_features.pyfor depth line plot with annotation tracks.
Outputs:
results/<sample>/<sample>.bamand.bam.bairesults/<sample>/<sample>.flagstat.txtresults/<sample>/<sample>.depth.tsvresults/<sample>/<sample>.feature_coverage.raw.tsvresults/<sample>/<sample>.feature_coverage.summary.tsvresults/<sample>/<sample>.depth_with_features.pngresults/<sample>/<sample>.feature_mean_depth.png
This workflow aligns each read to a human transcriptome reference and calls whether the read is "explained as human RNA cDNA".
Definition (default):
best_query_cov >= 0.50best_identity >= 0.80
This is transcriptome-only by design (not a genome alignment workflow).
conda run -n plasmidsaurus-align bash scripts/fetch_human_transcriptome_refs.sh --release v48Outputs:
data/human_refs/v48/human_transcripts.fa.gzdata/human_refs/v48/human_transcripts.fadata/human_refs/v48/human_transcripts.mmidata/human_refs/v48/REFERENCE_INFO.tsv
conda run -n plasmidsaurus-align python scripts/quantify_human_cdna_explained.py \
--reads data/reads/<sample>.fastq \
--ref-mmi data/human_refs/v48/human_transcripts.mmi \
--threads 8 \
--min-query-cov 0.50 \
--min-identity 0.80 \
--out-prefix results/<sample>/human_cdna_explainabilityPrimary outputs:
results/.../human_cdna_explainability.summary.tsvresults/.../human_cdna_explainability.length_binned.tsvresults/.../human_cdna_explainability.top_targets.tsvresults/.../human_cdna_explainability.threshold_grid.tsvresults/.../human_cdna_explainability.identity_hist.tsvresults/.../human_cdna_explainability.query_cov_hist.tsvresults/.../human_cdna_explainability.alignment.paf.gz- optional detailed table:
results/.../human_cdna_explainability.per_read.tsv
Required columns in per_read.tsv:
read_idread_lengthbest_targetbest_query_covbest_identityexplained
Key metrics in summary.tsv:
reads_explained_fraction = explained_reads / total_readsbases_explained_fraction = explained_bases / total_basesmapped_to_human_fraction = mapped_to_human_reads / total_reads
data/
reads/
references/
scripts/
results/
Use this table to track which read file is mapped to which reference and whether the target is an amplicon or plasmid.
| sample_id | reads_file | reference_genbank | reference_seq_name | status (amplicon/plasmid) | notes |
|---|---|---|---|---|---|
| LFFHG8_1_pcr1_sub5 | data/reads/LFFHG8_fastq/LFFHG8_1_pcr1_sub5.fastq |
data/references/gblock_f1r1.gb |
gblock_f1r1 |
amplicon | 4/4586 reads mapped (0.09%); dominated by R1-flanked rDNA contaminant (~21.5%) |
| LFFHG8_1_pcr1_sub5_mock | data/reads/LFFHG8_1_pcr1_sub5.mock.fastq |
data/references/gblock_f1r1.gb |
gblock_f1r1 |
amplicon | Historical smoke-test input generated from consensus FASTA |
| 3LV7H5_1_sub5 | data/reads/3LV7H5_1_5.fastq |
-- | -- | amplicon | R1-flank + contaminant analysis only; 49.5% R1-flanked reads |
| 3LV7H5_2_sub6 | data/reads/3LV7H5_2_6.fastq |
-- | -- | amplicon | R1-flank + contaminant analysis only; 56.6% R1-flanked reads |