modified: Makefile
[GalaxyCodeBases.git] / perl / etc / WoodyMiaoLin / PbeBefore2015 / get_samples_with_onlyATP8.pl
blobd725b6b1a594fb3f4f1ddbf2f6c27d8011ce9605
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 open I1, "<", "../../../a.mt_haplotype_full_length_tree/b.modified_alignment/haplotype_sampleID.txt";
6 open I2, "<", "../../a.fromZhangYue/AllPbeATP8_20120315.fasta";
7 open O, ">", "samples_with_onlyATP8.fasta";
9 my @s; #sampleIDs with full mt sequence.
10 while (<I1>) {
11 /\t(.+)\n/;
12 my @a = split / /, $1;
13 push @s, @a;
15 close I1;
17 while (<I2>) {
18 $/ = ">";
19 my $seq = <I2>;
20 chomp $seq;
21 $seq =~ s/\s//g;
22 $/ = "\n";
23 s/>//;
24 /^(\S+)\s/;
25 my $b = $1;
26 if (!grep(/^$b$/, @s)) {
27 print O ">$1\n$seq\n";
30 close I2;
31 close O;