File: refactoring.pl

package info (click to toggle)
python-pysam 0.15.4+ds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 27,992 kB
  • sloc: ansic: 140,738; python: 7,881; sh: 265; makefile: 223; perl: 41
file content (60 lines) | stat: -rw-r--r-- 1,822 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
while (<STDIN>) {
    # Samfile refactoring
    s/Samfile/AlignmentFile/g;

    # AlignedRead refactoring
    s/AlignedRead/AlignedSegment/g;
    
    # Do these patterns first as they match
    # the new names
    s/\.query/\.query_alignment_sequence/g;
    s/\.positions/\.getReferencePositions()/g;

    # Tabixfile, etc
    s/Tabixfile/TabixFile/g;
    s/Fastafile/FastaFile/g;
    s/Fastqfile/FastqFile/g;

    # basic attributes
    s/\.qname/\.query_name/g;
    s/\.tid/\.reference_id/g;
    s/\.pos/\.reference_start/g;
    s/\.mapq/\.mapping_quality/g;
    s/\.rnext/\.next_reference_id/g;
    s/\.pnext/\.next_reference_start/g;
    s/\.tlen/\.query_length/g;
    s/\.seq/\.query_sequence/g;
    if (/\.qual =/) {
	s/([[\].0-9a-zA-Z]*)\.qual = (\S*)/$1.query_qualities = pysam.fromQualityString($2)/g;
    } else {
	s/([[\].0-9a-zA-Z]*)\.qual/pysam.toQualityString($1\.query_qualities)/g;
    }
    s/\.alen/\.reference_length/g;
    s/\.aend/\.reference_end/g;
    s/\.rlen/\.query_alignment_length/g;
    s/([[\].0-9a-zA-Z]*)\.qqual/pysam.toQualityString($1\.query_alignment_qualities)/g;
    s/\.qstart/\.query_alignment_start/g;
    s/\.qend/\.query_alignment_end/g;
    s/\.qlen/\.query_alignment_length/g;
    s/\.mrnm/\.next_reference_id/g;
    s/\.rnext/\.next_reference_id/g;
    s/\.mpos/\.next_reference_start/g;
    s/\.rname/\.reference_id/g;
    s/\.isize/\.query_length/g;
    s/\.cigar/\.cigartuples/g unless (/\.cigarstring/);

    s/\.blocks/\.getBlocks()/g;
    s/\.aligned_pairs/\.getAlignedPairs()/g;
    s/\.inferred_length/\.getInferredQueryLength()/g;

    s/\.overlap()/\.getOverlap()/g;

    # PileupProxy
    s/\.n([^a-zA-Z])/\.nsegments$1/g;
    
    # if (/\.mrnm/ || /\.rnext/ || /\.mpos/ || /\.rname/)
    # { 
    #     warn "Deprecated tag $& at line $.\n";
    # }
    print;
}