Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Python Package Import Incompatibility: pysam #374

Closed
skchronicles opened this issue Nov 27, 2018 · 3 comments
Closed

Python Package Import Incompatibility: pysam #374

skchronicles opened this issue Nov 27, 2018 · 3 comments

Comments

@skchronicles
Copy link
Collaborator

No description provided.

@skchronicles
Copy link
Collaborator Author

Secondary Issue related to HPC Snakemake Upgrade #371

Dry-running the second half of the ChIP-seq pipeline causes a python ImportError. This error is related to recent changes HPC has made to the python/3.5 module on Biowulf (see issue #371 for more information).

  • TLDR: HPC upgraded the version of snakemake that is bundled with module load python/3.5. It was changed from snakemake version 5.1.3 to snakemake version 5.3.0. There are a few incompatibility issues with these two versions of snakemake due to changes in command-line arguements. To overcome these issues, snakemake/5.1.3 is loaded after module loading python 3.5.

The import error is due to the version of python that is bundled with snakemake (see: /usr/local/Anaconda/envs_app/snakemake/5.1.3/bin/). This version of python only includes the standard libraries that come standard with python 3.6, and does not include pysam.

@skchronicles
Copy link
Collaborator Author

Update

After closer inspection, it looks that pysam is not actively being used. The function call to normalize_bam_file_chromosomes, which was using pysam, has been commented out. For the time being, I will move the import statement inside of the function normalize_bam_file_chromosomes.

def normalize_bam_file_chromosomes(bamfns, obamfns=[], suffix='.common_chrom.bam'):
    from pysam import Samfile, FastaFile
    counts = []
    for bamfn1 in bamfns :
        bam1 = Samfile(bamfn1)

        cnt1 = Counter()
        for aread1 in bam1 :
            if aread1.is_unmapped :
                continue
            cnt1[aread1.reference_name] += 1 
        bam1.close()
        counts.append(cnt1)
    
    common = None
    for cnt in counts :
        if common != None :
            common = common.intersection(cnt)
        else :
            common = set(cnt)

Changes will be made in the following locations:

  1. module load ccbrpipeliner/3.0
  2. master branch
  3. activeDev branch

Permanent solution:

Remove the snakemake run for the rule PePr, and make a script. This will allow us to submit a job with the exact version of python that should be used.

@skchronicles skchronicles self-assigned this Nov 27, 2018
@skchronicles skchronicles changed the title Python Package Import Incomaptiblity: pysam Python Package Import Incompatibility: pysam Nov 27, 2018
@skchronicles
Copy link
Collaborator Author

Resolved

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant