8000 Revisions · pileup formatからmultiple alignment形式を得る · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Instantly share code, notes, and snippets.

@soh-i
Created November 6, 2012 06:24
Show Gist options
  • Save soh-i/4022964 to your computer and use it in GitHub Desktop.
Save soh-i/4022964 to your computer and use it in GitHub Desktop.

Revisions

  1. soh-i revised this gist Nov 6, 2012. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    ## pileup形式
    * pileupは、1行が1ポジションのデータであり、Genome viewer的な表示(マルチプルアラインメント形式っぽく)には、base string columnの行列を入れ替えて表示する必要がある。

    ### pileup形式
    ```
    chr1 10258 G 4 ..^M.^M. XBEE 54,49,1,1
    chr1 10259 T 4 .... DBRR 55,50,2,2
    @@ -25,7 +27,7 @@ chr1 10298 T 20 ................,... aaa:aa``aaaaaaa_X__U 41,41,34,34,34,34,33,3
    chr1 10299 T 21 ................,...^M, _aa7aa``aa^aaaaaR``aE 42,42,35,35,35,35,34,34,30,20,16,16,16,16,14,10,6,5,5,3,1%
    ```

    ## Genome viewer的な感じで表示する(samtools tview)
    ### Genome viewer的な感じで表示する(samtools tview)
    ```
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    . . . G g . . . . . . . . . . . . . . . . . .
    @@ -53,7 +55,7 @@ chr1 10299 T 21 ................,...^M, _aa7aa``aa^aaaaaR``aE 42,42,35,35,35,35,
    ,
    ```

    ## コード
    ### コード
    ```perl
    #!/usr/bin/env perl

  2. soh-i revised this gist Nov 6, 2012. 1 changed file with 24 additions and 23 deletions.
    47 changes: 24 additions & 23 deletions gistfile1.md
    < 10000 template class="js-line-alert-template">
    Original file line number Diff line number Diff line change
    @@ -27,29 +27,30 @@ chr1 10299 T 21 ................,...^M, _aa7aa``aa^aaaaaR``aE 42,42,35,35,35,35,

    ## Genome viewer的な感じで表示する(samtools tview)
    ```
    ...Gg..................
    ....g..................
    ^..........N...........
    M......................
    . ^...............
    ^ M...............
    M ................
    . ^...............
    M^..............
    .M..............
    ^. ^..........
    M^ M ...
    .M . ...
    ^. ...
    M ...
    . ...
    ,,,
    ...
    ...
    ^..
    M ^
    . M
    ,
    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    . . . G g . . . . . . . . . . . . . . . . . .
    . . . . g . . . . . . . . . . . . . . . . . .
    ^ . . . . . . . . . . N . . . . . . . . . . .
    M . . . . . . . . . . . . . . . . . . . . . .
    . ^ . . . . . . . . . . . . . . .
    ^ M . . . . . . . . . . . . . . .
    M . . . . . . . . . . . . . . . .
    . ^ . . . . . . . . . . . . . . .
    M ^ . . . . . . . . . . . . . .
    . M . . . . . . . . . . . . . .
    ^ . ^ . . . . . . . . . .
    M ^ M . . .
    . M . . . .
    ^ . . . .
    M . . .
    . . . .
    , , ,
    . . .
    . . .
    ^ . .
    M ^
    . M
    ,
    ```

    ## コード
  3. soh-i revised this gist Nov 6, 2012. 1 changed file with 8 additions and 5 deletions.
    13 changes: 8 additions & 5 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -63,7 +63,7 @@ use Data::Dumper;
    my $max_height = 0;
    my $max_width = 0;

    my $in_pileup = shift || die;
    my $in_pileup = shift || die "Usage: perl $0 in.pileup";
    open my $FH, '<', $in_pileup or die;
    my @matrix;
    while ( <$FH> ) {
    @@ -80,15 +80,18 @@ while ( <$FH> ) {
    $max_width = $#row + 1;
    }
    }

    for ( 1..$max_height ) {
    printf "%3d", $_;
    }
    print "\n";
    for my $j ( 0 .. $max_width-1 ) {
    for my $i ( 0 .. $max_height-1 ) {
    if ( $matrix[$i][$j] ) {
    print $matrix[$i][$j];
    printf "%3s", $matrix[$i][$j];
    } else {
    print ' ';
    printf "%3s", ' ';
    }
    }
    print "\n";
    }
    ```
    ```
  4. soh-i revised this gist Nov 6, 2012. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    ## pileup形式
    ```
    chr1 10258 G 4 ..^M.^M. XBEE 54,49,1,1
    chr1 10259 T 4 .... DBRR 55,50,2,2
    @@ -23,7 +24,8 @@ chr1 10297 C 20 ................,..^M. `aaZ_a__`b`aaaaW\a^E 40,40,33,33,33,33,32
    chr1 10298 T 20 ................,... aaa:aa``aaaaaaa_X__U 41,41,34,34,34,34,33,33,29,19,15,15,15,15,13,9,5,4,4,2
    chr1 10299 T 21 ................,...^M, _aa7aa``aa^aaaaaR``aE 42,42,35,35,35,35,34,34,30,20,16,16,16,16,14,10,6,5,5,3,1%
    ```
    このようなpileup形式から、以下のようなマルチプルアラインメント形式を作る。

    ## Genome viewer的な感じで表示する(samtools tview)
    ```
    ...Gg..................
    ....g..................
    @@ -49,6 +51,8 @@ M ................
    . M
    ,
    ```

    ## コード
    ```perl
    #!/usr/bin/env perl

  5. soh-i renamed this gist Nov 6, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. soh-i created this gist Nov 6, 2012.
    90 changes: 90 additions & 0 deletions gistfile1.txt