text: user1749: I want to compute the depth of coverage only for specific intervals in phase 3, 1000 genomes project.I have not worked with 1000 genomes project before, so a bit unfamiliar with it. I do not want to download all of the bam files for the entire genomic region, just those intervals which I am interested in them.
  I guess I can use this (I found from biostars forum)
  samtools -bu view 'http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/HG01375/alignment/HG01375.mapped.ILLUMINA.bwa.CLM.low_coverage.20120522.bam' "2:1000000-2000000" | (...)
  
  However, I am just a bit confused. First of all, when I try the code above directly from the command line, I get an error message "No such file or directory"! Am I doing something wrong? or should I provide a specific path?
  Second, I want to run  it for the mapped files for all individuals: *.bam”. through a loop. 
  Can anyone help me to solve my problem?
  
  user77: The command you're looking for is:
  samtools view -c http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/HG01375/alignment/HG01375.mapped.ILLUMINA.bwa.CLM.low_coverage.20120522.bam 2:1000000-2000000
  
  For a series of intervals, you'd be better off scripting something with pysam:
  import pysam
  bam = pysam.AlignmentFile("some file.bam")
  regions = open("your regions.bed")
  for region in regions:
      chrom, start, end = region.split("\t")
       bam.count(chrom, int(start), int(end))  # Do something with the result
  
  You might see if there are bigWig files available, they'd be faster to process.
  
original_text: 1749: <p>I want to compute the depth of coverage only for specific intervals in phase 3, 1000 genomes project.I have not worked with 1000 genomes project before, so a bit unfamiliar with it. I do not want to download all of the bam files for the entire genomic region, just those intervals which I am interested in them.
  I guess I can use this (I found from biostars forum)</p>
  
  <pre><code>samtools -bu view 'http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/HG01375/alignment/HG01375.mapped.ILLUMINA.bwa.CLM.low_coverage.20120522.bam' "2:1000000-2000000" | (...)
  </code></pre>
  
  <p>However, I am just a bit confused. First of all, when I try the code above directly from the command line, I get an error message "No such file or directory"! Am I doing something wrong? or should I provide a specific path?
  Second, I want to run  it for the mapped files for all individuals: <code>*.bam”.</code> through a loop. </p>
  
  <p>Can anyone help me to solve my problem?</p>
   77: <p>The command you're looking for is:</p>
  
  <pre><code>samtools view -c http://ftp.1000genomes.ebi.ac.uk/vol1/ftp/phase3/data/HG01375/alignment/HG01375.mapped.ILLUMINA.bwa.CLM.low_coverage.20120522.bam 2:1000000-2000000
  </code></pre>
  
  <p>For a series of intervals, you'd be better off scripting something with pysam:</p>
  
  <pre class="lang-py prettyprint-override"><code>import pysam
  bam = pysam.AlignmentFile("some file.bam")
  regions = open("your regions.bed")
  for region in regions:
      chrom, start, end = region.split("\t")
       bam.count(chrom, int(start), int(end))  # Do something with the result
  </code></pre>
  
  <p>You might see if there are bigWig files available, they'd be faster to process.</p>
  