Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • ONT_pilot_gitlab ONT_pilot_gitlab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 13
    • Issues 13
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ESB
  • ONT_pilot_gitlabONT_pilot_gitlab
  • Issues
  • #23

Closed
Open
Created May 28, 2020 by Susheel Busi@susheel.busiMaintainer

Analysis/Figure: mappability index

  • Rather than putting the following in the "analysis" snakefile, can we code this into the Rscript when making the figures?
# using the mappability_index files. example: `hybrid_mmi_merged.txt` file in the `results/mapping` folder, which will be created using the snakefile I'm making.

for file in *.txt; do echo $file; egrep 'total | mapped' $file | head -n 2; done | paste - - - | \
   sed $'1 i\\\nsample\ttotal\tmapped\tpercent_mapped' | sed 's/ + 0 in total (QC-passed reads + QC-failed reads)//g' | \
     sed s'/ + 0 mapped//g' | sed 's/ : N\/A)//g' | sed s'/(//g' | sed s'/.txt//g' | \
       awk '{print$0=$1"\t"$2"\t"$3"\t"$4}' > mappability_index.tsv

And the same for the counts where contigs smaller than 1Kb - 5kb are removed. examples below

for file in *counts.txt
do 
  echo "$file"
  awk '$2 >= 1000 {sum += $3} END {print sum}' "$file"  # sum of number of reads (3rd column) if 2nd column is greater/equal to 1000
  awk '{sum+=$3+$4} END {print sum}' "$file"            # sum of 3rd and 4th columns to get total reads
done | paste - - - | awk '$4=100*$2/$3' | \             # getting the percentage from columns 2 and 3 and writing to column-4
  sed $'1 i\\\nsample\tmapped_reads\ttotal\tpercent_mapped' > mappability_over_1000bp.txt

# collating the sums for contigs larger than 1500 bp
for file in *counts.txt
do 
  echo "$file"
  awk '$2 >= 1500 {sum += $3} END {print sum}' "$file"
  awk '{sum+=$3+$4} END {print sum}' "$file"
done | paste - - - | awk '$4=100*$2/$3' | \
  sed $'1 i\\\nsample\tmapped_reads\ttotal\tpercent_mapped' > mappability_over_1500bp.txt

@valentina.galata @cedric.laczny what do you think? or should I try to code this into the snakefile? The "headache" is that the names of the BAM files are super long and different. Could create symlinks like I did in the past, but want to avoid creating more than we need to.

Edited Jun 04, 2020 by Valentina Galata
Assignee
Assign to
Time tracking