コード例 #1
0
    def write_record(self, CHROM, POS, ID, REF, ALT, gtype, INFO='.'):
        """Write a fully specified VCF record.

        WARNING: 'REF' isn't checked against the reference genome.

        Do nothing if 'REF' contains characters outside ACGT (notably N).
        Return whether anything was written.
        """
        write = util.is_proper_strand(REF)
        if write:
            QUAL = 20  # Default 1/100 error probability.
            FILTER = 'PASS'
            FORMAT = 'GT'
            print(CHROM,
                  POS,
                  ID,
                  REF,
                  ALT,
                  QUAL,
                  FILTER,
                  INFO,
                  FORMAT,
                  gtype,
                  sep='\t',
                  file=self._output)
        return write
コード例 #2
0
ファイル: genome.py プロジェクト: nuin/smash
    def random_sequence(self, chrom, length):
        """Return a random segment of given 'length' from given 'chrom'.

        Not quite random: the sequence won't have any "N".
        """
        while True:
            start = random.randint(0, len(self._fasta[chrom]) - length)
            seq = self.ref(chrom, start, start + length)
            if util.is_proper_strand(seq):
                return seq
コード例 #3
0
    def random_sequence(self, chrom, length):
        """Return a random segment of given 'length' from given 'chrom'.

        Not quite random: the sequence won't have any "N".
        """
        while True:
            start = random.randint(0, len(self._fasta[chrom]) - length)
            seq = self.ref(chrom, start, start + length)
            if util.is_proper_strand(seq):
                return seq
コード例 #4
0
ファイル: vcfwriter.py プロジェクト: ycaihua/smash
    def write_record(self, CHROM, POS, ID, REF, ALT, gtype):
        """Write a fully specified VCF record.

        WARNING: 'REF' isn't checked against the reference genome.

        Do nothing if 'REF' contains characters outside ACGT (notably N).
        Return whether anything was written.
        """
        write = util.is_proper_strand(REF)
        if write:
            QUAL = 20               # Default 1/100 error probability.
            FILTER = 'PASS'
            FORMAT = 'GT'
            print(CHROM, POS + 1, ID, REF, ALT, QUAL, FILTER, '.', FORMAT, gtype,
                  sep='\t', file=self._output)
        return write