Ejemplo n.º 1
0
def mark_duplicates(bam_path, output_bam_path, output_metrics_path):
    cmd = "java -Xmx1g -jar {} \
          INPUT={} \
          OUTPUT={} \
          METRICS_FILE={}"\
          .format(_MARK_DUPLICATES, bam_path, output_bam_path, output_metrics_path)
    common.system(cmd)
    common.assert_file(output_bam_path, cmd)
    common.assert_file(output_metrics_path, cmd)

    return output_bam_path
Ejemplo n.º 2
0
def view(bam_path, sam_path):
    cmd = samtools_exe + " view -hbS -o {} {}".format(bam_path, sam_path)
    common.system(cmd) 
    common.assert_file(bam_path, cmd)
    return bam_path
Ejemplo n.º 3
0
def mpileup(fasta_path, bam_sorted_path, out_vcf_path):
    cmd = samtools_exe + " mpileup -uf {} {} | bcftools view -vcg - > {}".format(fasta_path, bam_sorted_path, out_vcf_path)
    common.system(cmd)
    common.assert_file(out_vcf_path, cmd)
    return out_vcf_path
Ejemplo n.º 4
0
def index(bam_path):
    cmd = samtools_exe + " index {}".format(bam_path)
    common.system(cmd)
    common.assert_file(bam_path, cmd)
    return bam_path
Ejemplo n.º 5
0
def merge(sam_paths, merged_bam_path, bam_paths):
    cmd = samtools_exe + " merge -r -n -h {} {} {}".format(" -h ".join(sam_paths), merged_bam_path, " ".join(bam_paths))
    common.system(cmd)
    common.assert_file(merged_bam_path, cmd)
    return merged_bam_path
Ejemplo n.º 6
0
def sort(bam_path, bam_sorted_prefix):       
    cmd = samtools_exe + " sort {} {}".format(bam_path, bam_sorted_prefix)
    sorted_bam_path = bam_sorted_prefix + ".bam" 
    common.system(cmd)
    common.assert_file(sorted_bam_path, cmd)
    return sorted_bam_path
Ejemplo n.º 7
0
def merge_sams(sam_paths, output, merge_seq_dicts = True):
    cmd = "java -jar {} INPUT={} OUTPUT={} MERGE_SEQUENCE_DICTIONARIES={}".format(_MERGE_SAMS," INPUT=".join(sam_paths), output, "true" if merge_seq_dicts else "false")
    common.system(cmd)
    common.assert_file(output, cmd)
    return output
Ejemplo n.º 8
0
def sort_sam(aln_path, output_aln_path, sort_option = "coordinate"):
    cmd = "java -jar {} INPUT={} OUTPUT={} SORT_ORDER={}".format(_SORT_SAM, aln_path, output_aln_path, sort_option)
    common.system(cmd)
    common.assert_file(output_aln_path, cmd)
    return output_aln_path
Ejemplo n.º 9
0
def create_sequence_dictionary(ref_path, output_path):
    cmd = "java -jar {} R={} O={}".format(_CREATE_SEQUENCE_DICTIONARY, ref_path, output_path)
    common.system(cmd)
    common.assert_file(output_path, cmd)
    return output_path
Ejemplo n.º 10
0
def add_or_replace_read_groups(input_path, output_path):
    cmd = "java -jar {} I={} O={} LB=FOO PL=ILLUMINA PU=BAR SM=NEE".format(_ADD_OR_REPLACE_READ_GROUPS, input_path, output_path)
    common.system(cmd) 
    common.assert_file(output_path, cmd)
    return output_path