Skip to content

Commit

Permalink
Release 1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
lemieuxl committed Mar 24, 2017
2 parents 00af0fb + 949f093 commit cd40328
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 17 deletions.
78 changes: 67 additions & 11 deletions conda_build.sh
@@ -1,28 +1,84 @@
#!/usr/bin/env bash
#!/bin/bash -x

# Getting pyplink's version to build
pyplink_version=$1
if [ -z $pyplink_version ]; then
(>&2 echo "usage: $0 VERSION PYTHON_VERSION")
exit 1
fi

# Getting the version of python we want to build for
python_version=$2
if [ -z $python_version ]; then
(>&2 echo "usage: $0 VERSION PYTHON_VERSION")
exit 1
fi

# Creating a directory for the build module
mkdir -p conda_dist

# Creating a directory for the skeleton
mkdir -p skeleton
pushd skeleton

# Creating the skeleton
conda skeleton pypi pyplink
conda skeleton pypi pyplink --version $pyplink_version

# The different python versions and platforms
python_versions="2.7 3.3 3.4 3.5 3.6"
# Checking that fetching pyplink was successful
if [ $? -ne 0 ]; then
(>&2 echo "Error when creating skeleton for pyplink version $pyplink_version")
exit 1
fi

# The different python versions build
if [ "$python_version" == "2" ]; then
python_versions="2.7"
elif [ "$python_version" == "3" ]; then
python_versions="3.3 3.4 3.5 3.6"
else
(>&2 echo "$python_version: invalid Python version")
exit 1
fi

# The different build platforms
platforms="all"

# Building
for python_version in $python_versions
do
for python_build_version in $python_versions; do
# Building
conda build --python $python_version pyplink &> log.txt
filename=$(egrep "^# [$] anaconda upload \S+$" log.txt | cut -d " " -f 5)
conda build --python $python_build_version pyplink &> log.txt

# Checking the build was completed
if [ $? -ne 0 ]; then
cat log.txt
(>&2 echo "Error when building pyplink $pyplink_version (python $python_build_version)")
exit 1
fi

# Converting
for platform in $platforms
do
# Fetching the file name of the build
filename=$(grep -oP "anaconda upload \K(\S+)$" log.txt)

# Checking the file exists
if [ -z $filename ]||[ ! -e $filename ]; then
echo "Problem fetching file $filename" 1>&2
exit 1
fi

# Converting to the different platforms
for platform in $platforms; do
conda convert -p $platform $filename -o ../conda_dist

# Checking the conversion was completed
if [ $? -ne 0 ]; then
(>&2 echo "Problem converting pyplink $pyplink_version (python $python_build_version) to $platform")
exit 1
fi

done

# Purging
conda build purge

done

popd
Expand Down
12 changes: 10 additions & 2 deletions pyplink/pyplink.py
Expand Up @@ -251,7 +251,12 @@ def _read_bim(self):
duplicated = bim.snp.duplicated(keep=False)
duplicated_markers = bim.loc[duplicated, "snp"]
duplicated_marker_counts = duplicated_markers.value_counts()
self._dup_markers = set(duplicated_marker_counts.index)

# The dictionary that will contain information about the duplicated
# markers
self._dup_markers = {
m: [] for m in duplicated_marker_counts.index
}

# Logging a warning
logger.warning("Duplicated markers found")
Expand All @@ -267,6 +272,9 @@ def _read_bim(self):
new_name = "{}:dup{}".format(marker, counter[marker])
bim.loc[i, "snp"] = new_name

# Updating the dictionary containing the duplicated markers
self._dup_markers[marker].append(new_name)

# Resetting the index
bim = bim.set_index("snp", verify_integrity=True)

Expand Down Expand Up @@ -320,7 +328,7 @@ def get_duplicated_markers(self):
if self._has_duplicated:
return self._dup_markers
else:
return set()
return {}

def _read_fam(self):
"""Reads the FAM file."""
Expand Down
8 changes: 5 additions & 3 deletions pyplink/tests/test_pyplink.py
Expand Up @@ -1129,10 +1129,12 @@ def test_dup_markers(self, pyplink_logger):
np.testing.assert_array_equal(geno, self.genotypes[i])

# Checking the list of duplicated markers
self.assertEqual(
set(m.split(":")[0] for m in markers if ":" in m),
pedfile.get_duplicated_markers(),
expected_dup = dict(
rs2949420=["rs2949420:dup1", "rs2949420:dup2"],
rs4030303=["rs4030303:dup1", "rs4030303:dup2", "rs4030303:dup3"],
rs940550=["rs940550:dup1", "rs940550:dup2"],
)
self.assertEqual(expected_dup, pedfile.get_duplicated_markers())

# Closing the file
pedfile.close()
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -17,7 +17,7 @@

MAJOR = 1
MINOR = 3
MICRO = 3
MICRO = 4
VERSION = "{}.{}.{}".format(MAJOR, MINOR, MICRO)


Expand Down

0 comments on commit cd40328

Please sign in to comment.